Skip to content

Update instance repo (PR 390 -- Get test matrix from hatch) #710

Update instance repo (PR 390 -- Get test matrix from hatch)

Update instance repo (PR 390 -- Get test matrix from hatch) #710

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 5 1,15 * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
# to fail on error in multiline statements (-e), in pipes (-o pipefail), and on unset variables (-u).
shell: bash -euo pipefail {0}
jobs:
get-environments:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-envs.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
filter: blob:none
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Get test environments
id: get-envs
run: |
MATRIX_JSON=$(uvx hatch env show --json | jq -c '[
keys[]
| select(startswith("hatch-test"))
| . as $env
| {
env_name: $env,
name: (if ($env | contains("pre")) then $env + " (PRE-RELEASE DEPENDENCIES)" else $env end)
}
]')
echo "matrix=${MATRIX_JSON}" | tee $GITHUB_OUTPUT
test:
needs: get-environments
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
include: ${{ fromJson(needs.get-environments.outputs.matrix) }}
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: pyproject.toml
- name: create hatch environment
run: uvx hatch env create ${{ matrix.env_name }}
- name: run tests using hatch
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: uvx hatch run ${{ matrix.env_name }}:run-cov
- name: generate coverage report
run: |
uvx hatch run ${{ matrix.env_name }}:coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v4