-
Notifications
You must be signed in to change notification settings - Fork 191
145 lines (127 loc) · 4.48 KB
/
test-cpu.yml
File metadata and controls
145 lines (127 loc) · 4.48 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
pull_request:
env:
FORCE_COLOR: "1"
# Cancel the job if new commits are pushed: https://stackoverflow.com/q/66335225/247482
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
get-environments:
runs-on: ubuntu-latest
permissions: {}
outputs:
envs: ${{ steps.get-envs.outputs.envs }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
filter: blob:none
fetch-depth: 0
persist-credentials: false
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
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, args: (.value."extra-args" // [] | join(" ")) }
)')
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
test:
needs: get-environments
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
io_mark: ["zarr_io", "not zarr_io", "dask_distributed"] # dask_distributed should not be run with -n auto as it uses a client with processes
exclude:
- { env: { name: "hatch-test.array_api" }, io_mark: "dask_distributed" }
permissions:
id-token: write # for codecov OIDC
env: # environment variables for use in codecov’s env_vars tagging
ENV_NAME: ${{ matrix.env.name }}
IO_MARK: ${{ matrix.io_mark }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
filter: blob:none
persist-credentials: false
- name: Install system dependencies
run: sudo apt install -y hdf5-tools
- name: Install UV
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
enable-cache: true
python-version: ${{ matrix.env.python }}
- 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 ${{ matrix.io_mark != 'dask_distributed' && '-n auto' || '' }} --junitxml=test-data/test-results.xml -m "${{ matrix.env.name == 'hatch-test.array_api' && 'array_api and ' || '' }}${{ matrix.io_mark }}" ${{ matrix.env.args }}
hatch run ${{ matrix.env.name }}:cov-combine
hatch run ${{ matrix.env.name }}:coverage xml
hatch run ${{ matrix.env.name }}:cov-report
- name: Upload test results
if: ${{ !cancelled() }}
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
with:
report_type: test_results
env_vars: ENV_NAME,IO_MARK
files: test-data/test-results.xml
use_oidc: true
fail_ci_if_error: true
- name: Upload coverage data
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
with:
env_vars: ENV_NAME,IO_MARK
files: test-data/coverage.xml
use_oidc: true
fail_ci_if_error: true
build:
runs-on: ubuntu-24.04
permissions: {}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
filter: blob:none
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
cache: pip
- name: Install build tools and requirements
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Display installed versions
run: pip list
- name: Build & Twine check
run: |
python -m build --sdist --wheel .
twine check dist/*
check:
if: always()
needs:
- get-environments
- test
- build
permissions:
actions: read
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}