Skip to content

Commit bc9461a

Browse files
committed
simplify test.yml
1 parent f6b855c commit bc9461a

1 file changed

Lines changed: 26 additions & 37 deletions

File tree

.github/workflows/test.yml

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,29 @@ defaults:
2020
shell: bash -e {0} # -e to fail on error
2121

2222
jobs:
23-
get-environments:
24-
runs-on: ubuntu-latest
25-
outputs:
26-
envs: ${{ steps.get-envs.outputs.envs }}
27-
steps:
28-
- uses: actions/checkout@v4
29-
with:
30-
filter: blob:none
31-
fetch-depth: 0
32-
- uses: astral-sh/setup-uv@v5
33-
with:
34-
enable-cache: false
35-
- id: get-envs
36-
run: |
37-
ENVS_JSON=$(NO_COLOR=1 uvx hatch env show --json | jq -c 'to_entries
38-
| map(
39-
select(.key | startswith("hatch-test"))
40-
| {
41-
name: .key,
42-
"test-type": (if (.key | test("pre|min")) then "coverage" else null end),
43-
python: .value.python | sub("3[.]13"; "3.13.3"), # https://github.com/numba/numba/issues/10101
44-
}
45-
)')
46-
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
47-
4823
test:
49-
needs: get-environments
50-
runs-on: ubuntu-latest
24+
runs-on: ${{ matrix.os }}
5125
strategy:
26+
fail-fast: false
5227
matrix:
53-
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
28+
include:
29+
- name: hatch-test-py310
30+
os: ubuntu-latest
31+
python: "3.10"
32+
- name: hatch-test-py311
33+
os: ubuntu-latest
34+
python: "3.11"
35+
- name: hatch-test-py312
36+
os: ubuntu-latest
37+
python: "3.12"
38+
- name: hatch-test-py312-pre
39+
os: macos-latest
40+
python: "3.12"
41+
prerelease: "allow"
42+
test-type: coverage
5443
env: # environment variable for use in codecov's env_vars tagging
55-
ENV_NAME: ${{ matrix.env.name }}
44+
ENV_NAME: ${{ matrix.name }}
45+
UV_PRERELEASE: ${{ matrix.prerelease || 'disallow' }}
5646
steps:
5747
- uses: actions/checkout@v4
5848
with:
@@ -62,7 +52,7 @@ jobs:
6252
- uses: astral-sh/setup-uv@v5
6353
with:
6454
enable-cache: true
65-
python-version: ${{ matrix.env.python }}
55+
python-version: ${{ matrix.python }}
6656
cache-dependency-glob: pyproject.toml
6757

6858
- name: Cache downloaded data
@@ -75,22 +65,22 @@ jobs:
7565
run: uvx hatch -v env create ${{ matrix.env.name }}
7666

7767
- name: Run tests
78-
if: matrix.env.test-type == null
79-
run: uvx hatch run ${{ matrix.env.name }}:run
68+
if: matrix.test-type == null
69+
run: uvx hatch run ${{ matrix.name }}:run
8070
- name: Run tests (coverage)
81-
if: matrix.env.test-type == 'coverage'
82-
run: uvx hatch run ${{ matrix.env.name }}:run-cov --cov --cov-report=xml
71+
if: matrix.test-type == 'coverage'
72+
run: uvx hatch run ${{ matrix.name }}:run-cov --cov --cov-report=xml
8373

8474
- name: Archive figures generated during testing
8575
if: always()
8676
uses: actions/upload-artifact@v4
8777
with:
88-
name: visual_test_results_${{ matrix.env.name }}
78+
name: visual_test_results_${{ matrix.name }}
8979
path: /home/runner/work/squidpy/squidpy/tests/figures/*
9080

9181
- name: Upload coverage data
9282
uses: codecov/codecov-action@v5
93-
if: matrix.env.test-type == 'coverage'
83+
if: matrix.test-type == 'coverage'
9484
with:
9585
token: ${{ secrets.CODECOV_TOKEN }}
9686
env_vars: ENV_NAME
@@ -116,7 +106,6 @@ jobs:
116106
check:
117107
if: always()
118108
needs:
119-
- get-environments
120109
- test
121110
- build
122111
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)