-
-
Notifications
You must be signed in to change notification settings - Fork 945
324 lines (286 loc) · 10.4 KB
/
create-wheels.yaml
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: Create wheel
on:
# run when a release has been created
release:
types: [created]
env:
# set this so the falcon test uses the installed version and not the local one
PYTHONNOUSERSITE: 1
# comment TWINE_REPOSITORY_URL to use the real pypi. NOTE: change also the secret used in TWINE_PASSWORD
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
jobs:
# four jobs are defined make-wheel-win-osx, make-wheel-linux, make-source-dist and make-emulated-wheels
# the wheels jobs do the the same steps, but linux wheels need to be build to target manylinux
make-wheel-win-osx:
needs: make-source-dist
name: ${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- "windows-latest"
- "macos-latest"
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
architecture:
- x64
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Create wheel
# `--no-deps` is used to only generate the wheel for the current library.
# Redundant in falcon since it has no dependencies
run: |
python -m pip install --upgrade pip
pip --version
pip install 'setuptools>=47' 'wheel>=0.34'
pip wheel -w dist -v --no-deps .
- name: Check created wheel
# - install the created wheel without using the pypi index
# - check the cython extension
# - runs the tests
run: |
pip install tox
tox -e wheel_check -- ${{ matrix.pytest-extra }}
- name: Upload wheels to release
# upload the generated wheels to the github release
uses: AButler/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: 'dist/*.whl'
- name: Publish wheel
# the action https://github.com/marketplace/actions/pypi-publish runs only on linux and we cannot specify
# additional options
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing dist/*
make-wheel-linux:
needs: make-source-dist
# see also comments in the make-wheel-win-osx job for details on the steps
name: ${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- "ubuntu-latest"
python-version:
# the versions are <python tag>-<abi tag> as specified in PEP 425.
- cp37-cp37m
- cp38-cp38
- cp39-cp39
- cp310-cp310
- cp311-cp311
- cp312-cp312
architecture:
- x64
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get python version
id: linux-py-version
env:
py_tag: ${{ matrix.python-version }}
run: |
platform=${py_tag%%-*}
version=${platform:2:1}.${platform:3:3}
echo $version
echo "::set-output name=python-version::$version"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ steps.linux-py-version.outputs.python-version }}
architecture: ${{ matrix.architecture }}
- name: Create wheel for manylinux 2014
uses: RalfG/[email protected]_x86_64
# this action generates 2 wheels in dist/. linux, manylinux2014
with:
# Remove previous original wheel just to be sure it is recreated. Should not be needed
pre-build-command: "rm -f ./dist/*-linux*.whl"
python-versions: ${{ matrix.python-version }}
build-requirements: "setuptools>=47 wheel>=0.34"
pip-wheel-args: "-w ./dist -v --no-deps"
- name: Check created wheel
# - install the created wheel without using the pypi index
# - check the cython extension
# - runs the tests
run: |
pip install tox
tox -e wheel_check -- ${{ matrix.pytest-extra }}
- name: Upload wheels to release
# upload the generated wheels to the github release
uses: AButler/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: 'dist/*manylinux*'
- name: Publish wheel
# We upload all manylinux wheels. pip will download the appropriate one according to the system.
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing dist/*manylinux*
make-source-dist:
# see also comments in the make-wheel-win-osx job for details on the steps
name: sdist-${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- "ubuntu-latest"
python-version:
- "3.10"
architecture:
- x64
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Create sdist
run: |
python -m pip install --upgrade pip
pip --version
pip install setuptools>=47 wheel>=0.34
python setup.py sdist --dist-dir dist
python .github/workflows/scripts/verify_tag.py dist
- name: Upload wheels to release
# upload the generated wheels to the github release
uses: AButler/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: 'dist/*.tar.gz'
- name: Publish sdist
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing dist/*
make-emulated-wheels:
needs: make-source-dist
# see also comments in the make-wheel-linux job for details on the steps
name: ${{ matrix.python-version }}-${{ matrix.architecture }}
runs-on: ubuntu-latest
strategy:
matrix:
os:
- "ubuntu-latest"
python-version:
# the versions are <python tag>-<abi tag> as specified in PEP 425.
- cp37-cp37m
- cp38-cp38
- cp39-cp39
- cp310-cp310
- cp311-cp311
- cp312-cp312
architecture:
- aarch64
- s390x
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Cache wheels
uses: actions/cache@v3
with:
path: .pip
key: ${{ matrix.python-version }}-${{ matrix.architecture }}-pip-${{ hashFiles('requirements/tests') }}
- name: Set up emulation
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Create wheel for manylinux 2014 for arm
if: ${{ matrix.architecture == 'aarch64' }}
uses: RalfG/[email protected]_aarch64
# this action generates 2 wheels in dist/. linux, manylinux2014
with:
python-versions: ${{ matrix.python-version }}
build-requirements: "setuptools>=47 wheel>=0.34"
pip-wheel-args: "-w ./dist -v --no-deps"
- name: Check created wheel for arm
if: ${{ matrix.architecture == 'aarch64' }}
uses: docker://quay.io/pypa/manylinux2014_aarch64
env:
PIP_CACHE_DIR: /github/workspace/.pip/
PYTHON_VERSION: ${{ matrix.python-version }}
with:
args: |
bash -c "
export PATH=/opt/python/${{ matrix.python-version }}/bin:$PATH &&
pip install tox 'pip>=20' &&
tox -e wheel_check -- ${{ matrix.pytest-extra }}
"
- name: Create wheel for manylinux 2014 for s390x
if: ${{ matrix.architecture == 's390x' }}
uses: RalfG/[email protected]_s390x
# this action generates 2 wheels in dist/. linux, manylinux2014
with:
python-versions: ${{ matrix.python-version }}
build-requirements: "setuptools>=47 wheel>=0.34"
pip-wheel-args: "-w ./dist -v --no-deps"
- name: Check created wheel for s390x
if: ${{ matrix.architecture == 's390x' }}
uses: docker://quay.io/pypa/manylinux2014_s390x
env:
PIP_CACHE_DIR: /github/workspace/.pip/
with:
args: |
bash -c "
export PATH=/opt/python/${{ matrix.python-version }}/bin:$PATH &&
pip install tox 'pip>=20' &&
tox -e wheel_check -- ${{ matrix.pytest-extra }}
"
- name: Upload wheels to release
# upload the generated wheels to the github release
uses: AButler/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: 'dist/*manylinux*'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: "x64"
- name: Publish wheel
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing dist/*manylinux*