Skip to content

Commit 00cab49

Browse files
committed
Update maturin CI file
1 parent 44c8767 commit 00cab49

File tree

1 file changed

+94
-26
lines changed

1 file changed

+94
-26
lines changed

.github/workflows/maturin_upload_pypi.yml

Lines changed: 94 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# This file is autogenerated by maturin v1.4.0
1+
# This file is autogenerated by maturin v1.9.4
22
# To update, run
33
#
44
# maturin generate-ci github
55
#
6-
name: Upload to PyPI
6+
# This file has been manually edited too.
7+
name: Build maturin wheels and upload to PyPI
78

89
on:
910
push:
@@ -19,10 +20,22 @@ env:
1920

2021
jobs:
2122
linux:
22-
runs-on: ubuntu-latest
23+
runs-on: ${{ matrix.platform.runner }}
2324
strategy:
2425
matrix:
25-
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
26+
platform:
27+
- runner: ubuntu-22.04
28+
target: x86_64
29+
- runner: ubuntu-22.04
30+
target: x86
31+
- runner: ubuntu-22.04
32+
target: aarch64
33+
- runner: ubuntu-22.04
34+
target: armv7
35+
- runner: ubuntu-22.04
36+
target: s390x
37+
- runner: ubuntu-22.04
38+
target: ppc64le
2639
fail-fast: false
2740
steps:
2841
- name: Checkout repo
@@ -31,28 +44,69 @@ jobs:
3144
- name: Setup Python
3245
uses: actions/setup-python@main
3346
with:
34-
python-version: '3.13'
47+
python-version: 3.x
3548

3649
- name: Build wheels
3750
uses: PyO3/maturin-action@v1
3851
with:
39-
target: ${{ matrix.target }}
52+
target: ${{ matrix.platform.target }}
4053
args: --release --out dist --find-interpreter
41-
sccache: 'true'
54+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
4255
manylinux: auto
4356

4457
- name: Upload wheels
4558
uses: actions/upload-artifact@main
4659
with:
47-
name: wheels
60+
name: wheels-linux-${{ matrix.platform.target }}
61+
path: dist
62+
if-no-files-found: error
63+
64+
musllinux:
65+
runs-on: ${{ matrix.platform.runner }}
66+
strategy:
67+
matrix:
68+
platform:
69+
- runner: ubuntu-22.04
70+
target: x86_64
71+
- runner: ubuntu-22.04
72+
target: x86
73+
- runner: ubuntu-22.04
74+
target: aarch64
75+
- runner: ubuntu-22.04
76+
target: armv7
77+
steps:
78+
- name: Checkout repo
79+
uses: actions/checkout@main
80+
81+
- name: Setup Python
82+
uses: actions/setup-python@main
83+
with:
84+
python-version: 3.x
85+
86+
- name: Build wheels
87+
uses: PyO3/maturin-action@v1
88+
with:
89+
target: ${{ matrix.platform.target }}
90+
args: --release --out dist --find-interpreter
91+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
92+
manylinux: musllinux_1_2
93+
94+
- name: Upload wheels
95+
uses: actions/upload-artifact@main
96+
with:
97+
name: wheels-musllinux-${{ matrix.platform.target }}
4898
path: dist
4999
if-no-files-found: error
50100

51101
windows:
52-
runs-on: windows-latest
102+
runs-on: ${{ matrix.platform.runner }}
53103
strategy:
54104
matrix:
55-
target: [x64, x86]
105+
platform:
106+
- runner: windows-latest
107+
target: x64
108+
- runner: windows-latest
109+
target: x86
56110
fail-fast: false
57111
steps:
58112
- name: Checkout repo
@@ -61,48 +115,52 @@ jobs:
61115
- name: Setup Python
62116
uses: actions/setup-python@main
63117
with:
64-
python-version: '3.13'
65-
architecture: ${{ matrix.target }}
118+
python-version: 3.x
119+
architecture: ${{ matrix.platform.target }}
66120

67121
- name: Build wheels
68122
uses: PyO3/maturin-action@v1
69123
with:
70-
target: ${{ matrix.target }}
124+
target: ${{ matrix.platform.target }}
71125
args: --release --out dist --find-interpreter
72-
sccache: 'true'
126+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
73127

74128
- name: Upload wheels
75129
uses: actions/upload-artifact@main
76130
with:
77-
name: wheels
131+
name: wheels-windows-${{ matrix.platform.target }}
78132
path: dist
79133
if-no-files-found: error
80134

81135
macos:
82-
runs-on: macos-latest
136+
runs-on: ${{ matrix.platform.runner }}
83137
strategy:
84138
matrix:
85-
target: [x86_64, aarch64]
139+
platform:
140+
- runner: macos-13
141+
target: x86_64
142+
- runner: macos-14
143+
target: aarch64
86144
steps:
87145
- name: Checkout repo
88146
uses: actions/checkout@main
89147

90148
- name: Setup Python
91149
uses: actions/setup-python@main
92150
with:
93-
python-version: '3.13'
151+
python-version: 3.x
94152

95153
- name: Build wheels
96154
uses: PyO3/maturin-action@v1
97155
with:
98-
target: ${{ matrix.target }}
156+
target: ${{ matrix.platform.target }}
99157
args: --release --out dist --find-interpreter
100-
sccache: 'true'
158+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
101159

102160
- name: Upload wheels
103161
uses: actions/upload-artifact@main
104162
with:
105-
name: wheels
163+
name: wheels-macos-${{ matrix.platform.target }}
106164
path: dist
107165
if-no-files-found: error
108166

@@ -123,7 +181,7 @@ jobs:
123181
- name: Upload sdist
124182
uses: actions/upload-artifact@main
125183
with:
126-
name: wheels
184+
name: wheels-sdist
127185
path: dist
128186

129187
check_clippy_python_bindings:
@@ -149,20 +207,30 @@ jobs:
149207
release:
150208
name: Release
151209
runs-on: ubuntu-latest
152-
if: startsWith(github.ref, 'refs/tags/')
153-
needs: [linux, windows, macos, sdist, check_clippy_python_bindings]
210+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
211+
needs: [linux, musllinux, windows, macos, sdist, check_clippy_python_bindings]
154212
strategy:
155213
fail-fast: false
214+
permissions:
215+
# Use to sign the release artifacts
216+
id-token: write
217+
# Used to upload release artifacts
218+
contents: write
219+
# Used to generate artifact attestation
220+
attestations: write
156221
steps:
157222
- name: Download artifact
158223
uses: actions/download-artifact@main
224+
- name: Generate artifact attestation
225+
uses: actions/attest-build-provenance@main
159226
with:
160-
name: wheels
227+
subject-path: 'wheels-*/*'
161228

162229
- name: Publish to PyPI
230+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
163231
uses: PyO3/maturin-action@v1
164232
env:
165233
MATURIN_PYPI_TOKEN: ${{ secrets.pypi_password }}
166234
with:
167235
command: upload
168-
args: --non-interactive --skip-existing *
236+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)