Skip to content

Commit 30051b8

Browse files
ryanmcmillanDelega Botclaude
authored
ci: extract reusable test workflow; ci.yml and publish.yml call it (#9)
Eliminates the drift trap that caused the v0.2.1 first-publish failure when pytest-asyncio was added to ci.yml only. Single source of truth for install + test in test.yml; both callers pick up dep changes automatically. - Create .github/workflows/test.yml (workflow_call, parametrized on python-versions JSON array, defaults to 3.9-3.13). - ci.yml (PR gate) now calls the reusable with default matrix. - publish.yml (tag gate) now calls the reusable with the reduced 3.9/3.11/3.13 matrix matching its previous behavior, then gates the publish job on it. Closes #8. Co-authored-by: Delega Bot <hello@delega.dev> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a71b699 commit 30051b8

3 files changed

Lines changed: 42 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,5 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
15-
steps:
16-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17-
18-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
22-
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install -e ".[async]"
26-
pip install pytest pytest-asyncio
27-
28-
- name: Run tests
29-
run: pytest tests/ -v
11+
# Calls the reusable workflow with the full 3.9-3.13 matrix for PRs.
12+
uses: ./.github/workflows/test.yml

.github/workflows/publish.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,12 @@ permissions:
1111

1212
jobs:
1313
test:
14-
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
python-version: ['3.9', '3.11', '3.13']
18-
steps:
19-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20-
21-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
22-
with:
23-
python-version: ${{ matrix.python-version }}
24-
25-
- name: Install and test
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install -e ".[async]"
29-
pip install pytest pytest-asyncio
30-
pytest tests/ -v
14+
# Calls the reusable workflow with a reduced 3.9/3.11/3.13 matrix for
15+
# release gate — slightly less coverage than CI since PRs already
16+
# exercised the full 3.9-3.13 matrix before getting here.
17+
uses: ./.github/workflows/test.yml
18+
with:
19+
python-versions: '["3.9", "3.11", "3.13"]'
3120

3221
publish:
3322
needs: test

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test
2+
3+
# Reusable workflow called by ci.yml (PR gate) and publish.yml (tag gate).
4+
# Single source of truth for install + test. If a test dep changes, update
5+
# this file only — both callers pick it up automatically.
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
python-versions:
11+
description: 'JSON array of Python versions to test'
12+
required: false
13+
type: string
14+
default: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: ${{ fromJSON(inputs.python-versions) }}
22+
steps:
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
25+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install and test
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -e ".[async]"
33+
pip install pytest pytest-asyncio
34+
pytest tests/ -v

0 commit comments

Comments
 (0)