Update README #629
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches-ignore: | |
| - dependabot/** | |
| - pre-commit-ci-update-config | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DEFAULT_PYTHON: '3.13' | |
| jobs: | |
| tests: | |
| name: Run ${{ matrix.mark}} tests (${{ matrix.python-version }} on ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| # run all the tests on latest Python version | |
| - os: ubuntu-latest | |
| mark: all | |
| python-version: '3.13' | |
| # run only minimal set of tests on other Python versions because it takes too much time | |
| - os: ubuntu-22.04 | |
| mark: important | |
| python-version: '3.7' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: "true" | |
| enable-cache: "false" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --group test | |
| - name: Run tests | |
| run: | | |
| mkdir -p reports/junit/ | |
| coverage run --parallel-mode -m pytest -n auto -m ${{ matrix.mark }} --junitxml=reports/junit/${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.mark }}.xml | |
| - name: Upload coverage results | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.mark }} | |
| path: reports/* | |
| # https://github.com/actions/upload-artifact/issues/602 | |
| include-hidden-files: true | |
| all_done: | |
| name: Tests done | |
| runs-on: ubuntu-latest | |
| needs: [tests] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download all coverage reports | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: reports/ | |
| pattern: coverage-* | |
| merge-multiple: true | |
| - name: Show test results | |
| uses: mikepenz/action-junit-report@v6 | |
| if: success() || failure() # always run even if the previous step fails | |
| with: | |
| report_paths: reports/junit/*.xml | |
| - name: Set up Python ${{ env.DEFAULT_PYTHON }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.DEFAULT_PYTHON }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: "false" | |
| - name: Combine coverage | |
| run: | | |
| uv run --group test coverage combine | |
| uv run --group test coverage xml -o reports/coverage.xml | |
| - name: Check coverage | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: ./reports | |
| fail_ci_if_error: true | |
| - name: All done | |
| run: echo 1 |