Skip to content

Commit f5606df

Browse files
chore: rework CI and release configuration (#33)
## Description In this PR: - We shall now use GitHub Releases in favour of tags to create our distribution artifacts - The wheel build and push jobs have been moved to a separate workflow - The GHA Artifact Attestations feature is used to verify build provenance - Additionally, the `check_integration_test.sh` trigger was moved to the workflow file itself. This is a slight rework of our workflow(s) ahead of the 0.29 release planned in #31.
1 parent 1f0483e commit f5606df

File tree

3 files changed

+71
-63
lines changed

3 files changed

+71
-63
lines changed

.github/workflows/main.yml

+13-50
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: main
1+
name: CI
22

33
on:
44
push:
@@ -9,33 +9,6 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12-
build:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
16-
17-
- name: Setup Python
18-
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
19-
with:
20-
python-version: "3.12"
21-
22-
- name: Set up Node.js
23-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
24-
with:
25-
node-version: "20"
26-
27-
- name: Build
28-
run: |
29-
python -m pip install build
30-
python -m build .
31-
32-
- name: Store the distribution packages
33-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
34-
with:
35-
name: python-package-distributions
36-
path: dist/
37-
if-no-files-found: error
38-
3912
test:
4013
runs-on: ubuntu-latest
4114
steps:
@@ -78,7 +51,18 @@ jobs:
7851

7952
- id: check-integration-test-trigger
8053
name: Check integration test trigger
81-
run: bash tools/check_integration_test_trigger.sh
54+
shell: bash
55+
run: |
56+
set -e -x
57+
58+
COMMIT_MSG=$(git log --no-merges -1 --oneline)
59+
60+
# The integration tests will be triggered on push or on pull_request when the commit
61+
# message contains "[integration]"
62+
if [[ "$GITHUB_EVENT_NAME" == push ||
63+
"$COMMIT_MSG" =~ \[integration\] ]]; then
64+
echo "trigger=true" >> "$GITHUB_OUTPUT"
65+
fi
8266
8367
integration-test:
8468
runs-on: ubuntu-latest
@@ -119,24 +103,3 @@ jobs:
119103
run: |
120104
cd integration_tests
121105
make test-recipe
122-
123-
publish:
124-
name: Publish to PyPI
125-
needs:
126-
- build
127-
runs-on: ubuntu-latest
128-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
129-
environment:
130-
name: pypi
131-
url: https://pypi.org/p/pyodide-build
132-
permissions:
133-
id-token: write # IMPORTANT: mandatory for trusted publishing
134-
steps:
135-
- name: Download all the dists
136-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
137-
with:
138-
path: dist/
139-
merge-multiple: true
140-
141-
- name: Publish distribution 📦 to PyPI
142-
uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # v1.10.1

.github/workflows/release.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CD
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "0 3 * * 1"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
15+
16+
- name: Setup Python
17+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Build
22+
run: |
23+
python -m pip install build
24+
python -m build .
25+
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
if-no-files-found: error
32+
33+
publish:
34+
name: Publish to PyPI
35+
needs: [build]
36+
runs-on: ubuntu-latest
37+
if: github.event_name == 'release' && github.event.action == 'published'
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/p/pyodide-build
41+
permissions:
42+
id-token: write # IMPORTANT: mandatory for trusted publishing
43+
attestations: write
44+
contents: read
45+
steps:
46+
- name: Download all the dists
47+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
48+
with:
49+
path: dist/
50+
merge-multiple: true
51+
52+
- name: Generate artifact attestations
53+
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
54+
with:
55+
subject-path: "dist/*"
56+
57+
- name: Publish distribution 📦 to PyPI
58+
uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # v1.10.1

tools/check_integration_test_trigger.sh

-13
This file was deleted.

0 commit comments

Comments
 (0)