Skip to content

Commit a809123

Browse files
committed
Switch to maturin-action, to get manylinux builds
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 4deccf6 commit a809123

File tree

1 file changed

+152
-46
lines changed

1 file changed

+152
-46
lines changed

.github/workflows/ci.yaml

Lines changed: 152 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -70,47 +70,130 @@ jobs:
7070
- name: Check matrix job result
7171
run: test "$DEPS_RESULT" = "success"
7272

73-
build:
74-
name: Build distribution packages
73+
build-linux:
74+
runs-on: ${{ matrix.platform.runner }}
7575
strategy:
76-
fail-fast: false
7776
matrix:
78-
target:
79-
- ubuntu-24.04
80-
- ubuntu-24.04-arm
81-
- windows-latest
82-
- macos-15-intel
83-
- macos-15
77+
platform:
78+
- runner: ubuntu-22.04
79+
target: x86_64
80+
- runner: ubuntu-22.04
81+
target: aarch64
8482
python:
8583
- "3.11"
8684
- "3.12"
8785
- "3.13"
8886
- "3.14"
89-
runs-on: ${{ matrix.target }}
9087
steps:
91-
- name: Setup Git
92-
uses: frequenz-floss/[email protected]
93-
94-
- name: Fetch sources
95-
uses: actions/checkout@v5
88+
- uses: actions/checkout@v5
89+
- uses: actions/setup-python@v5
9690
with:
97-
submodules: true
91+
python-version: ${{ matrix.python }}
92+
- name: Build wheels
93+
uses: PyO3/maturin-action@v1
94+
with:
95+
target: ${{ matrix.platform.target }}
96+
args: --release --out dist --find-interpreter
97+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
98+
manylinux: auto
99+
- name: Upload wheels
100+
uses: actions/upload-artifact@v5
101+
with:
102+
name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.python }}
103+
path: dist
98104

99-
- name: Setup Python
100-
uses: frequenz-floss/[email protected]
105+
build-musllinux:
106+
runs-on: ${{ matrix.platform.runner }}
107+
strategy:
108+
matrix:
109+
platform:
110+
- runner: ubuntu-22.04
111+
target: x86_64
112+
- runner: ubuntu-22.04
113+
target: aarch64
114+
python:
115+
- "3.11"
116+
- "3.12"
117+
- "3.13"
118+
- "3.14"
119+
steps:
120+
- uses: actions/checkout@v5
121+
- uses: actions/setup-python@v5
101122
with:
102123
python-version: ${{ matrix.python }}
103-
dependencies: build
124+
- name: Build wheels
125+
uses: PyO3/maturin-action@v1
126+
with:
127+
target: ${{ matrix.platform.target }}
128+
args: --release --out dist --find-interpreter
129+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
130+
manylinux: musllinux_1_2
131+
- name: Upload wheels
132+
uses: actions/upload-artifact@v5
133+
with:
134+
name: wheels-musllinux-${{ matrix.platform.target }}-${{ matrix.python }}
135+
path: dist
104136

105-
- name: Build the source and binary distribution
106-
run: python -m build
137+
build-windows:
138+
runs-on: ${{ matrix.platform.runner }}
139+
strategy:
140+
matrix:
141+
platform:
142+
- runner: windows-latest
143+
target: x64
144+
python:
145+
- "3.11"
146+
- "3.12"
147+
- "3.13"
148+
- "3.14"
149+
steps:
150+
- uses: actions/checkout@v5
151+
- uses: actions/setup-python@v5
152+
with:
153+
python-version: ${{ matrix.python }}
154+
architecture: ${{ matrix.platform.target }}
155+
- name: Build wheels
156+
uses: PyO3/maturin-action@v1
157+
with:
158+
target: ${{ matrix.platform.target }}
159+
args: --release --out dist --find-interpreter
160+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
161+
- name: Upload wheels
162+
uses: actions/upload-artifact@v5
163+
with:
164+
name: wheels-windows-${{ matrix.platform.target }}-${{ matrix.python }}
165+
path: dist
107166

108-
- name: Upload distribution files
167+
build-macos:
168+
runs-on: ${{ matrix.platform.runner }}
169+
strategy:
170+
matrix:
171+
platform:
172+
- runner: macos-13
173+
target: x86_64
174+
- runner: macos-14
175+
target: aarch64
176+
python:
177+
- "3.11"
178+
- "3.12"
179+
- "3.13"
180+
- "3.14"
181+
steps:
182+
- uses: actions/checkout@v5
183+
- uses: actions/setup-python@v5
184+
with:
185+
python-version: ${{ matrix.python }}
186+
- name: Build wheels
187+
uses: PyO3/maturin-action@v1
188+
with:
189+
target: ${{ matrix.platform.target }}
190+
args: --release --out dist --find-interpreter
191+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
192+
- name: Upload wheels
109193
uses: actions/upload-artifact@v5
110194
with:
111-
name: dist-packages-${{ matrix.target }}-${{ matrix.python }}
112-
path: dist/*.whl
113-
if-no-files-found: error
195+
name: wheels-macos-${{ matrix.platform.target }}-${{ matrix.python }}
196+
path: dist
114197

115198
build-sdist:
116199
name: Build source distribution packages
@@ -123,29 +206,44 @@ jobs:
123206
command: sdist
124207
args: --out dist
125208
- name: Upload sdist
126-
uses: actions/upload-artifact@v4
209+
uses: actions/upload-artifact@v5
127210
with:
128-
name: dist-packages-sdist
211+
name: wheels-sdist
129212
path: dist/*.tar.gz
130213

131214
test-installation:
132215
name: Test package installation
133-
needs: ["build", "build-sdist"]
216+
needs:
217+
- "build-linux"
218+
- "build-musllinux"
219+
- "build-windows"
220+
- "build-macos"
221+
- "build-sdist"
134222
strategy:
135223
fail-fast: false
136224
matrix:
137-
target:
138-
- ubuntu-24.04
139-
- ubuntu-24.04-arm
140-
- windows-latest
141-
- macos-15-intel
142-
- macos-15
225+
platform:
226+
- runner: ubuntu-22.04
227+
image: linux
228+
target: x86_64
229+
- runner: ubuntu-22.04
230+
image: linux
231+
target: aarch64
232+
- runner: windows-latest
233+
image: windows
234+
target: x64
235+
- runner: macos-13
236+
image: macos
237+
target: x86_64
238+
- runner: macos-14
239+
image: macos
240+
target: aarch64
143241
python:
144242
- "3.11"
145243
- "3.12"
146244
- "3.13"
147245
- "3.14"
148-
runs-on: ${{ matrix.target }}
246+
runs-on: ${{ matrix.platform.runner }}
149247

150248
steps:
151249
- name: Setup Git
@@ -157,7 +255,7 @@ jobs:
157255
- name: Download package
158256
uses: actions/download-artifact@v6
159257
with:
160-
name: dist-packages-${{ matrix.target }}-${{ matrix.python }}
258+
name: wheels-${{ matrix.platform.image }}-${{ matrix.platform.target }}-${{ matrix.python }}
161259
path: dist
162260

163261
# This is necessary for the `pip` caching in the setup-python action to work
@@ -341,7 +439,7 @@ jobs:
341439
--generate-notes \
342440
$extra_opts \
343441
$REF_NAME \
344-
dist/dist-packages-*/*.whl dist/dist-packages-sdist/*.tar.gz
442+
dist/wheels-*/*.whl dist/wheels-sdist/*.tar.gz
345443
env:
346444
REF_NAME: ${{ github.ref_name }}
347445
REPOSITORY: ${{ github.repository }}
@@ -352,15 +450,23 @@ jobs:
352450
needs: ["create-github-release"]
353451
runs-on: ubuntu-24.04
354452
permissions:
355-
# For trusted publishing. See:
356-
# https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
453+
# Use to sign the release artifacts
357454
id-token: write
455+
# Used to upload release artifacts
456+
contents: write
457+
# Used to generate artifact attestation
458+
attestations: write
358459
steps:
359-
- name: Download distribution files
360-
uses: actions/download-artifact@v6
460+
- uses: actions/download-artifact@v6
461+
- name: Generate artifact attestation
462+
uses: actions/attest-build-provenance@v2
361463
with:
362-
path: dist
363-
merge-multiple: true
364-
365-
- name: Publish the Python distribution to PyPI
366-
uses: pypa/gh-action-pypi-publish@release/v1
464+
subject-path: 'wheels-*/*'
465+
- name: Publish to PyPI
466+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
467+
uses: PyO3/maturin-action@v1
468+
env:
469+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
470+
with:
471+
command: upload
472+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)