Skip to content

Commit 2778886

Browse files
committed
ci: add wheels
It's probably going to break
1 parent 6571378 commit 2778886

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed

.github/workflows/pypi.yaml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
linux:
14+
runs-on: ${{ matrix.platform.runner }}
15+
strategy:
16+
matrix:
17+
platform:
18+
- runner: ubuntu-latest
19+
target: x86_64
20+
- runner: ubuntu-latest
21+
target: x86
22+
- runner: ubuntu-latest
23+
target: aarch64
24+
- runner: ubuntu-latest
25+
target: armv7
26+
- runner: ubuntu-latest
27+
target: s390x
28+
- runner: ubuntu-latest
29+
target: ppc64le
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v5
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 --find-interpreter
40+
sccache: "true"
41+
manylinux: auto
42+
- name: Upload wheels
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: wheels-linux-${{ matrix.platform.target }}
46+
path: dist
47+
48+
musllinux:
49+
runs-on: ${{ matrix.platform.runner }}
50+
strategy:
51+
matrix:
52+
platform:
53+
- runner: ubuntu-latest
54+
target: x86_64
55+
- runner: ubuntu-latest
56+
target: x86
57+
- runner: ubuntu-latest
58+
target: aarch64
59+
- runner: ubuntu-latest
60+
target: armv7
61+
steps:
62+
- uses: actions/checkout@v4
63+
- uses: actions/setup-python@v5
64+
with:
65+
python-version: 3.x
66+
- name: Build wheels
67+
uses: PyO3/maturin-action@v1
68+
with:
69+
target: ${{ matrix.platform.target }}
70+
args: --release --out dist --find-interpreter
71+
sccache: "true"
72+
manylinux: musllinux_1_2
73+
- name: Upload wheels
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: wheels-musllinux-${{ matrix.platform.target }}
77+
path: dist
78+
79+
# https://github.com/gadomski/stacrs/issues/1
80+
# windows:
81+
# runs-on: ${{ matrix.platform.runner }}
82+
# strategy:
83+
# matrix:
84+
# platform:
85+
# - runner: windows-latest
86+
# target: x64
87+
# - runner: windows-latest
88+
# target: x86
89+
# steps:
90+
# - uses: actions/checkout@v4
91+
# - uses: actions/setup-python@v5
92+
# with:
93+
# python-version: 3.x
94+
# architecture: ${{ matrix.platform.target }}
95+
# - name: Build wheels
96+
# uses: PyO3/maturin-action@v1
97+
# with:
98+
# target: ${{ matrix.platform.target }}
99+
# args: --release --out dist --find-interpreter
100+
# sccache: "true"
101+
# - name: Upload wheels
102+
# uses: actions/upload-artifact@v4
103+
# with:
104+
# name: wheels-windows-${{ matrix.platform.target }}
105+
# path: dist
106+
107+
macos:
108+
runs-on: ${{ matrix.platform.runner }}
109+
strategy:
110+
matrix:
111+
platform:
112+
- runner: macos-12
113+
target: x86_64
114+
- runner: macos-14
115+
target: aarch64
116+
steps:
117+
- uses: actions/checkout@v4
118+
- uses: actions/setup-python@v5
119+
with:
120+
python-version: 3.x
121+
- name: Build wheels
122+
uses: PyO3/maturin-action@v1
123+
with:
124+
target: ${{ matrix.platform.target }}
125+
args: --release --out dist --find-interpreter
126+
sccache: "true"
127+
- name: Upload wheels
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: wheels-macos-${{ matrix.platform.target }}
131+
path: dist
132+
133+
sdist:
134+
runs-on: ubuntu-latest
135+
steps:
136+
- uses: actions/checkout@v4
137+
- name: Build sdist
138+
uses: PyO3/maturin-action@v1
139+
with:
140+
command: sdist
141+
args: --out dist
142+
- name: Upload sdist
143+
uses: actions/upload-artifact@v4
144+
with:
145+
name: wheels-sdist
146+
path: dist
147+
148+
release:
149+
name: Release
150+
runs-on: ubuntu-latest
151+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
152+
needs: [linux, musllinux, macos, sdist]
153+
permissions:
154+
id-token: write
155+
contents: write
156+
attestations: write
157+
steps:
158+
- uses: actions/download-artifact@v4
159+
- name: Generate artifact attestation
160+
uses: actions/attest-build-provenance@v1
161+
with:
162+
subject-path: "wheels-*/*"
163+
- name: Publish to PyPI
164+
if: startsWith(github.ref, 'refs/tags/')
165+
uses: PyO3/maturin-action@v1
166+
with:
167+
command: upload
168+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)