Skip to content

Commit 5a3ae3c

Browse files
authored
⚗️ upload to Test PyPI for pushes on main (cda-tum#461)
## Description This PR updates the CD workflow so that anytime it runs on a push to `main`, it uploads the resulting package to Test PyPI. This allows to battle test the packages before official releases. This will be especially important in the context of cda-tum#432 ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines.
2 parents b332365 + 0bd41c5 commit 5a3ae3c

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed

.github/workflows/cd.yml

+35-10
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,57 @@
11
name: CD
22
on:
3+
push:
4+
branches: [main]
35
release:
46
types: [published]
57
workflow_dispatch:
6-
pull_request:
7-
paths:
8-
- .github/workflows/cd.yml
98

10-
concurrency:
11-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12-
cancel-in-progress: true
9+
permissions:
10+
attestations: write
11+
contents: read
12+
id-token: write
1313

1414
jobs:
15+
# Builds the sdist and wheels on all supported platforms and uploads the resulting
16+
# wheels as GitHub artifacts `dev-cibw-*`, `test-cibw-*`, or `cibw-*`, depending on
17+
# whether the workflow is triggered from a PR, a push to main, or a release, respectively.
1518
python-packaging:
1619
name: 🐍 Packaging
1720
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.4
21+
with:
22+
# Do not include local version information on pushes to main to facilitate TestPyPI uploads.
23+
no-local-version: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
24+
# Do not build emulated wheels on pushes to main to reduce runner load for CD.
25+
build-emulated-wheels: ${{ github.ref != 'refs/heads/main' || github.event_name != 'push' }}
1826

27+
# Downloads the previously generated artifacts and deploys to TestPyPI on pushes to main
28+
deploy-test-pypi:
29+
name: 🚀 Deploy to Test PyPI
30+
runs-on: ubuntu-latest
31+
environment:
32+
name: test-pypi
33+
url: https://test.pypi.org/p/mqt.qcec
34+
needs: [python-packaging]
35+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
36+
steps:
37+
- uses: actions/download-artifact@v4
38+
with:
39+
pattern: test-cibw-*
40+
path: dist
41+
merge-multiple: true
42+
- uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
repository-url: https://test.pypi.org/legacy/
45+
attestations: true
46+
47+
# Downloads the previously generated artifacts and deploys to PyPI on published releases.
1948
deploy:
2049
if: github.event_name == 'release' && github.event.action == 'published'
2150
name: 🚀 Deploy to PyPI
2251
runs-on: ubuntu-latest
2352
environment:
2453
name: pypi
2554
url: https://pypi.org/p/mqt.qcec
26-
permissions:
27-
id-token: write
28-
attestations: write
29-
contents: read
3055
needs: [python-packaging]
3156
steps:
3257
- uses: actions/download-artifact@v4

.github/workflows/ci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ jobs:
4545
if: fromJSON(needs.change-detection.outputs.run-code-ql)
4646
uses: cda-tum/mqt-workflows/.github/workflows/reusable-code-ql.yml@v1.4
4747

48+
cd:
49+
name: 🚀 CD
50+
needs: change-detection
51+
if: fromJSON(needs.change-detection.outputs.run-cd)
52+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.4
53+
4854
required-checks-pass: # This job does nothing and is only used for branch protection
4955
name: 🚦 Check
5056
if: always()
@@ -54,6 +60,7 @@ jobs:
5460
- cpp-linter
5561
- python-tests
5662
- code-ql
63+
- cd
5764
runs-on: ubuntu-latest
5865
steps:
5966
- name: Decide whether the needed jobs succeeded or failed
@@ -76,4 +83,8 @@ jobs:
7683
fromJSON(needs.change-detection.outputs.run-code-ql)
7784
&& '' || 'code-ql,'
7885
}}
86+
${{
87+
fromJSON(needs.change-detection.outputs.run-cd)
88+
&& '' || 'cd,'
89+
}}
7990
jobs: ${{ toJSON(needs) }}

pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ before-build = "pip install delvewheel>=1.7.3"
305305
repair-wheel-command = "delvewheel repair -v -w {dest_dir} {wheel} --namespace-pkg mqt"
306306
environment = { CMAKE_ARGS = "-T ClangCL", SKBUILD_CMAKE_ARGS="--fresh" }
307307

308+
[[tool.cibuildwheel.overrides]]
309+
select = "*-macosx_arm64"
310+
environment = { MACOSX_DEPLOYMENT_TARGET = "11.0" }
311+
308312

309313
[tool.uv]
310314
reinstall-package = ["mqt.qcec"]

0 commit comments

Comments
 (0)