Skip to content

feat(show): add xlabel/ylabel to control panel axis labels #1958

feat(show): add xlabel/ylabel to control panel axis labels

feat(show): add xlabel/ylabel to control panel axis labels #1958

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
permissions:
contents: read
jobs:
# Get the test environment from hatch as defined in pyproject.toml.
# This ensures that the pyproject.toml is the single point of truth for test definitions and the same tests are
# run locally and on continuous integration.
# Check [[tool.hatch.envs.hatch-test.matrix]] in pyproject.toml and https://hatch.pypa.io/latest/environment/ for
# more details.
get-environments:
runs-on: ubuntu-slim
outputs:
envs: ${{ steps.get-envs.outputs.envs }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
filter: blob:none
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Get test environments
id: get-envs
run: |
ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries
| map(
select(.key | startswith("hatch-test"))
| {
name: .key,
label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end),
python: .value.python
}
)')
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
# Run tests through hatch. Spawns a separate runner for each environment defined in the hatch matrix obtained above.
test:
needs: get-environments
permissions:
id-token: write # for codecov OIDC
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
name: ${{ matrix.env.label }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ contains(matrix.env.name, 'pre') }} # make "all-green" pass even if pre-release job fails
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
filter: blob:none
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: ${{ matrix.env.python }}
- name: Ensure figure directory exists
run: mkdir -p tests/figures
- name: Create hatch environment
run: uvx hatch env create ${{ matrix.env.name }}
- name: List all installed package versions
run: uvx hatch run ${{ matrix.env.name }}:uv pip list
- name: Run tests
env:
MPLBACKEND: agg
DISPLAY: ":42"
run: >-
uvx hatch run ${{ matrix.env.name }}:${{
matrix.env.name == 'hatch-test.py3.14-stable' && 'run-cov' || 'run'
}} -v --color=yes ${{
matrix.env.name == 'hatch-test.py3.14-stable' && ' ' || '-n auto'
}}
- name: Generate coverage report
if: matrix.env.name == 'hatch-test.py3.14-stable'
run: |
test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine
uvx hatch run ${{ matrix.env.name }}:cov-report
- name: Archive visual test figures
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: visual_test_results_${{ matrix.env.name }}
path: tests/figures/*
- name: Upload coverage
if: matrix.env.name == 'hatch-test.py3.14-stable'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
fail_ci_if_error: true
use_oidc: true
# Check that all tests defined above pass. This makes it easy to set a single "required" test in branch
# protection instead of having to update it frequently. See https://github.com/re-actors/alls-green#why.
check:
name: Tests pass in all hatch environments
if: always()
needs:
- get-environments
- test
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}