From e29598adeacff51e507f5c7e8221765d0b86fe83 Mon Sep 17 00:00:00 2001 From: Delega Bot Date: Tue, 14 Apr 2026 14:55:40 -0500 Subject: [PATCH] ci: extract reusable test workflow; ci.yml and publish.yml call it 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: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 21 ++------------------- .github/workflows/publish.yml | 23 ++++++----------------- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97d82c9..b2f0d5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,22 +8,5 @@ on: jobs: test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e ".[async]" - pip install pytest pytest-asyncio - - - name: Run tests - run: pytest tests/ -v + # Calls the reusable workflow with the full 3.9-3.13 matrix for PRs. + uses: ./.github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d3846e6..8760fd2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,23 +11,12 @@ permissions: jobs: test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.9', '3.11', '3.13'] - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ matrix.python-version }} - - - name: Install and test - run: | - python -m pip install --upgrade pip - pip install -e ".[async]" - pip install pytest pytest-asyncio - pytest tests/ -v + # Calls the reusable workflow with a reduced 3.9/3.11/3.13 matrix for + # release gate — slightly less coverage than CI since PRs already + # exercised the full 3.9-3.13 matrix before getting here. + uses: ./.github/workflows/test.yml + with: + python-versions: '["3.9", "3.11", "3.13"]' publish: needs: test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ef481c3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +# Reusable workflow called by ci.yml (PR gate) and publish.yml (tag gate). +# Single source of truth for install + test. If a test dep changes, update +# this file only — both callers pick it up automatically. + +on: + workflow_call: + inputs: + python-versions: + description: 'JSON array of Python versions to test' + required: false + type: string + default: '["3.9", "3.10", "3.11", "3.12", "3.13"]' + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ${{ fromJSON(inputs.python-versions) }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install and test + run: | + python -m pip install --upgrade pip + pip install -e ".[async]" + pip install pytest pytest-asyncio + pytest tests/ -v