-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (70 loc) · 2.1 KB
/
test.yaml
File metadata and controls
78 lines (70 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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 'to_entries
| map(
select(.key | startswith("hatch-test"))
| {
env_name: .key,
name: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end),
python: .value.python
}
)')
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 python install ${{ matrix.python }}
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