[pre-commit.ci] pre-commit autoupdate (#280) #643
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
| # https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Python tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: ["*"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PIP_ROOT_USER_ACTION: ignore | |
| COLUMNS: "200" | |
| FORCE_COLOR: "1" | |
| jobs: | |
| get-environments: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| envs: ${{ steps.get-envs.outputs.envs }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: { filter: "blob:none", fetch-depth: 0 } | |
| - uses: astral-sh/[email protected] | |
| with: { enable-cache: false } | |
| - id: get-envs | |
| run: | | |
| ENVS_JSON=$(NO_COLOR=1 uvx hatch env show --json | jq -c 'to_entries | |
| | map( | |
| select(.key | startswith("hatch-test")) | |
| | { name: .key, python: .value.python } | |
| )') | |
| echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT | |
| test: | |
| needs: get-environments | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # for codecov OIDC | |
| strategy: | |
| matrix: | |
| env: ${{ fromJSON(needs.get-environments.outputs.envs) }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: { fetch-depth: 0, filter: "blob:none" } | |
| - uses: astral-sh/[email protected] | |
| with: | |
| python-version: ${{ matrix.env.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| uv tool install hatch | |
| hatch -v env create ${{ matrix.env.name }} | |
| - name: Run tests | |
| run: | | |
| hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto --junitxml=test-data/test-results.xml | |
| hatch run ${{ matrix.env.name }}:cov-combine | |
| hatch run ${{ matrix.env.name }}:coverage xml | |
| hatch run ${{ matrix.env.name }}:cov-report | |
| - name: upload coverage | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| use_oidc: true | |
| flags: ${{ matrix.env.name }} | |
| fail_ci_if_error: true | |
| - name: Upload test results | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| report_type: test_results | |
| use_oidc: true | |
| flags: ${{ matrix.env.name }} | |
| fail_ci_if_error: true | |
| check: | |
| if: always() | |
| needs: | |
| - get-environments | |
| - test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |