-
Notifications
You must be signed in to change notification settings - Fork 0
546 lines (489 loc) · 20.4 KB
/
Copy pathpython.yml
File metadata and controls
546 lines (489 loc) · 20.4 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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
name: Python wheels
on:
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Do not re-enable a machine-global sccache wrapper in any wheel build.
RUSTC_WRAPPER: ""
# All actions are pinned to commit SHAs, including PyO3/maturin-action.
# The python binding enables PyO3's stable abi3-py39 feature; the maturin
# binary itself is pinned to 1.11.5 in every build job below.
jobs:
macos-arm64:
name: wheel / macOS arm64
runs-on: macos-15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.13"
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
working-directory: python
command: build
target: aarch64-apple-darwin
rust-toolchain: stable
maturin-version: "v1.11.5"
args: --release --locked --compatibility pypi --out target/wheels
- name: Move raw wheel
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
wheels=(python/target/wheels/*.whl)
test "${#wheels[@]}" -eq 1
raw_dir=python/target/wheels-raw
final_dir=python/target/wheels-final
rm -rf "$raw_dir" "$final_dir"
mkdir -p "$raw_dir" "$final_dir"
mv "${wheels[0]}" "$raw_dir/"
- name: Create audit environment
shell: bash
run: |
set -euo pipefail
audit_venv="$RUNNER_TEMP/libdeno-audit-venv"
python -m venv "$audit_venv"
"$audit_venv/bin/python" -m pip install --upgrade pip 'delocate==0.13.0'
- name: Audit raw wheel with delocate
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
raw_wheels=(python/target/wheels-raw/*.whl)
test "${#raw_wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/delocate-listdeps" "${raw_wheels[0]}"
- name: Repair wheel with delocate
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
raw_wheels=(python/target/wheels-raw/*.whl)
test "${#raw_wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/delocate-wheel" \
--require-archs arm64 \
--wheel-dir python/target/wheels-final \
"${raw_wheels[0]}"
- name: Audit final wheel with delocate
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
final_wheels=(python/target/wheels-final/*.whl)
test "${#final_wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/delocate-listdeps" "${final_wheels[0]}"
- name: Smoke-test wheel in a fresh virtualenv
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
final_wheels=(python/target/wheels-final/*.whl)
test "${#final_wheels[@]}" -eq 1
smoke_venv="$RUNNER_TEMP/libdeno-smoke-venv"
python -m venv "$smoke_venv"
"$smoke_venv/bin/python" -m pip install --no-index "${final_wheels[0]}"
"$smoke_venv/bin/python" -m unittest discover -s python/tests -p 'test_*.py'
- name: Upload wheel
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: libdeno-wheel-macos-arm64
path: python/target/wheels-final/*.whl
if-no-files-found: error
macos-x86_64:
name: wheel / macOS x86_64
runs-on: macos-15-intel
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
# This leg is the real abi3-py39 smoke test for macOS.
python-version: "3.9"
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
working-directory: python
command: build
target: x86_64-apple-darwin
rust-toolchain: stable
maturin-version: "v1.11.5"
args: --release --locked --compatibility pypi --out target/wheels
- name: Move raw wheel
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
wheels=(python/target/wheels/*.whl)
test "${#wheels[@]}" -eq 1
raw_dir=python/target/wheels-raw
final_dir=python/target/wheels-final
rm -rf "$raw_dir" "$final_dir"
mkdir -p "$raw_dir" "$final_dir"
mv "${wheels[0]}" "$raw_dir/"
- name: Create audit environment
shell: bash
run: |
set -euo pipefail
audit_venv="$RUNNER_TEMP/libdeno-audit-venv"
python -m venv "$audit_venv"
"$audit_venv/bin/python" -m pip install --upgrade pip 'delocate==0.13.0'
- name: Audit raw wheel with delocate
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
raw_wheels=(python/target/wheels-raw/*.whl)
test "${#raw_wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/delocate-listdeps" "${raw_wheels[0]}"
- name: Repair wheel with delocate
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
raw_wheels=(python/target/wheels-raw/*.whl)
test "${#raw_wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/delocate-wheel" \
--require-archs x86_64 \
--wheel-dir python/target/wheels-final \
"${raw_wheels[0]}"
- name: Audit final wheel with delocate
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
final_wheels=(python/target/wheels-final/*.whl)
test "${#final_wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/delocate-listdeps" "${final_wheels[0]}"
- name: Verify abi3-py39 wheel tag
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
final_wheels=(python/target/wheels-final/*.whl)
test "${#final_wheels[@]}" -eq 1
case "$(basename "${final_wheels[0]}")" in
*-cp39-abi3-*.whl) ;;
*) echo "expected a cp39-abi3 wheel, got $(basename "${final_wheels[0]}")"; exit 1 ;;
esac
- name: Smoke-test wheel in a fresh virtualenv
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
final_wheels=(python/target/wheels-final/*.whl)
test "${#final_wheels[@]}" -eq 1
smoke_venv="$RUNNER_TEMP/libdeno-smoke-venv"
python -m venv "$smoke_venv"
"$smoke_venv/bin/python" -m pip install --no-index "${final_wheels[0]}"
"$smoke_venv/bin/python" -m unittest discover -s python/tests -p 'test_*.py'
- name: Upload wheel
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: libdeno-wheel-macos-x86_64
path: python/target/wheels-final/*.whl
if-no-files-found: error
windows-x86_64:
name: wheel / Windows x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
# This leg is the real abi3-py39 smoke test for Windows.
python-version: "3.9"
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
working-directory: python
command: build
target: x86_64-pc-windows-msvc
rust-toolchain: stable
maturin-version: "v1.11.5"
args: --release --locked --compatibility pypi --out target/wheels
- name: Move raw wheel
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Set-Location $env:GITHUB_WORKSPACE
$wheelDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels'
$rawDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-raw'
$finalDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-final'
if (Test-Path -LiteralPath $rawDir) { Remove-Item -LiteralPath $rawDir -Recurse -Force }
if (Test-Path -LiteralPath $finalDir) { Remove-Item -LiteralPath $finalDir -Recurse -Force }
New-Item -ItemType Directory -Path $rawDir, $finalDir -Force | Out-Null
$wheels = @(Get-ChildItem -LiteralPath $wheelDir -Filter '*.whl' -File)
if ($wheels.Count -ne 1) { throw "expected one raw wheel, found $($wheels.Count)" }
Move-Item -LiteralPath $wheels[0].FullName -Destination $rawDir
- name: Create audit environment
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$auditVenv = Join-Path $env:RUNNER_TEMP 'libdeno-audit-venv'
python -m venv $auditVenv
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$auditPython = Join-Path $auditVenv 'Scripts/python.exe'
& $auditPython -m pip install --upgrade pip 'delvewheel==1.13.0'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Audit raw wheel with delvewheel
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Set-Location $env:GITHUB_WORKSPACE
$rawDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-raw'
$rawWheels = @(Get-ChildItem -LiteralPath $rawDir -Filter '*.whl' -File)
if ($rawWheels.Count -ne 1) { throw "expected one raw wheel, found $($rawWheels.Count)" }
$auditPython = Join-Path $env:RUNNER_TEMP 'libdeno-audit-venv/Scripts/python.exe'
& $auditPython -m delvewheel show $rawWheels[0].FullName
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Repair wheel with delvewheel
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Set-Location $env:GITHUB_WORKSPACE
$rawDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-raw'
$finalDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-final'
$rawWheels = @(Get-ChildItem -LiteralPath $rawDir -Filter '*.whl' -File)
if ($rawWheels.Count -ne 1) { throw "expected one raw wheel, found $($rawWheels.Count)" }
$auditPython = Join-Path $env:RUNNER_TEMP 'libdeno-audit-venv/Scripts/python.exe'
& $auditPython -m delvewheel repair --wheel-dir $finalDir $rawWheels[0].FullName
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Audit final wheel with delvewheel
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Set-Location $env:GITHUB_WORKSPACE
$finalDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-final'
$finalWheels = @(Get-ChildItem -LiteralPath $finalDir -Filter '*.whl' -File)
if ($finalWheels.Count -ne 1) { throw "expected one final wheel, found $($finalWheels.Count)" }
$auditPython = Join-Path $env:RUNNER_TEMP 'libdeno-audit-venv/Scripts/python.exe'
& $auditPython -m delvewheel show $finalWheels[0].FullName
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Verify abi3-py39 wheel tag
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$finalDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-final'
$finalWheels = @(Get-ChildItem -LiteralPath $finalDir -Filter '*.whl' -File)
if ($finalWheels.Count -ne 1) { throw "expected one final wheel, found $($finalWheels.Count)" }
if ($finalWheels[0].Name -notmatch '-cp39-abi3-') {
throw "expected a cp39-abi3 wheel, got $($finalWheels[0].Name)"
}
- name: Smoke-test wheel in a fresh virtualenv
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Set-Location $env:GITHUB_WORKSPACE
$finalDir = Join-Path $env:GITHUB_WORKSPACE 'python/target/wheels-final'
$finalWheels = @(Get-ChildItem -LiteralPath $finalDir -Filter '*.whl' -File)
if ($finalWheels.Count -ne 1) { throw "expected one final wheel, found $($finalWheels.Count)" }
$smokeVenv = Join-Path $env:RUNNER_TEMP 'libdeno-smoke-venv'
python -m venv $smokeVenv
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$smokePython = Join-Path $smokeVenv 'Scripts/python.exe'
& $smokePython -m pip install --no-index $finalWheels[0].FullName
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
& $smokePython -m unittest discover -s python/tests -p 'test_*.py'
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Upload wheel
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: libdeno-wheel-windows-x86_64
path: python/target/wheels-final/*.whl
if-no-files-found: error
linux-x86_64:
name: wheel / Linux x86_64 manylinux_2_28
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
# The manylinux build uses cp39; the host audit/smoke environment uses Python 3.10 because auditwheel 6.8.1 requires Python >=3.10.
python-version: "3.10"
# maturin-action runs this build in its x86_64 manylinux_2_28 container.
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
working-directory: python
command: build
target: x86_64-unknown-linux-gnu
rust-toolchain: stable
maturin-version: "v1.11.5"
manylinux: "2_28"
before-script-linux: |
dnf install -y clang-devel
args: >-
--release --locked --compatibility pypi
-i python3.9
--out target/wheels
- name: Create audit environment
shell: bash
run: |
set -euo pipefail
audit_venv="$RUNNER_TEMP/libdeno-audit-venv"
python -m venv "$audit_venv"
"$audit_venv/bin/python" -m pip install --upgrade pip 'auditwheel==6.8.1'
- name: Audit wheel with auditwheel
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
wheels=(python/target/wheels/*.whl)
test "${#wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/auditwheel" show "${wheels[0]}"
- name: Smoke-test wheel in a fresh virtualenv
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
wheels=(python/target/wheels/*.whl)
test "${#wheels[@]}" -eq 1
smoke_venv="$RUNNER_TEMP/libdeno-smoke-venv"
python -m venv "$smoke_venv"
"$smoke_venv/bin/python" -m pip install --no-index "${wheels[0]}"
"$smoke_venv/bin/python" -m unittest discover -s python/tests -p 'test_*.py'
- name: Upload wheel
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: libdeno-wheel-linux-x86_64
path: python/target/wheels/*.whl
if-no-files-found: error
linux-aarch64:
name: wheel / Linux aarch64 manylinux_2_28
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.13"
# On the native ARM64 runner this selects manylinux_2_28_aarch64.
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
working-directory: python
command: build
target: aarch64-unknown-linux-gnu
rust-toolchain: stable
maturin-version: "v1.11.5"
manylinux: "2_28"
before-script-linux: |
dnf install -y clang-devel
args: >-
--release --locked --compatibility pypi
-i python3.9
--out target/wheels
- name: Create audit environment
shell: bash
run: |
set -euo pipefail
audit_venv="$RUNNER_TEMP/libdeno-audit-venv"
python -m venv "$audit_venv"
"$audit_venv/bin/python" -m pip install --upgrade pip 'auditwheel==6.8.1'
- name: Audit wheel with auditwheel
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
wheels=(python/target/wheels/*.whl)
test "${#wheels[@]}" -eq 1
"$RUNNER_TEMP/libdeno-audit-venv/bin/auditwheel" show "${wheels[0]}"
- name: Smoke-test wheel in a fresh virtualenv
shell: bash
run: |
set -euo pipefail
cd "$GITHUB_WORKSPACE"
shopt -s nullglob
wheels=(python/target/wheels/*.whl)
test "${#wheels[@]}" -eq 1
smoke_venv="$RUNNER_TEMP/libdeno-smoke-venv"
python -m venv "$smoke_venv"
"$smoke_venv/bin/python" -m pip install --no-index "${wheels[0]}"
"$smoke_venv/bin/python" -m unittest discover -s python/tests -p 'test_*.py'
- name: Upload wheel
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: libdeno-wheel-linux-aarch64
path: python/target/wheels/*.whl
if-no-files-found: error
wheel-metadata:
name: validate wheel metadata
needs: [macos-arm64, macos-x86_64, windows-x86_64, linux-x86_64, linux-aarch64]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.13"
- name: Download all wheel artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: libdeno-wheel-*
path: artifacts
merge-multiple: true
- name: Check wheel metadata with twine
shell: bash
run: |
set -euo pipefail
twine_venv="$RUNNER_TEMP/libdeno-twine-venv"
python -m venv "$twine_venv"
"$twine_venv/bin/python" -m pip install --upgrade pip 'twine==7.0.0'
"$twine_venv/bin/twine" check artifacts/*.whl
- name: Check all wheel tags are abi3-py39
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
wheels=(artifacts/*.whl)
test "${#wheels[@]}" -eq 5
for wheel in "${wheels[@]}"; do
case "$(basename "$wheel")" in
*-cp39-abi3-*.whl) ;;
*) echo "expected a cp39-abi3 wheel, got $(basename "$wheel")"; exit 1 ;;
esac
done
- name: Check typing metadata is packaged
shell: bash
run: |
set -euo pipefail
python - <<'PY'
from pathlib import Path
from zipfile import ZipFile
wheels = sorted(Path("artifacts").glob("*.whl"))
if len(wheels) != 5:
raise SystemExit(f"expected exactly five wheel artifacts, found {len(wheels)}")
required = {"libdeno/__init__.pyi", "libdeno/py.typed"}
for wheel in wheels:
with ZipFile(wheel) as archive:
missing = required - set(archive.namelist())
if missing:
raise SystemExit(f"{wheel.name}: missing wheel members {sorted(missing)}")
print("validated typing metadata in all wheels")
PY