Skip to content

[pre-commit.ci] pre-commit autoupdate (#240) #549

[pre-commit.ci] pre-commit autoupdate (#240)

[pre-commit.ci] pre-commit autoupdate (#240) #549

Workflow file for this run

# 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@v5
with: { filter: "blob:none", fetch-depth: 0 }
- uses: astral-sh/setup-uv@v7
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
strategy:
matrix:
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
steps:
- uses: actions/checkout@v5
with: { fetch-depth: 0, filter: "blob:none" }
- uses: astral-sh/setup-uv@v7
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
- name: upload coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
token: c66a2830-d3c7-4ae7-a230-21aef89dcf65
flags: ${{ matrix.env.name }}
fail_ci_if_error: true
- name: Upload test results
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: c66a2830-d3c7-4ae7-a230-21aef89dcf65
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) }}