-
Notifications
You must be signed in to change notification settings - Fork 1
368 lines (324 loc) · 12.2 KB
/
Copy pathpython-wheels.yml
File metadata and controls
368 lines (324 loc) · 12.2 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
name: Build wheels
# Each platform builds two wheels from the same crate:
# 1. an abi3 wheel (`--features abi3-py311`, built with a GIL-enabled 3.11)
# that works on every GIL-enabled CPython 3.11+, and
# 2. a version-specific free-threaded `cp314-cp314t` wheel (`-i 3.14t`, no
# abi3) — free-threaded CPython 3.14 has no stable ABI, so it needs its own
# wheel.
#
# A third, abi3t wheel (free-threaded stable ABI, PEP 803) for Python 3.15+ is
# scaffolded but commented out below: it needs a 3.15 interpreter, and 3.15 is
# still in beta. Uncomment the `abi3t` steps (and the `3.15t` interpreter
# installs) once 3.15 is released.
#
# On pull requests, only the `emscripten` job runs (every other job is gated
# with `if: github.event_name != 'pull_request'`). This catches regressions in
# the emscripten/Pyodide build — the most fragile target — without rebuilding
# every native wheel on every PR.
on:
push:
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linux:
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install Python versions
run: uv python install 3.11 3.14t
# When 3.15 is released, add `3.15t` above for the abi3t build.
- name: Build abi3 wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --features abi3-py311 -i 3.11
sccache: "true"
manylinux: "2_28"
- name: Build free-threaded (cp314t) wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.14t
sccache: "true"
manylinux: "2_28"
# - name: Build abi3t wheel (Python 3.15+)
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --features abi3t-py315 -i 3.15t
# sccache: "true"
# manylinux: "2_28"
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
musllinux:
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install Python versions
run: uv python install 3.11 3.14t
# When 3.15 is released, add `3.15t` above for the abi3t build.
- name: Build abi3 wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --features abi3-py311 -i 3.11
sccache: "true"
manylinux: musllinux_1_2
- name: Build free-threaded (cp314t) wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.14t
sccache: "true"
manylinux: musllinux_1_2
# - name: Build abi3t wheel (Python 3.15+)
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --features abi3t-py315 -i 3.15t
# sccache: "true"
# manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist
windows:
if: github.event_name != 'pull_request'
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
# uv-provided Python has linking issues on Windows with maturin, so use
# the GitHub-actions-provided interpreter. `generate-import-lib` lets
# maturin build the version-specific wheels (e.g. 3.14t) without each of
# those interpreters installed.
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Build abi3 wheel
uses: PyO3/maturin-action@v1
with:
target: x64
args: --release --out dist --features abi3-py311 --features generate-import-lib -i 3.11
sccache: "true"
- name: Build free-threaded (cp314t) wheel
uses: PyO3/maturin-action@v1
with:
target: x64
args: --release --out dist --features generate-import-lib -i 3.14t
sccache: "true"
# - name: Build abi3t wheel (Python 3.15+)
# uses: PyO3/maturin-action@v1
# with:
# target: x64
# args: --release --out dist --features abi3t-py315 --features generate-import-lib -i 3.15t
# sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-windows-x64
path: dist
macos:
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-15-intel
target: x86_64
- runner: macos-15
target: aarch64
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install Python versions
run: uv python install 3.11 3.14t
# When 3.15 is released, add `3.15t` above for the abi3t build.
- name: Build abi3 wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --features abi3-py311 -i 3.11
sccache: "true"
- name: Build free-threaded (cp314t) wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.14t
sccache: "true"
# - name: Build abi3t wheel (Python 3.15+)
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: --release --out dist --features abi3t-py315 -i 3.15t
# sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
# PEP 783 (pyemscripten) wheel for Pyodide, built for Python 3.14 only.
#
# The Emscripten version, rustflags, and platform tag are all defined by
# pyodide-build for the target Python version. Two things differ from the
# native jobs:
#
# 1. The wheel is built `--no-default-features` (sync-only). The default
# `async` feature pulls in object_store / tokio / icechunk, which don't
# build for emscripten.
# 2. We override the Rust toolchain via `matrix.rust-toolchain-override`
# (falling back to the one Pyodide pins). zarrista's MSRV (1.94) is newer
# than the toolchain Pyodide pins for 3.14 (1.93), so we override to the
# MSRV. 3.14's ABI needs no nightly-only rustflags, so stable works. Drop
# the override once Pyodide's pinned toolchain reaches the MSRV.
#
# Unlike the native jobs, this also runs on every pull request to catch
# emscripten build regressions (e.g. a dependency update that no longer
# compiles or links for this target) before release time.
emscripten:
runs-on: ubuntu-latest
# Debug build on pull requests (faster, only checks it compiles and links);
# release build on tag pushes and manual dispatch.
env:
RELEASE_FLAG: ${{ github.event_name != 'pull_request' && '--release' || '' }}
strategy:
fail-fast: false
matrix:
python-version: ["3.14"]
include:
- python-version: "3.14"
rust-toolchain-override: "1.94"
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install pyodide-build
run: uv sync --only-group pyodide
- name: Get pyodide config
id: pyodide-config
run: |
{
echo "rust-toolchain=$(uv run --no-sync pyodide config get rust_toolchain)"
echo "pyodide-abi-version=$(uv run --no-sync pyodide config get pyodide_abi_version)"
echo "rustflags=$(uv run --no-sync pyodide config get rustflags)"
echo "cflags=$(uv run --no-sync pyodide config get cflags)"
} >> "$GITHUB_OUTPUT"
# Install Emscripten via the Pyodide cross-build environment rather than a
# stock emsdk: this pins the Emscripten version matching the target
# Pyodide ABI, and applies Pyodide's patches to Emscripten, several of
# which affect dynamic linking of Rust side modules.
# https://github.com/pyodide/pyodide/tree/main/emsdk/patches
- name: Install emsdk (Pyodide xbuildenv)
env:
PYODIDE_XBUILDENV_PATH: ${{ github.workspace }}/.pyodide-xbuildenv
run: |
uv run --no-sync pyodide xbuildenv install
uv run --no-sync pyodide xbuildenv install-emscripten
# shellcheck disable=SC1090
source "$PYODIDE_XBUILDENV_PATH/$(uv run --no-sync pyodide xbuildenv version)/emsdk/emsdk_env.sh"
{
echo "EMSDK=$EMSDK"
echo "EMSDK_NODE=$EMSDK_NODE"
} >> "$GITHUB_ENV"
{
echo "$EMSDK"
echo "$EMSDK/upstream/emscripten"
dirname "$EMSDK_NODE"
} >> "$GITHUB_PATH"
- name: Build emscripten wheel
uses: PyO3/maturin-action@v1
env:
CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUSTFLAGS: ${{ steps.pyodide-config.outputs.rustflags }}
CFLAGS_wasm32_unknown_emscripten: ${{ steps.pyodide-config.outputs.cflags }}
MATURIN_PYEMSCRIPTEN_PLATFORM_VERSION: ${{ steps.pyodide-config.outputs.pyodide-abi-version }}
with:
target: wasm32-unknown-emscripten
rust-toolchain: ${{ matrix.rust-toolchain-override || steps.pyodide-config.outputs.rust-toolchain }}
args: --out dist -i ${{ matrix.python-version }} --no-default-features ${{ env.RELEASE_FLAG }}
sccache: "true"
- name: Verify pyemscripten platform tag
# PyPI rejects the legacy `emscripten_x_y_z` tag; fail before upload if
# maturin didn't emit the PEP 783 `pyemscripten_*` tag (this needs
# `MATURIN_PYEMSCRIPTEN_PLATFORM_VERSION` and a recent maturin).
run: |
ls -lh dist/
ls dist/*-pyemscripten_*_wasm32.whl >/dev/null
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-emscripten-py${{ matrix.python-version }}
path: dist
sdist:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
environment:
name: pypi-release
url: https://pypi.org/p/zarrista
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
if: startsWith(github.ref, 'refs/tags/')
needs: [linux, musllinux, windows, macos, emscripten, sdist]
steps:
- uses: actions/download-artifact@v8
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1