Skip to content

Commit ed2d5b3

Browse files
committed
ci: add test matrix and gate publishing on tests
- new CI workflow runs ruff/mypy/pytest across Python 3.10-3.13 x {core, all} on pull_request and push to main - publish-pypi gains a test job (core/3.10 + all/3.13) that build now needs, using the same release-tag checkout logic
1 parent 74500f1 commit ed2d5b3

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: test (py${{ matrix.python-version }}, ${{ matrix.extras }})
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.10", "3.11", "3.12", "3.13"]
23+
extras: [core, all]
24+
25+
steps:
26+
- name: Check out repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
34+
- name: Sync dependencies
35+
run: |
36+
if [ "${{ matrix.extras }}" = "all" ]; then
37+
uv sync --all-extras
38+
else
39+
uv sync
40+
fi
41+
42+
- name: Ruff
43+
run: uv run ruff check .
44+
45+
- name: Mypy
46+
run: uv run mypy
47+
48+
- name: Pytest
49+
run: uv run pytest -q

.github/workflows/publish-pypi.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,51 @@ concurrency:
1818
cancel-in-progress: false
1919

2020
jobs:
21+
test:
22+
name: test (py${{ matrix.python-version }}, ${{ matrix.extras }})
23+
runs-on: ubuntu-latest
24+
env:
25+
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
- python-version: "3.10"
31+
extras: core
32+
- python-version: "3.13"
33+
extras: all
34+
35+
steps:
36+
- name: Check out release tag
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ env.RELEASE_TAG }}
40+
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v5
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Sync dependencies
47+
run: |
48+
if [ "${{ matrix.extras }}" = "all" ]; then
49+
uv sync --all-extras
50+
else
51+
uv sync
52+
fi
53+
54+
- name: Ruff
55+
run: uv run ruff check .
56+
57+
- name: Mypy
58+
run: uv run mypy
59+
60+
- name: Pytest
61+
run: uv run pytest -q
62+
2163
build:
2264
name: Build distributions
65+
needs: test
2366
runs-on: ubuntu-latest
2467
env:
2568
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}

0 commit comments

Comments
 (0)