-
Notifications
You must be signed in to change notification settings - Fork 9
122 lines (117 loc) · 4.66 KB
/
python-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master, debugging ]
tags:
- "v*.*.*"
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run:
runs-on: ${{ matrix.os }}
env:
VERSION: 1.1.12
strategy:
matrix:
# python-version: [3.7, 3.8, 3.9, "3.10"]
# os: ['windows-latest', 'ubuntu-latest', 'macos-latest']
# os: ['ubuntu-latest', 'macos-10.15', 'macos-latest']
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
os: ['ubuntu-20.04', 'macos-10.15', 'windows-2019']
fail-fast: false
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U flake8 pytest scikit-build cython ninja auditwheel
- name: Install dependencies on the linux platform
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
sudo apt update
sudo apt-get install libusb-1.0-0-dev libudev-dev
python -m pip install -U patchelf
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build pyeoskit
run: |
python setup.py sdist bdist_wheel
- name: get whl file
id: whlfile
shell: bash
run: |
echo "value=`python scripts/get_whl_file.py dist`" >> $GITHUB_OUTPUT
- name: Install pyeoskit
run: |
python -m pip uninstall pyeoskit -y;python -m pip install ./dist/${{ steps.whlfile.outputs.value }}
- name: Test
working-directory: ./pytest
run: |
python3 -m pytest test_c_apis.py
- name: auditwheel repair
if: ${{ matrix.os == 'ubuntu-20.04' }}
id: manylinuxwhlfile
working-directory: ./dist
run: |
python -m auditwheel repair --plat manylinux_2_17_x86_64 ${{ steps.whlfile.outputs.value }}
echo "value=`python ../scripts/get_whl_file.py ./wheelhouse manylinux`" >> $GITHUB_OUTPUT
echo "+++manylinuxwhlfile: ${{ steps.manylinuxwhlfile.outputs.value }}"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./dist/${{ steps.whlfile.outputs.value }}
- name: Release manylinux wheel
if: ${{ matrix.os == 'ubuntu-20.04' && startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
with:
files: |
./dist/wheelhouse/${{ steps.manylinuxwhlfile.outputs.value }}
- name: Downloading whl files
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.10' }}
working-directory: dist
run: |
python ../scripts/download.py ${{ env.VERSION }}
rm pyeoskit-${{ env.VERSION }}-cp310-cp310-linux_x86_64.whl
rm -r wheelhouse
- name: Upload wheel checksums
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.10' }}
with:
files: |
./dist/checksum.txt
- name: Remove dist/checksum.txt
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.10' }}
run: |
rm ./dist/checksum.txt
- name: Publish a Python distribution to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.10' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}