Skip to content

Commit d1bd045

Browse files
committed
Split off wheels release from the rest
1 parent f51f7c2 commit d1bd045

2 files changed

Lines changed: 445 additions & 432 deletions

File tree

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Release Python wheels
2+
3+
# for available runner images see: https://github.com/actions/runner-images
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v[0-9]+*'
9+
workflow_dispatch:
10+
11+
jobs:
12+
wheels-linux:
13+
runs-on: ${{ matrix.platform.runner }}
14+
strategy:
15+
matrix:
16+
platform:
17+
- runner: ubuntu-22.04
18+
target: x86_64
19+
manylinux: 2_17
20+
#- runner: ubuntu-22.04
21+
# target: x86
22+
#- runner: ubuntu-22.04
23+
# target: aarch64
24+
#- runner: ubuntu-22.04
25+
# target: armv7
26+
#- runner: ubuntu-22.04
27+
# target: s390x
28+
#- runner: ubuntu-22.04
29+
# target: ppc64le
30+
steps:
31+
- uses: actions/checkout@v6
32+
- uses: actions/setup-python@v6
33+
with:
34+
python-version: 3.x
35+
- name: Build wheels
36+
uses: PyO3/maturin-action@v1
37+
with:
38+
target: ${{ matrix.platform.target }}
39+
args: --release --out dist --interpreter python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 pypy3.9 pypy3.10 pypy3.11 --manifest-path pineappl_py/Cargo.toml
40+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
41+
manylinux: ${{ matrix.platform.manylinux }}
42+
- name: Upload wheels
43+
uses: actions/upload-artifact@v5
44+
with:
45+
name: ${{ github.job }}-${{ matrix.platform.target }}
46+
path: dist
47+
48+
wheels-macos:
49+
runs-on: ${{ matrix.platform.runner }}
50+
strategy:
51+
matrix:
52+
platform:
53+
- runner: macos-15-intel
54+
target: x86_64
55+
- runner: macos-latest
56+
target: aarch64
57+
steps:
58+
- uses: actions/checkout@v6
59+
- uses: actions/setup-python@v6
60+
with:
61+
python-version: 3.x
62+
- name: Build wheels
63+
uses: PyO3/maturin-action@v1
64+
with:
65+
target: ${{ matrix.platform.target }}
66+
args: --release --out dist --interpreter python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 pypy3.9 pypy3.10 --manifest-path pineappl_py/Cargo.toml
67+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
68+
- name: Upload wheels
69+
uses: actions/upload-artifact@v5
70+
with:
71+
name: ${{ github.job }}-${{ matrix.platform.target }}
72+
path: dist
73+
74+
wheels-sdist:
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v6
78+
- name: Build sdist
79+
uses: PyO3/maturin-action@v1
80+
with:
81+
command: sdist
82+
args: --out dist --manifest-path pineappl_py/Cargo.toml
83+
- name: Upload sdist
84+
uses: actions/upload-artifact@v5
85+
with:
86+
name: ${{ github.job }}
87+
path: dist
88+
89+
wheels-windows:
90+
runs-on: ${{ matrix.platform.runner }}
91+
strategy:
92+
matrix:
93+
platform:
94+
- runner: windows-2025
95+
target: x64
96+
python_arch: x64
97+
# - runner: windows-latest
98+
# target: x86
99+
# python_arch: x86
100+
# - runner: windows-11-arm
101+
# target: aarch64
102+
# python_arch: arm64
103+
steps:
104+
- uses: actions/checkout@v6
105+
- uses: actions/setup-python@v6
106+
with:
107+
python-version: 3.13
108+
architecture: ${{ matrix.platform.python_arch }}
109+
- name: Build wheels
110+
uses: PyO3/maturin-action@v1
111+
with:
112+
target: ${{ matrix.platform.target }}
113+
# Python 3.7, 3.8, 3.9, PyPy 3.9 and 3.10 don't seem to work on Windows and fail with
114+
# Interpreters ["CPython 3.7", "PyPy 3.9", "PyPy 3.10"] were found in maturin's bundled sysconfig, but compiling for Windows without an interpreter requires PyO3's `generate-import-lib` feature
115+
# even though the interpreters were installed
116+
args: --release --out dist --interpreter python3.10 python3.11 python3.12 python3.13 python3.14 --manifest-path pineappl_py/Cargo.toml
117+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
118+
- name: Upload wheels
119+
uses: actions/upload-artifact@v5
120+
with:
121+
name: ${{ github.job }}-${{ matrix.platform.target }}
122+
path: dist
123+
124+
release-wheels:
125+
name: Publish wheels
126+
runs-on: ubuntu-latest
127+
if: "startsWith(github.ref, 'refs/tags/')"
128+
needs:
129+
- wheels-linux
130+
- wheels-macos
131+
- wheels-sdist
132+
- wheels-windows
133+
permissions:
134+
# Use to sign the release artifacts
135+
id-token: write
136+
# Used to upload release artifacts
137+
contents: write
138+
# Used to generate artifact attestation
139+
attestations: write
140+
steps:
141+
- uses: actions/download-artifact@v6
142+
- name: Generate artifact attestation
143+
uses: actions/attest-build-provenance@v3
144+
with:
145+
subject-path: 'wheels-*/*'
146+
- name: Install uv
147+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
148+
uses: astral-sh/setup-uv@v7
149+
- name: Publish to PyPI
150+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
151+
run: uv publish 'wheels-*/*'
152+
env:
153+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)