Skip to content

Commit fe5681f

Browse files
authored
Python wheels on CI (#36)
* Python wheels on CI * run ci * only run on tags
1 parent 6af000e commit fe5681f

File tree

1 file changed

+211
-0
lines changed

1 file changed

+211
-0
lines changed

.github/workflows/python-wheels.yml

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# This file is (mostly) autogenerated by maturin v1.7.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github -m python/Cargo.toml
5+
#
6+
name: Build wheels
7+
8+
on:
9+
push:
10+
tags:
11+
- "py-v*"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
runs-on: ${{ matrix.platform.runner }}
24+
strategy:
25+
matrix:
26+
platform:
27+
- runner: ubuntu-latest
28+
target: x86_64
29+
manylinux: auto
30+
- runner: ubuntu-latest
31+
target: x86
32+
manylinux: auto
33+
- runner: ubuntu-latest
34+
target: aarch64
35+
manylinux: "2_24"
36+
- runner: ubuntu-latest
37+
target: armv7
38+
manylinux: auto
39+
- runner: ubuntu-latest
40+
target: s390x
41+
manylinux: auto
42+
- runner: ubuntu-latest
43+
target: ppc64le
44+
manylinux: auto
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v5
50+
with:
51+
enable-cache: true
52+
version: "0.5.x"
53+
54+
- name: Install Python versions
55+
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10
56+
57+
- name: Build wheels
58+
uses: PyO3/maturin-action@v1
59+
with:
60+
target: ${{ matrix.platform.target }}
61+
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 --manifest-path python/Cargo.toml
62+
sccache: "true"
63+
manylinux: ${{ matrix.platform.manylinux }}
64+
- name: Upload wheels
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: wheels-linux-${{ matrix.platform.target }}
68+
path: dist
69+
70+
musllinux:
71+
runs-on: ${{ matrix.platform.runner }}
72+
strategy:
73+
matrix:
74+
platform:
75+
- runner: ubuntu-latest
76+
target: x86_64
77+
- runner: ubuntu-latest
78+
target: x86
79+
- runner: ubuntu-latest
80+
target: aarch64
81+
- runner: ubuntu-latest
82+
target: armv7
83+
steps:
84+
- uses: actions/checkout@v4
85+
86+
- name: Install uv
87+
uses: astral-sh/setup-uv@v5
88+
with:
89+
enable-cache: true
90+
version: "0.5.x"
91+
92+
- name: Install Python versions
93+
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10
94+
95+
- name: Build wheels
96+
uses: PyO3/maturin-action@v1
97+
with:
98+
target: ${{ matrix.platform.target }}
99+
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 --manifest-path python/Cargo.toml
100+
sccache: "true"
101+
manylinux: musllinux_1_2
102+
- name: Upload wheels
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: wheels-musllinux-${{ matrix.platform.target }}
106+
path: dist
107+
108+
windows:
109+
runs-on: ${{ matrix.platform.runner }}
110+
strategy:
111+
matrix:
112+
platform:
113+
- runner: windows-latest
114+
target: x64
115+
steps:
116+
- uses: actions/checkout@v4
117+
# There seem to be linking errors on Windows with the uv-provided Python
118+
# executables, so we use the Python versions provided by github actions
119+
# for now.
120+
# Seems to be this question: https://stackoverflow.com/questions/78557803/python-with-rust-cannot-open-input-file-python3-lib
121+
- uses: actions/setup-python@v5
122+
with:
123+
python-version: 3.13
124+
architecture: ${{ matrix.platform.target }}
125+
- name: Build wheels
126+
uses: PyO3/maturin-action@v1
127+
with:
128+
target: ${{ matrix.platform.target }}
129+
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 --manifest-path python/Cargo.toml
130+
sccache: "true"
131+
- name: Upload wheels
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: wheels-windows-${{ matrix.platform.target }}
135+
path: dist
136+
137+
macos:
138+
runs-on: ${{ matrix.platform.runner }}
139+
strategy:
140+
matrix:
141+
platform:
142+
- runner: macos-13
143+
target: x86_64
144+
- runner: macos-14
145+
target: aarch64
146+
steps:
147+
- uses: actions/checkout@v4
148+
149+
- name: Install uv
150+
uses: astral-sh/setup-uv@v5
151+
with:
152+
enable-cache: true
153+
version: "0.5.x"
154+
155+
- name: Install Python versions
156+
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10
157+
158+
- name: Build wheels
159+
uses: PyO3/maturin-action@v1
160+
with:
161+
target: ${{ matrix.platform.target }}
162+
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 --manifest-path python/Cargo.toml
163+
sccache: "true"
164+
- name: Upload wheels
165+
uses: actions/upload-artifact@v4
166+
with:
167+
name: wheels-macos-${{ matrix.platform.target }}
168+
path: dist
169+
170+
# sdist:
171+
# runs-on: ubuntu-latest
172+
# strategy:
173+
# matrix:
174+
# steps:
175+
# - uses: actions/checkout@v4
176+
# - name: Build sdist
177+
# uses: PyO3/maturin-action@v1
178+
# with:
179+
# command: sdist
180+
# args: --out dist --manifest-path python/Cargo.toml
181+
# - name: Upload sdist
182+
# uses: actions/upload-artifact@v4
183+
# with:
184+
# name: wheels-sdist
185+
# path: dist
186+
187+
release:
188+
runs-on: ubuntu-latest
189+
name: Release
190+
# environment:
191+
# name: release
192+
# url: https://pypi.org/p/async-tiff
193+
# permissions:
194+
# # IMPORTANT: this permission is mandatory for trusted publishing
195+
# id-token: write
196+
if: startsWith(github.ref, 'refs/tags/')
197+
needs: [linux, musllinux, windows, macos]
198+
steps:
199+
- uses: actions/download-artifact@v4
200+
with:
201+
pattern: wheels-*
202+
merge-multiple: true
203+
path: dist
204+
- uses: actions/setup-python@v5
205+
with:
206+
python-version: 3.9
207+
208+
- uses: pypa/gh-action-pypi-publish@release/v1
209+
with:
210+
user: __token__
211+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)