diff --git a/.github/workflows/python-ci.yaml b/.github/workflows/python-ci.yaml index 0c64536..9bedb68 100644 --- a/.github/workflows/python-ci.yaml +++ b/.github/workflows/python-ci.yaml @@ -11,7 +11,7 @@ permissions: id-token: write jobs: - lint-test: + lint: runs-on: ubuntu-latest steps: - name: Checkout repository @@ -45,17 +45,72 @@ jobs: - name: Run mypy run: uv run mypy --strict src/ tests/ - - name: Run tests + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + persist-credentials: false + + - name: Install uv + uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 + with: + enable-cache: true + resolution-strategy: "lowest" + + - name: Setup Python + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Sync dependencies + run: uv sync --group dev --group tests + + - name: Run tests with coverage run: uv run python -m coverage run -m pytest -v --junitxml=junit.xml - name: Create coverage report - run: uv run coverage xml + run: uv run coverage xml -o coverage.xml - - name: Upload coverage reports to Codecov + - name: Upload coverage reports + if: ${{ !cancelled() }} + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: coverage-py${{ matrix.python-version }} + path: | + coverage.xml + junit.xml + if-no-files-found: error + + codecov: + runs-on: ubuntu-latest + needs: [test] + if: ${{ always() }} + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + persist-credentials: false + + - name: Download coverage reports + if: ${{ !cancelled() }} + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: coverage-py3.14 + path: coverage + + - name: Upload coverage to Codecov + if: ${{ !cancelled() }} uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 with: report_type: coverage use_oidc: true + files: coverage/coverage.xml - name: Upload test results to Codecov if: ${{ !cancelled() }} @@ -63,3 +118,4 @@ jobs: with: report_type: test_results use_oidc: true + files: coverage/junit.xml