-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (98 loc) · 3.86 KB
/
Copy pathpython-wheels.yml
File metadata and controls
101 lines (98 loc) · 3.86 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
name: Python wheels
# The wheels of the Python package: abi3, one per platform, for CPython 3.10 and later, and one per
# platform for free-threaded CPython 3.14 (3.14t), which can't load abi3. Built and tested on pull
# requests that touch the package, by hand, and by the release workflow, which publishes them to
# PyPI.
on:
pull_request:
paths:
- "python/**"
- "!python/**.md"
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/python-wheels.yml"
workflow_dispatch:
workflow_call:
jobs:
wheels:
name: Wheel (${{ matrix.platform.id }})
strategy:
fail-fast: false
matrix:
platform:
- { id: linux-x86_64, runner: ubuntu-latest, target: x86_64, manylinux: auto, test: true }
- { id: linux-aarch64, runner: ubuntu-24.04-arm, target: aarch64, manylinux: auto, test: true }
- { id: musllinux-x86_64, runner: ubuntu-latest, target: x86_64, manylinux: musllinux_1_2, test: false }
- { id: musllinux-aarch64, runner: ubuntu-24.04-arm, target: aarch64, manylinux: musllinux_1_2, test: false }
# cross-compiled on Apple silicon
- { id: macos-x86_64, runner: macos-latest, target: x86_64, test: false }
- { id: macos-arm64, runner: macos-latest, target: aarch64, test: true }
- { id: windows-x64, runner: windows-latest, target: x64, test: true }
runs-on: ${{ matrix.platform.runner }}
defaults:
run:
shell: bash
steps:
# the Python package has genoxide's version, and the dependency versions of Cargo.lock: both
# are the workspace's, in the root Cargo.toml and Cargo.lock
- uses: actions/checkout@v7
- uses: PyO3/maturin-action@v1.51.0
with:
target: ${{ matrix.platform.target }}
manylinux: ${{ matrix.platform.manylinux }}
working-directory: python
# no --release: it would take the place of the `wheel` profile of pyproject.toml
args: --locked --out dist
# free-threaded CPython: PyO3 makes a version-specific wheel for it despite the abi3 feature,
# and supports it from 3.14. On Linux, the manylinux and musllinux containers have it.
- uses: actions/setup-python@v7
if: runner.os != 'Linux'
with:
python-version: "3.14t"
- uses: PyO3/maturin-action@v1.51.0
with:
target: ${{ matrix.platform.target }}
manylinux: ${{ matrix.platform.manylinux }}
working-directory: python
args: --locked --out dist -i python3.14t
- uses: actions/setup-python@v7
if: matrix.platform.test
with:
python-version: "3.10"
# the lowest supported Python: an abi3 wheel works on every version from it
- name: Test
if: matrix.platform.test
run: |
python -m pip install pytest python/dist/*-abi3-*.whl
cd python/tests && python -m pytest -q
- uses: actions/setup-python@v7
id: free-threaded
if: matrix.platform.test
with:
python-version: "3.14t"
- name: Test free-threaded
if: matrix.platform.test
run: |
python="${{ steps.free-threaded.outputs.python-path }}"
"$python" -m pip install pytest python/dist/*-cp314t-*.whl
cd python/tests && "$python" -m pytest -q
- uses: actions/upload-artifact@v7.0.1
with:
name: wheels-${{ matrix.platform.id }}
path: python/dist
sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: PyO3/maturin-action@v1.51.0
with:
command: sdist
working-directory: python
# the sdist includes Cargo.lock (sdist has no --locked)
args: --out dist
- uses: actions/upload-artifact@v7.0.1
with:
name: wheels-sdist
path: python/dist