-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (109 loc) · 4.1 KB
/
python-package.yml
File metadata and controls
134 lines (109 loc) · 4.1 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
name: Windows & Mac Build
on: [push, pull_request]
jobs:
deploy:
strategy:
fail-fast: false
matrix:
os: ['macOS-latest', 'windows-latest']
python-version: ['3.10', '3.9', '3.8', '3.7', '3.6']
compiler: ['gcc']
architecture: ['x86', 'x64']
exclude:
- os: macos-latest
python-version: 3.6
timeout-minutes: 30
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ${{ matrix.architecture }} - ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
# Setup for Windows - installs the correct python architecture, x86 / x64
- name: Set up Python (Win) ${{ matrix.python-version }} ${{ matrix.architecture }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
if: runner.os == 'Windows'
# Setup for Mac & Linux, both don't support architecture selection without using specific versions
- name: Set up Python (Non-Win) ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
if: runner.os != 'Windows'
# Display the versions
- name: Show runner information
run: |
python --version
pip --version
# Installs the dependencies, add yours here
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel pytest twine
# Syntax check
- name: Lint with flake8
run: |
pip install flake8
# 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
# Build
- name: Build package
run: python setup.py build
# Install Local
- name: Install package
run: python setup.py install --user
# Run Tests, have to be in a file with test in name in a folder named tests with functions with test in the name
- name: Run tests
run: pytest -v -s
# Create wheels for deployment
- name: Build wheels
run: python setup.py sdist bdist_wheel --skip-build
# Deploy
- name: Publish
if: success() && runner.os != 'Linux' && github.event_name == 'push'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/* --skip-existing
manylinux:
if: success() && github.event_name == 'push'
needs: [deploy]
strategy:
matrix:
os: [ubuntu-20.04]
compiler: ['gcc']
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel pytest twine
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
uses: joerick/cibuildwheel@v2.3.0
env:
CIBW_ARCHS_LINUX: auto aarch64
CIBW_BUILD: |
cp36-manylinux_x86_64 cp36-manylinux_i686 cp36-manylinux_aarch64
cp37-manylinux_x86_64 cp37-manylinux_i686 cp37-manylinux_aarch64
cp38-manylinux_x86_64 cp38-manylinux_i686 cp38-manylinux_aarch64
cp39-manylinux_x86_64 cp39-manylinux_i686 cp39-manylinux_aarch64
cp310-manylinux_x86_64 cp310-manylinux_i686 cp310-manylinux_aarch64
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload ./wheelhouse/*.whl --skip-existing
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl