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