Skip to content

Commit e795b4b

Browse files
Merge pull request #455 from Jazzinghen/jazzinghen/update_CI_pipeline
Update CI pipeline
2 parents 501f3a0 + 74132b9 commit e795b4b

File tree

2 files changed

+152
-100
lines changed

2 files changed

+152
-100
lines changed

.github/workflows/python.yml

Lines changed: 151 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is autogenerated by maturin v1.3.2
1+
# This file is autogenerated by maturin v1.11.5
22
# To update, run
33
#
44
# maturin generate-ci --pytest -o .github/workflows/python.yml github
@@ -11,7 +11,7 @@ on:
1111
- main
1212
- master
1313
tags:
14-
- '*'
14+
- "*"
1515
pull_request:
1616
workflow_dispatch:
1717

@@ -20,24 +20,32 @@ permissions:
2020

2121
jobs:
2222
linux:
23-
runs-on: ubuntu-22.04
23+
runs-on: ${{ matrix.platform.runner }}
2424
strategy:
2525
matrix:
26-
target: [x86_64, x86, armv7, aarch64, ppc64le]
27-
26+
platform:
27+
- runner: ubuntu-22.04
28+
target: x86_64
29+
- runner: ubuntu-22.04
30+
target: x86
31+
- runner: ubuntu-22.04-arm
32+
target: aarch64
33+
- runner: ubuntu-22.04
34+
target: armv7
35+
- runner: ubuntu-22.04
36+
target: ppc64le
2837
steps:
29-
- uses: actions/checkout@v4
30-
- name: Setup Python on ${{ matrix.target }}
31-
uses: actions/setup-python@v5
38+
- uses: actions/checkout@v6
39+
- uses: actions/setup-python@v6
3240
with:
33-
python-version: ">=3.9"
34-
41+
python-version: 3.x
3542
- name: Build wheels
3643
uses: PyO3/maturin-action@v1
3744
with:
38-
target: ${{ matrix.target }}
39-
args: --release --out dist --find-interpreter -F python
40-
manylinux: ${{ matrix.target == 'aarch64' && 'manylinux_2_28' || 'auto' }}
45+
target: ${{ matrix.platform.target }}
46+
args: --release --out dist --find-interpreter
47+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
48+
manylinux: ${{ matrix.platform.target == 'aarch64' && 'manylinux_2_28' || 'auto' }}
4149
before-script-linux: |
4250
# If we're running on rhel centos, install needed packages.
4351
if command -v yum &> /dev/null; then
@@ -50,27 +58,28 @@ jobs:
5058
fi
5159
else
5260
# If we're running on debian-based system.
53-
apt update -y && apt-get install -y libssl-dev openssl pkg-config
61+
apt-get update -y && apt-get install -y libssl-dev openssl pkg-config
5462
fi
5563
- name: Upload wheels
56-
uses: actions/upload-artifact@v4
64+
uses: actions/upload-artifact@v5
5765
with:
58-
name: wheels-linux-${{ matrix.target }}
66+
name: wheels-linux-${{ matrix.platform.target }}
5967
path: dist
60-
- name: pytest (x86_64)
61-
if: ${{ startsWith(matrix.target, 'x86_64') }}
68+
- name: pytest
69+
if: ${{ matrix.platform.target == 'x86_64' || matrix.platform.target == 'aarch64' }}
6270
shell: bash
6371
run: |
6472
set -e
65-
ls dist
66-
pip install hifitime --find-links dist --force-reinstall --no-index -vv
73+
python3 -m venv .venv
74+
source .venv/bin/activate
75+
pip install hifitime --find-links dist --force-reinstall
6776
pip install pytest
6877
pytest
69-
- name: pytest (non-x86)
70-
if: ${{ !startsWith(matrix.target, 'x86') }}
71-
uses: uraimo/run-on-arch-action@v3
78+
- name: pytest
79+
if: ${{ matrix.platform.target != 'x86_64' && matrix.platform.target != 'x86' && matrix.platform.target != 'aarch64'}}
80+
uses: uraimo/run-on-arch-action@v2
7281
with:
73-
arch: ${{ matrix.target }}
82+
arch: ${{ matrix.platform.target }}
7483
distro: ubuntu22.04
7584
githubToken: ${{ github.token }}
7685
install: |
@@ -79,140 +88,183 @@ jobs:
7988
pip3 install -U pip pytest
8089
run: |
8190
set -e
82-
ls dist
83-
pip3 install hifitime --find-links dist --force-reinstall --no-index -vv
91+
pip3 install hifitime --find-links dist --force-reinstall
8492
pytest
8593
86-
87-
windows:
88-
runs-on: windows-latest
94+
musllinux:
95+
runs-on: ${{ matrix.platform.runner }}
8996
strategy:
9097
matrix:
91-
target: [x64, x86]
98+
platform:
99+
- runner: ubuntu-22.04
100+
target: x86_64
101+
- runner: ubuntu-22.04
102+
target: x86
103+
- runner: ubuntu-22.04-arm
104+
target: aarch64
105+
- runner: ubuntu-22.04
106+
target: armv7
92107
steps:
93-
- uses: actions/checkout@v4
94-
- uses: actions/setup-python@v5
108+
- uses: actions/checkout@v6
109+
- uses: actions/setup-python@v6
95110
with:
96-
python-version: '3.11'
97-
architecture: ${{ matrix.target }}
111+
python-version: 3.x
98112
- name: Build wheels
99113
uses: PyO3/maturin-action@v1
100114
with:
101-
target: ${{ matrix.target }}
102-
args: --release --out dist --find-interpreter -F python
103-
sccache: 'true'
115+
target: ${{ matrix.platform.target }}
116+
args: --release --out dist --find-interpreter
117+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
118+
manylinux: musllinux_1_2
104119
- name: Upload wheels
105-
uses: actions/upload-artifact@v4
120+
uses: actions/upload-artifact@v5
106121
with:
107-
name: wheels-windows-${{ matrix.target }}
122+
name: wheels-musllinux-${{ matrix.platform.target }}
108123
path: dist
109124
- name: pytest
110-
if: ${{ !startsWith(matrix.target, 'aarch64') }}
111-
shell: bash
112-
run: |
113-
set -e
114-
pip install hifitime --find-links dist --force-reinstall --no-index -vv
115-
pip install pytest
116-
pytest
117-
118-
macos-13: # last available x86_64 macos runner
119-
runs-on: macos-13
120-
steps:
121-
- uses: actions/checkout@v4
125+
if: ${{ matrix.platform.target == 'x86_64' || matrix.platform.target == 'aarch64' }}
126+
uses: addnab/docker-run-action@v3
122127
with:
123-
lfs: true
124-
125-
- uses: actions/setup-python@v5
128+
image: alpine:latest
129+
options: -v ${{ github.workspace }}:/io -w /io
130+
run: |
131+
set -e
132+
apk add py3-pip py3-virtualenv
133+
python3 -m virtualenv .venv
134+
source .venv/bin/activate
135+
pip install hifitime --no-index --find-links dist --force-reinstall
136+
pip install pytest
137+
pytest
138+
- name: pytest
139+
if: ${{ matrix.platform.target != 'x86_64' && matrix.platform.target != 'x86' && matrix.platform.target != 'aarch64'}}
140+
uses: uraimo/run-on-arch-action@v2
126141
with:
127-
python-version: "3.11"
142+
arch: ${{ matrix.platform.target }}
143+
distro: alpine_latest
144+
githubToken: ${{ github.token }}
145+
install: |
146+
apk add py3-virtualenv
147+
run: |
148+
set -e
149+
python3 -m virtualenv .venv
150+
source .venv/bin/activate
151+
pip install pytest
152+
pip install hifitime --find-links dist --force-reinstall
153+
pytest
128154
155+
windows:
156+
runs-on: ${{ matrix.platform.runner }}
157+
strategy:
158+
matrix:
159+
platform:
160+
- runner: windows-latest
161+
target: x64
162+
python_arch: x64
163+
- runner: windows-latest
164+
target: x86
165+
python_arch: x86
166+
- runner: windows-11-arm
167+
target: aarch64
168+
python_arch: arm64
169+
steps:
170+
- uses: actions/checkout@v6
171+
- uses: actions/setup-python@v6
172+
with:
173+
python-version: 3.13
174+
architecture: ${{ matrix.platform.python_arch }}
129175
- name: Build wheels
130176
uses: PyO3/maturin-action@v1
131177
with:
132-
target: x86_64
133-
args: --release --out dist --find-interpreter -F python
134-
sccache: 'true'
135-
178+
target: ${{ matrix.platform.target }}
179+
args: --release --out dist --find-interpreter
180+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
136181
- name: Upload wheels
137-
uses: actions/upload-artifact@v4
182+
uses: actions/upload-artifact@v5
138183
with:
139-
name: wheels-macos-13
184+
name: wheels-windows-${{ matrix.platform.target }}
140185
path: dist
141-
142186
- name: pytest
143187
shell: bash
144-
env:
145-
RUST_BACKTRACE: 1
146188
run: |
147189
set -e
148-
pip install hifitime --find-links dist --force-reinstall --no-index
190+
python3 -m venv .venv
191+
source .venv/Scripts/activate
192+
pip install hifitime --find-links dist --force-reinstall
149193
pip install pytest
150194
pytest
151195
152-
macos-14: # first available aarch64 macos runner
153-
runs-on: macos-14
196+
macos:
197+
runs-on: ${{ matrix.platform.runner }}
198+
strategy:
199+
matrix:
200+
platform:
201+
- runner: macos-15-intel
202+
target: x86_64
203+
- runner: macos-latest
204+
target: aarch64
154205
steps:
155-
- uses: actions/checkout@v4
156-
with:
157-
lfs: true
158-
159-
- uses: actions/setup-python@v5
206+
- uses: actions/checkout@v6
207+
- uses: actions/setup-python@v6
160208
with:
161-
python-version: "3.11"
162-
209+
python-version: 3.x
163210
- name: Build wheels
164211
uses: PyO3/maturin-action@v1
165212
with:
166-
target: aarch64
167-
args: --release --out dist --find-interpreter -F python
168-
sccache: 'true'
169-
213+
target: ${{ matrix.platform.target }}
214+
args: --release --out dist --find-interpreter
215+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
170216
- name: Upload wheels
171-
uses: actions/upload-artifact@v4
217+
uses: actions/upload-artifact@v5
172218
with:
173-
name: wheels-macos-14
219+
name: wheels-macos-${{ matrix.platform.target }}
174220
path: dist
175-
176221
- name: pytest
177-
shell: bash
178-
env:
179-
RUST_BACKTRACE: 1
180222
run: |
181223
set -e
182-
pip install hifitime --find-links dist --force-reinstall --no-index
224+
python3 -m venv .venv
225+
source .venv/bin/activate
226+
pip install hifitime --find-links dist --force-reinstall
183227
pip install pytest
184228
pytest
185229
186230
sdist:
187231
runs-on: ubuntu-latest
188232
steps:
189-
- uses: actions/checkout@v4
233+
- uses: actions/checkout@v6
190234
- name: Build sdist
191235
uses: PyO3/maturin-action@v1
192236
with:
193237
command: sdist
194238
args: --out dist
195239
- name: Upload sdist
196-
uses: actions/upload-artifact@v4
240+
uses: actions/upload-artifact@v5
197241
with:
198-
name: wheels
242+
name: wheels-sdist
199243
path: dist
200244

201245
release:
202246
name: Release
203247
runs-on: ubuntu-latest
204-
if: github.ref_type == 'tag'
205-
needs: [linux, windows, macos-13, macos-14, sdist]
248+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
249+
needs: [linux, musllinux, windows, macos, sdist]
250+
permissions:
251+
# Use to sign the release artifacts
252+
id-token: write
253+
# Used to upload release artifacts
254+
contents: write
255+
# Used to generate artifact attestation
256+
attestations: write
206257
steps:
207-
- uses: actions/download-artifact@v4
258+
- uses: actions/download-artifact@v6
259+
- name: Generate artifact attestation
260+
uses: actions/attest-build-provenance@v3
208261
with:
209-
pattern: wheels-*
210-
merge-multiple: true
211-
262+
subject-path: "wheels-*/*"
263+
- name: Install uv
264+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
265+
uses: astral-sh/setup-uv@v7
212266
- name: Publish to PyPI
213-
uses: PyO3/maturin-action@v1
267+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
268+
run: uv publish 'wheels-*/*'
214269
env:
215-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
216-
with:
217-
command: upload
218-
args: --non-interactive --skip-existing *
270+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["maturin>=1.9,<1.10"]
2+
requires = ["maturin>=1.9,<2.0"]
33
build-backend = "maturin"
44

55
[tool.maturin]

0 commit comments

Comments
 (0)