-
-
Notifications
You must be signed in to change notification settings - Fork 122
430 lines (403 loc) · 13.5 KB
/
python-release.yml
File metadata and controls
430 lines (403 loc) · 13.5 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
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
name: Python Release
on:
push:
tags:
- python-v*
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PACKAGE_NAME: jsonschema_rs
PYTHON_ABI_VERSION: "3.10"
PYPY_VERSION: "pypy3.11"
jobs:
sdist:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v7
- run: uv python install "3.12"
- run: uv build --sdist --out-dir dist
working-directory: crates/jsonschema-py
- run: uv venv
working-directory: crates/jsonschema-py
- name: Install sdist
run: |
uv pip install dist/${{ env.PACKAGE_NAME }}-*.tar.gz --force-reinstall
working-directory: crates/jsonschema-py
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: sdist
path: crates/jsonschema-py/dist
macos-x86_64:
runs-on: macos-15
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Install Python
run: uv python install ${{ env.PYTHON_ABI_VERSION }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
with:
target: x86_64
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
- name: Install built wheel - x86_64
run: |
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-macos-x86_64
path: dist
macos-universal:
runs-on: macos-15
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Install Python
run: uv python install ${{ env.PYTHON_ABI_VERSION }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Build wheels - universal2
uses: messense/maturin-action@v1
with:
args: --release -m crates/jsonschema-py/Cargo.toml --target universal2-apple-darwin --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
- name: Install built wheel - universal2
run: |
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
uv pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-macos-universal
path: dist
windows:
runs-on: windows-2025
strategy:
matrix:
target: [ x64, x86 ]
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_ABI_VERSION }}
architecture: ${{ matrix.target }}
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
- name: Install built wheel
shell: bash
run: |
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-windows-${{ matrix.target }}
path: dist
linux:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- target: x86_64
manylinux: auto
- target: i686
manylinux: auto
- target: aarch64
manylinux: 2_28
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_ABI_VERSION }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
- name: Install built wheel on native architecture
if: matrix.target == 'x86_64'
run: |
uv venv --python ${{ env.PYTHON_ABI_VERSION }}
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- uses: uraimo/run-on-arch-action@v3
if: matrix.target == 'aarch64'
name: Install built wheel on ARM architecture
with:
base_image: '--platform=linux/aarch64 ubuntu:24.04'
githubToken: ${{ github.token }}
install: |
export TZ=UTC
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends software-properties-common gpg gpg-agent curl
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install -y python${{ env.PYTHON_ABI_VERSION }}-dev python${{ env.PYTHON_ABI_VERSION }}-venv
run: |
python${{ env.PYTHON_ABI_VERSION }} -m venv venv
venv/bin/pip install -U pip wheel
venv/bin/pip install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-linux-${{ matrix.target }}
path: dist
linux-musllinux:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- target: x86_64
arch: amd64
- target: aarch64
arch: aarch64
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_ABI_VERSION }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
- uses: uraimo/run-on-arch-action@v3
name: Install built wheel on Alpine
with:
base_image: '--platform=linux/${{ matrix.arch }} python:${{ env.PYTHON_ABI_VERSION }}-alpine'
githubToken: ${{ github.token }}
shell: /bin/sh
install: apk add --no-cache py3-pip
run: pip install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall --break-system-packages
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-linux-musllinux-${{ matrix.target }}
path: dist
linux-freethreaded:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- target: x86_64
manylinux: auto
- target: aarch64
manylinux: 2_28
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter 3.13t 3.14t
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-linux-freethreaded-${{ matrix.target }}
path: dist
linux-musllinux-freethreaded:
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- target: x86_64
- target: aarch64
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter 3.13t 3.14t
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-linux-musllinux-freethreaded-${{ matrix.target }}
path: dist
macos-freethreaded:
runs-on: macos-15
strategy:
matrix:
include:
- target: x86_64
artifact: wheel-macos-freethreaded-x86_64
- target: aarch64
artifact: wheel-macos-freethreaded-aarch64
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Install Python
run: uv python install 3.13t 3.14t
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin,aarch64-apple-darwin
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter 3.13t 3.14t
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: dist
windows-freethreaded:
runs-on: windows-2025
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Install Python
run: |
uv python install 3.13t
uv python install 3.14t
- name: Find Python paths
id: python-paths
shell: bash
run: |
echo "py313t=$(uv python find 3.13t)" >> "$GITHUB_OUTPUT"
echo "py314t=$(uv python find 3.14t)" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: x64
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ steps.python-paths.outputs.py313t }} ${{ steps.python-paths.outputs.py314t }}
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheel-windows-freethreaded
path: dist
pypy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-15
target: x86_64
artifact: wheel-macos-pypy
manylinux: ''
- os: windows-2025
target: x64
artifact: wheel-windows-pypy
manylinux: ''
- os: ubuntu-24.04
target: x86_64
artifact: wheel-linux-pypy
manylinux: auto
- os: ubuntu-24.04
target: aarch64
artifact: wheel-linux-pypy-aarch64
manylinux: 2_28
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYPY_VERSION }}
- name: Get Python path
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
python_path=$(python -c "import sys; print(sys.executable)")
else
python_path=$(which python || which python3)
fi
echo "PYTHON_PATH=$python_path" >> "$GITHUB_ENV"
"$python_path" --version
- uses: dtolnay/rust-toolchain@stable
- name: Add macOS x86_64 target
if: runner.os == 'macOS'
run: rustup target add x86_64-apple-darwin
- name: Build wheels - PyPy (manylinux)
if: ${{ matrix.manylinux != '' }}
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYPY_VERSION }}
- name: Build wheels - PyPy
if: ${{ matrix.manylinux == '' }}
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_PATH }}
- name: Install built wheel - PyPy
if: ${{ matrix.target != 'aarch64' }}
run: |
uv venv --python ${{ env.PYPY_VERSION }}
uv pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: dist
release:
name: Release
runs-on: ubuntu-24.04
needs:
- sdist
- macos-x86_64
- macos-universal
- windows
- linux
- linux-musllinux
- linux-freethreaded
- linux-musllinux-freethreaded
- macos-freethreaded
- windows-freethreaded
- pypy
if: "startsWith(github.ref, 'refs/tags/')"
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
path: all
- name: Merge files
run: |
mkdir dist
mv all/*/* dist
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Extract Version
run: echo "version=${GITHUB_REF#refs/tags/python-v}" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
make_latest: false
draft: true
name: "[Python] Release ${{ env.version }}"