-
Notifications
You must be signed in to change notification settings - Fork 4
211 lines (178 loc) · 5.95 KB
/
pythonpackage.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: build
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
jobs:
build-and-test:
name: Testing with Python 3.${{ matrix.python_minor }} on Linux
runs-on: ubuntu-20.04
strategy:
matrix:
python_minor: [ "6" , "7" , "8" , "9" , "10" ]
steps:
- uses: actions/checkout@v2
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: 🛠 Build and Test Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp3{0}-manylinux_x86_64', matrix.python_minor) }}
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
sdist:
if: startsWith(github.ref, 'refs/tags')
needs: build-and-test
name: Source distribution
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Install requirements
run: |
pip3 install --user check-manifest twine
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -r requirements-dev.txt
- name: Run check-manifest
run: python3 -m check_manifest
- name: Build sdist
run: python3 -m build --sdist --outdir wheelhouse
- name: Install from sdist
run: pip3 install --user wheelhouse/*.tar.gz
- name: Check sdist
run: python3 -m twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*.tar.gz
wheels_macos:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build macOS ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels
runs-on: macos-11
strategy:
fail-fast: true
matrix:
cibw_python: [ "cp38-*", "cp39-*", "cp310-*" ]
cibw_arch: [ "x86_64", "arm64" ]
steps:
- uses: actions/checkout@v2
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
echo DEPLOYMENT_TARGET=10.9 >> $GITHUB_ENV
- name: Changing deployment target
if: matrix.cibw_arch == 'arm64'
run: echo DEPLOYMENT_TARGET=12.0 >> $GITHUB_ENV
- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }}
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_TEST_SKIP: "*-macosx_arm64"
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CFLAGS: "-Wno-implicit-function-declaration"
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error
wheels_linux:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build ${{ matrix.cibw_buildlinux }} ${{ matrix.cibw_arch }} wheels
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
cibw_buildlinux: [ manylinux, musllinux ]
cibw_arch: [ "x86_64", "aarch64" ]
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
if: matrix.cibw_arch == 'aarch64'
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp3*-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }}
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error
wheels_windows:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build Windows wheels
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-*"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error
publish-wheels:
if: startsWith(github.ref, 'refs/tags')
needs: [wheels_macos, wheels_linux, wheels_windows]
name: Publish wheels
runs-on: ubuntu-20.04
steps:
- name: Collect sdist and wheels
uses: actions/[email protected]
with:
name: wheels
path: wheelhouse
- name: Install twine
run: python -m pip install twine
- name: 📦 Publish distribution to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --skip-existing wheelhouse/*