diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 653e211..673e259 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ on: workflow_dispatch: env: - DEFAULT_PYTHON: "3.12" + DEFAULT_PYTHON: "3.13" PRE_COMMIT_CACHE: ~/.cache/pre-commit concurrency: @@ -22,9 +22,12 @@ jobs: # This prevent upcoming jobs to do the same individually prepare: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12", "3.13"] outputs: - python-version: ${{ steps.python.outputs.python-version }} - name: Prepare Python dependencies + python-version: ${{ matrix.python-version }} + name: Prepare Python ${{ matrix.python-version }} dependencies steps: - name: Check out code from GitHub uses: actions/checkout@v4.2.2 @@ -32,15 +35,15 @@ jobs: id: python uses: actions/setup-python@v5.6.0 with: - python-version: ${{ env.DEFAULT_PYTHON }} + python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v4.2.3 with: path: venv - key: | - ${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{ - hashFiles('pyproject.toml') }} + key: > + ${{ runner.os }}-venv-${{ matrix.python-version }}- + ${{ hashFiles('pyproject.toml') }} - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -54,9 +57,9 @@ jobs: with: path: ${{ env.PRE_COMMIT_CACHE }} lookup-only: true - key: | - ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') - }} + key: > + ${{ runner.os }}-pre-commit-${{ matrix.python-version }}- + ${{ hashFiles('.pre-commit-config.yaml') }} restore-keys: | ${{ runner.os }}-pre-commit- - name: Install pre-commit dependencies @@ -66,25 +69,28 @@ jobs: pre-commit install-hooks lint-ruff-format: - name: Check ruff-format + name: Check ruff-format Python ${{ matrix.python-version }} runs-on: ubuntu-latest needs: prepare + strategy: + matrix: + python-version: ["3.12", "3.13"] steps: - name: Check out code from GitHub uses: actions/checkout@v4.2.2 - - name: Set up Python ${{ needs.prepare.outputs.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.6.0 id: python with: - python-version: ${{ needs.prepare.outputs.python-version }} + python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v4.2.3 with: path: venv - key: | - ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version - }}-${{ hashFiles('pyproject.toml') }} + key: > + ${{ runner.os }}-venv-${{ matrix.python-version }}- + ${{ hashFiles('pyproject.toml') }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -95,9 +101,9 @@ jobs: uses: actions/cache@v4.2.3 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: | - ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') - }} + key: > + ${{ runner.os }}-pre-commit-${{ matrix.python-version }}- + ${{ hashFiles('.pre-commit-config.yaml') }} - name: Fail job if cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -112,25 +118,28 @@ jobs: RUFF_OUTPUT_FORMAT: github lint-ruff: - name: Check ruff + name: Check ruff Python ${{ matrix.python-version }} runs-on: ubuntu-latest needs: prepare + strategy: + matrix: + python-version: ["3.12", "3.13"] steps: - name: Check out code from GitHub uses: actions/checkout@v4.2.2 - - name: Set up Python ${{ needs.prepare.outputs.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.6.0 id: python with: - python-version: ${{ needs.prepare.outputs.python-version }} + python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v4.2.3 with: path: venv - key: | - ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version - }}-${{ hashFiles('pyproject.toml') }} + key: > + ${{ runner.os }}-venv-${{ matrix.python-version }}- + ${{ hashFiles('pyproject.toml') }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -141,9 +150,9 @@ jobs: uses: actions/cache@v4.2.3 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: | - ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') - }} + key: > + ${{ runner.os }}-pre-commit-${{ matrix.python-version }}- + ${{ hashFiles('.pre-commit-config.yaml') }} - name: Fail job if cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -158,25 +167,28 @@ jobs: RUFF_OUTPUT_FORMAT: github lint-other: - name: Check other linters + name: Check other linters Python ${{ matrix.python-version }} runs-on: ubuntu-24.04 needs: prepare + strategy: + matrix: + python-version: ["3.12", "3.13"] steps: - name: Check out code from GitHub uses: actions/checkout@v4.2.2 - - name: Set up Python ${{ needs.prepare.outputs.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.6.0 id: python with: - python-version: ${{ needs.prepare.outputs.python-version }} + python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v4.2.3 with: path: venv - key: | - ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version - }}-${{ hashFiles('pyproject.toml') }} + key: > + ${{ runner.os }}-venv-${{ matrix.python-version }}- + ${{ hashFiles('pyproject.toml') }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -187,9 +199,9 @@ jobs: uses: actions/cache@v4.2.3 with: path: ${{ env.PRE_COMMIT_CACHE }} - key: | - ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') - }} + key: > + ${{ runner.os }}-pre-commit-${{ matrix.python-version }}- + ${{ hashFiles('.pre-commit-config.yaml') }} - name: Fail job if cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -249,23 +261,26 @@ jobs: pytest: runs-on: ubuntu-latest needs: prepare - name: Run tests Python ${{ needs.prepare.outputs.python-version }} + strategy: + matrix: + python-version: ["3.12", "3.13"] + name: Run tests Python ${{ matrix.python-version }} steps: - name: Check out code from GitHub uses: actions/checkout@v4.2.2 - - name: Set up Python ${{ needs.prepare.outputs.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.6.0 id: python with: - python-version: ${{ needs.prepare.outputs.python-version }} + python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v4.2.3 with: path: venv - key: | - ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version - }}-${{ hashFiles('pyproject.toml') }} + key: > + ${{ runner.os }}-venv-${{ matrix.python-version }}- + ${{ hashFiles('pyproject.toml') }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -304,26 +319,26 @@ jobs: steps: - name: Check out code from GitHub uses: actions/checkout@v4.2.2 - - name: Set up Python ${{ needs.prepare.outputs.python-version }} + - name: Set up Python ${{ env.DEFAULT_PYTHON }} uses: actions/setup-python@v5.6.0 id: python with: - python-version: ${{ needs.prepare.outputs.python-version }} + python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v4.2.3 with: path: venv - key: | - ${{ runner.os }}-venv-${{ needs.prepare.outputs.python-version - }}-${{ hashFiles('pyproject.toml') }} + key: > + ${{ runner.os }}-venv-${{ env.DEFAULT_PYTHON }}- + ${{ hashFiles('pyproject.toml') }} - name: Fail job if Python cache restore failed if: steps.cache-venv.outputs.cache-hit != 'true' run: | echo "Failed to restore Python virtual environment from cache" exit 1 - name: Download all coverage artifacts - uses: actions/download-artifact@v4.1.8 + uses: actions/download-artifact@v5.0.0 - name: Combine coverage results run: | . venv/bin/activate