Skip to content

Commit 3d69f0b

Browse files
more python tests
1 parent 7315d84 commit 3d69f0b

1 file changed

Lines changed: 196 additions & 2 deletions

File tree

.github/workflows/python-tests.yml

Lines changed: 196 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ on:
88
jobs:
99
test:
1010
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1114

1215
steps:
1316
- uses: actions/checkout@v6
1417

1518
- name: Set up Python
1619
uses: actions/setup-python@v6
1720
with:
18-
python-version: 3.x
21+
python-version: ${{ matrix.python-version }}
1922

2023
- name: Set up uv
2124
uses: astral-sh/setup-uv@v7
@@ -29,8 +32,199 @@ jobs:
2932
3033
- name: Build Python bindings
3134
run: |
32-
maturin develop --release --features pyo3
35+
uv run maturin develop --release --features pyo3
3336
3437
- name: Run Python tests
3538
run: |
3639
uv run pytest test_cloudcheck.py -v
40+
41+
publish:
42+
runs-on: ubuntu-latest
43+
needs: test
44+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
45+
steps:
46+
- uses: actions/checkout@v6
47+
- name: Set up Python
48+
uses: actions/setup-python@v6
49+
with:
50+
python-version: "3.12"
51+
- name: Set up Rust
52+
uses: dtolnay/rust-toolchain@stable
53+
- name: Set up uv
54+
uses: astral-sh/setup-uv@v7
55+
- name: Build PyPi package
56+
if: github.ref == 'refs/heads/master'
57+
run: uv run maturin build --release --out dist
58+
- name: Publish PyPi package
59+
if: github.ref == 'refs/heads/master'
60+
run: uv run maturin publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}
61+
62+
linux:
63+
runs-on: ${{ matrix.platform.runner }}
64+
needs: publish
65+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
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+
- runner: ubuntu-22.04
78+
target: s390x
79+
- runner: ubuntu-22.04
80+
target: ppc64le
81+
steps:
82+
- uses: actions/checkout@v6
83+
- uses: actions/setup-python@v6
84+
with:
85+
python-version: 3.x
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: false
92+
manylinux: auto
93+
- name: Upload wheels
94+
uses: actions/upload-artifact@v5
95+
with:
96+
name: wheels-linux-${{ matrix.platform.target }}
97+
path: dist
98+
99+
musllinux:
100+
runs-on: ${{ matrix.platform.runner }}
101+
needs: publish
102+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
103+
strategy:
104+
matrix:
105+
platform:
106+
- runner: ubuntu-22.04
107+
target: x86_64
108+
- runner: ubuntu-22.04
109+
target: x86
110+
- runner: ubuntu-22.04
111+
target: aarch64
112+
- runner: ubuntu-22.04
113+
target: armv7
114+
steps:
115+
- uses: actions/checkout@v6
116+
- uses: actions/setup-python@v6
117+
with:
118+
python-version: 3.x
119+
- name: Build wheels
120+
uses: PyO3/maturin-action@v1
121+
with:
122+
target: ${{ matrix.platform.target }}
123+
args: --release --out dist --find-interpreter
124+
sccache: false
125+
manylinux: musllinux_1_2
126+
- name: Upload wheels
127+
uses: actions/upload-artifact@v5
128+
with:
129+
name: wheels-musllinux-${{ matrix.platform.target }}
130+
path: dist
131+
132+
windows:
133+
runs-on: ${{ matrix.platform.runner }}
134+
needs: publish
135+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
136+
strategy:
137+
matrix:
138+
platform:
139+
- runner: windows-latest
140+
target: x64
141+
- runner: windows-latest
142+
target: x86
143+
steps:
144+
- uses: actions/checkout@v6
145+
- uses: actions/setup-python@v6
146+
with:
147+
python-version: 3.x
148+
architecture: ${{ matrix.platform.target }}
149+
- name: Build wheels
150+
uses: PyO3/maturin-action@v1
151+
with:
152+
target: ${{ matrix.platform.target }}
153+
args: --release --out dist --find-interpreter
154+
sccache: false
155+
- name: Upload wheels
156+
uses: actions/upload-artifact@v5
157+
with:
158+
name: wheels-windows-${{ matrix.platform.target }}
159+
path: dist
160+
161+
macos:
162+
runs-on: ${{ matrix.platform.runner }}
163+
needs: publish
164+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
165+
strategy:
166+
matrix:
167+
platform:
168+
- runner: macos-15-intel
169+
target: x86_64
170+
- runner: macos-latest
171+
target: aarch64
172+
steps:
173+
- uses: actions/checkout@v6
174+
- uses: actions/setup-python@v6
175+
with:
176+
python-version: 3.x
177+
- name: Build wheels
178+
uses: PyO3/maturin-action@v1
179+
with:
180+
target: ${{ matrix.platform.target }}
181+
args: --release --out dist --find-interpreter
182+
sccache: false
183+
- name: Upload wheels
184+
uses: actions/upload-artifact@v5
185+
with:
186+
name: wheels-macos-${{ matrix.platform.target }}
187+
path: dist
188+
189+
sdist:
190+
runs-on: ubuntu-latest
191+
needs: publish
192+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
193+
steps:
194+
- uses: actions/checkout@v6
195+
- name: Build sdist
196+
uses: PyO3/maturin-action@v1
197+
with:
198+
command: sdist
199+
args: --out dist
200+
- name: Upload sdist
201+
uses: actions/upload-artifact@v5
202+
with:
203+
name: wheels-sdist
204+
path: dist
205+
206+
release:
207+
name: Release
208+
runs-on: ubuntu-latest
209+
needs: [linux, musllinux, windows, macos, sdist]
210+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
211+
permissions:
212+
# Use to sign the release artifacts
213+
id-token: write
214+
# Used to upload release artifacts
215+
contents: write
216+
# Used to generate artifact attestation
217+
attestations: write
218+
steps:
219+
- uses: actions/download-artifact@v6
220+
- name: Generate artifact attestation
221+
uses: actions/attest-build-provenance@v3
222+
with:
223+
subject-path: 'wheels-*/*'
224+
- name: Publish wheels to PyPI
225+
uses: PyO3/maturin-action@v1
226+
env:
227+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
228+
with:
229+
command: upload
230+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)