Repository navigation
136 lines (124 loc) · 4.15 KB
/
Copy pathci.yml
File metadata and controls
136 lines (124 loc) · 4.15 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
name: CI
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
pull_request:
env:
PYTEST_ADDOPTS: "-v --color=yes -n auto --internet-tests --junitxml=test-data/test-results.xml"
FORCE_COLOR: "1"
MPLBACKEND: agg
# ubuntu-26.04’s system Python is 3.14.4, whose incremental GC (reverted in 3.14.5) lets garbage pile up until the runner OOMs
UV_PYTHON_PREFERENCE: only-managed
# It’s impossible to ignore SyntaxWarnings for a single module,
# so because leidenalg 0.10.0 has them, we pre-compile things: https://github.com/vtraag/leidenalg/issues/173
UV_COMPILE_BYTECODE: "1"
permissions:
contents: read
jobs:
get-environments:
runs-on: ubuntu-latest
outputs:
envs: ${{ steps.get-envs.outputs.envs }}
steps:
- &clone
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
filter: blob:none
persist-credentials: false
- &setup-uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
- 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,
"test-type": (if (.key | test("pre|low-vers")) then "coverage" else null end),
python: .value.python
}
)')
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
test:
needs: get-environments
runs-on: ubuntu-latest
strategy:
matrix:
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
permissions:
id-token: write # for codecov OIDC
env:
UV_PYTHON: ${{ matrix.env.python }}
steps:
- *clone
- *setup-uv
- name: Cache downloaded data
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .pytest_cache/d/scanpy-data
key: pytest
- name: Install dependencies
run: |
echo "::group::Install hatch"
uv tool install hatch
echo "::endgroup::"
echo "::group::Create environment"
hatch -v env create ${{ matrix.env.name }}
echo "::endgroup::"
hatch run ${{ matrix.env.name }}:session-info scanpy anndata
- name: Run tests
if: matrix.env.test-type == null
run: hatch run ${{ matrix.env.name }}:run
- name: Run tests (coverage)
if: matrix.env.test-type == 'coverage'
run: |
hatch run ${{ matrix.env.name }}:run-cov
hatch run ${{ matrix.env.name }}:cov-combine
hatch run ${{ matrix.env.name }}:coverage xml
hatch run ${{ matrix.env.name }}:cov-report
- name: Upload coverage data
if: ${{ !cancelled() && matrix.env.test-type == 'coverage' }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
flags: ${{ matrix.env.name }}
files: test-data/coverage.xml
use_oidc: true
fail_ci_if_error: true
- name: Upload test results
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
report_type: test_results
flags: ${{ matrix.env.name }}
files: test-data/test-results.xml
use_oidc: true
fail_ci_if_error: true
- name: Publish debug artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: debug-data-${{ matrix.env.name }}
path: .pytest_cache/d/debug
build:
runs-on: ubuntu-latest
steps:
- *clone
- *setup-uv
- run: uvx --from build pyproject-build --sdist --wheel .
- run: uvx twine check dist/*
check:
if: always()
needs:
- get-environments
- test
- build
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0
with:
jobs: ${{ toJSON(needs) }}