Skip to content

Commit 9f1df5a

Browse files
Add smoke-test gate before PyPI publish in release workflow
Install the built wheel on each OS (ubuntu, macos, windows) and run pytest before the publish job can proceed. This prevents shipping a wheel that fails to import or has broken tests.
1 parent 1bee8eb commit 9f1df5a

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,51 @@ jobs:
136136
path: dist/
137137
if-no-files-found: error
138138

139+
smoke-test:
140+
name: Smoke test (${{ matrix.os }})
141+
needs: [build-linux, build-macos, build-windows]
142+
runs-on: ${{ matrix.os }}
143+
strategy:
144+
fail-fast: false
145+
matrix:
146+
os: [ubuntu-latest, macos-latest, windows-latest]
147+
include:
148+
- os: ubuntu-latest
149+
artifact: wheels-linux-x86_64
150+
- os: macos-latest
151+
artifact: wheels-macos-aarch64
152+
- os: windows-latest
153+
artifact: wheels-windows-x64
154+
steps:
155+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
156+
with:
157+
persist-credentials: false
158+
159+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
160+
with:
161+
python-version: "3.12"
162+
163+
- name: Download wheel
164+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
165+
with:
166+
name: ${{ matrix.artifact }}
167+
path: dist/
168+
169+
- name: Install wheel and test dependencies
170+
run: |
171+
pip install dist/*.whl
172+
pip install pytest
173+
174+
- name: Run tests
175+
run: pytest -v
176+
139177
publish:
140178
name: Publish
141179
runs-on: ubuntu-latest
142180
permissions:
143181
id-token: write # for Trusted Publishing
144182
needs:
145-
[build-sdist, build-linux, build-musllinux, build-macos, build-windows]
183+
[build-sdist, build-linux, build-musllinux, build-macos, build-windows, smoke-test]
146184

147185
environment: release
148186

0 commit comments

Comments
 (0)