Skip to content

Commit 3a9164f

Browse files
authored
Build/test with multiple Python versions (#40)
1 parent 3cdc8f6 commit 3a9164f

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

.github/workflows/build-test-release.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & test
1+
name: Test & release
22

33
on:
44
push:
@@ -16,10 +16,18 @@ on:
1616
workflow_dispatch:
1717

1818
jobs:
19-
build:
20-
name: Build & verify package
19+
check:
20+
name: Check
2121
runs-on: ubuntu-latest
2222

23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version:
27+
- "3.10"
28+
- "3.11"
29+
- "3.12"
30+
2331
steps:
2432
- name: Checkout
2533
uses: actions/checkout@v4
@@ -29,9 +37,8 @@ jobs:
2937
with:
3038
enable-cache: true
3139

32-
- name: Configure version
33-
if: github.event.action == 'published'
34-
run: ./.github/set-version
40+
- name: Install Python
41+
run: uv python install ${{ matrix.python-version }}
3542

3643
- name: Test
3744
run: make test
@@ -45,21 +52,43 @@ jobs:
4552
- name: format
4653
run: uv run ruff format --diff
4754

55+
# Just test the build works, we'll upload the one in the next job
56+
# instead, if needed.
4857
- name: Build
4958
run: make build
5059

51-
- name: Upload package
60+
build:
61+
name: Build package
62+
needs: check
63+
if: github.event.action == 'published'
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v4
69+
70+
- name: Install the latest version of uv
71+
uses: astral-sh/setup-uv@v3
72+
with:
73+
enable-cache: true
74+
75+
- name: Configure version
5276
if: github.event.action == 'published'
77+
run: ./.github/set-version
78+
79+
- name: Build
80+
run: make build
81+
82+
- name: Upload package
5383
uses: actions/upload-artifact@v4
5484
with:
5585
name: Packages
5686
path: dist/*
5787

58-
release:
59-
name: Publish
60-
runs-on: ubuntu-latest
61-
if: github.event.action == 'published'
88+
publish:
89+
name: Publish package
6290
needs: build
91+
runs-on: ubuntu-latest
6392
environment: pypi-release
6493

6594
permissions:

0 commit comments

Comments
 (0)