Skip to content

Commit 75a007d

Browse files
authored
Backport PR #1906: (fix): Accelerate tests: migrate to Github Actions… (#1910)
* Backport PR #1906: (fix): Accelerate tests: migrate to Github Actions, remove slow param, parallelize * (fix): correct min versions * (fix): notebooks
1 parent d0f765f commit 75a007d

10 files changed

Lines changed: 162 additions & 164 deletions

File tree

.azure-pipelines.yml

Lines changed: 0 additions & 129 deletions
This file was deleted.

.github/workflows/benchmark.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ on:
66
pull_request:
77
branches: [main]
88

9+
env:
10+
FORCE_COLOR: "1"
11+
12+
defaults:
13+
run:
14+
shell: bash -el {0}
15+
916
jobs:
1017
benchmark:
1118
runs-on: ${{ matrix.os }}
12-
defaults:
13-
run:
14-
shell: bash -el {0} # -e to fail on error, -l for mamba
1519

1620
strategy:
1721
fail-fast: false

.github/workflows/codespell.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v4
21-
- name: Codespell
22-
uses: codespell-project/actions-codespell@v2
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
filter: blob:none
23+
- uses: codespell-project/actions-codespell@v2

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
id-token: write # to authenticate as Trusted Publisher to pypi.org
1313
steps:
1414
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
filter: blob:none
1518
- uses: actions/setup-python@v5
1619
with:
1720
python-version: "3.x"

.github/workflows/test-cpu.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "*.*.x"
8+
pull_request:
9+
10+
env:
11+
PYTEST_ADDOPTS: "-v --color=yes"
12+
FORCE_COLOR: "1"
13+
14+
defaults:
15+
run:
16+
shell: bash -el {0}
17+
18+
# Cancel the job if new commits are pushed
19+
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
pytest:
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
include:
30+
- python-version: '3.12'
31+
test-type: coverage
32+
- python-version: '3.10'
33+
test-type: standard
34+
- python-version: '3.12'
35+
dependencies-version: pre-release
36+
test-type: strict-warning
37+
- python-version: '3.10'
38+
dependencies-version: minimum
39+
test-type: coverage
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
filter: blob:none
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Install UV
52+
uses: astral-sh/setup-uv@v5
53+
with:
54+
enable-cache: true
55+
cache-dependency-glob: pyproject.toml
56+
57+
- name: Install dependencies
58+
if: matrix.dependencies-version == null
59+
run: uv pip install --system --compile "anndata[dev,test] @ ." -c ci/constraints.txt
60+
61+
- name: Install minimum dependencies
62+
if: matrix.dependencies-version == 'minimum'
63+
run: |
64+
uv pip install --system --compile tomli packaging
65+
66+
deps=$(python3 ci/scripts/min-deps.py pyproject.toml --extra dev test)
67+
uv pip install --system --compile $deps "anndata @ ."
68+
69+
- name: Install dependencies release candidates
70+
if: matrix.dependencies-version == 'pre-release'
71+
run: uv pip install -v --system --compile --pre "anndata[dev,test] @ ." -c ci/constraints.txt
72+
73+
- name: Display installed versions
74+
run: uv pip list
75+
76+
- name: Run Pytest
77+
if: matrix.test-type == 'standard'
78+
run: pytest -n auto
79+
80+
- name: Run Pytest (coverage)
81+
if: matrix.test-type == 'coverage'
82+
run: coverage run -m pytest -n auto --cov --cov-report=xml
83+
84+
- name: Run Pytest (treat warnings as errors)
85+
if: matrix.test-type == 'strict-warning'
86+
run: pytest --strict-warnings -n auto
87+
88+
- uses: codecov/codecov-action@v4
89+
if: matrix.test-type == 'coverage'
90+
with:
91+
token: ${{ secrets.CODECOV_TOKEN }}
92+
fail_ci_if_error: true
93+
files: test-data/coverage.xml
94+
95+
check-build:
96+
runs-on: ubuntu-22.04
97+
steps:
98+
- uses: actions/checkout@v4
99+
with:
100+
fetch-depth: 0
101+
filter: blob:none
102+
103+
- name: Set up Python 3.12
104+
uses: actions/setup-python@v5
105+
with:
106+
python-version: '3.12'
107+
108+
- name: Install build tools and requirements
109+
run: |
110+
python -m pip install --upgrade pip
111+
pip install build twine
112+
113+
- name: Display installed versions
114+
run: pip list
115+
116+
- name: Build & Twine check
117+
run: |
118+
python -m build --sdist --wheel .
119+
twine check dist/*
120+
121+
- name: Check runtime version
122+
run: |
123+
pip install dist/*.whl
124+
python -c 'import anndata; print(anndata.__version__)'

.github/workflows/test-gpu.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ on:
99
- opened
1010
- synchronize
1111

12+
env:
13+
PYTEST_ADDOPTS: "-v --color=yes"
14+
FORCE_COLOR: "1"
15+
16+
defaults:
17+
run:
18+
shell: bash -el {0}
19+
1220
# Cancel the job if new commits are pushed
1321
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
1422
concurrency:
@@ -39,14 +47,11 @@ jobs:
3947
# At time of writing, a typical run takes about 5 minutes
4048
timeout-minutes: 30
4149

42-
defaults:
43-
run:
44-
shell: bash -el {0}
45-
4650
steps:
4751
- uses: actions/checkout@v4
4852
with:
4953
fetch-depth: 0
54+
filter: blob:none
5055

5156
- name: Nvidia SMI sanity check
5257
run: nvidia-smi
@@ -67,9 +72,10 @@ jobs:
6772
python-version: ${{ env.max_python_version }}
6873

6974
- name: Install UV
70-
uses: hynek/setup-cached-uv@v2
75+
uses: astral-sh/setup-uv@v5
7176
with:
72-
cache-dependency-path: pyproject.toml
77+
enable-cache: true
78+
cache-dependency-glob: pyproject.toml
7379

7480
- name: Install AnnData
7581
run: uv pip install --system -e ".[dev,test,cu12]" -c ci/constraints.txt
@@ -78,13 +84,13 @@ jobs:
7884
run: pip list
7985

8086
- name: Run test
81-
run: pytest -m gpu --cov --cov-report=xml --cov-context=test
87+
run: coverage run -m pytest -m gpu -n auto --cov --cov-report=xml
8288

8389
- uses: codecov/codecov-action@v4
8490
with:
8591
token: ${{ secrets.CODECOV_TOKEN }}
8692
fail_ci_if_error: true
87-
verbose: true
93+
files: test-data/coverage.xml
8894

8995
- name: Remove 'run-gpu-ci' Label
9096
if: always()

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test = [
102102
"pytest-mock",
103103
"anndata[dask]",
104104
]
105-
dev-test = [ "pytest-xdist" ] # local test speedups
105+
dev-test = [ "pytest-xdist[psutil]" ] # local test speedups
106106
gpu = [ "cupy" ]
107107
cu12 = [ "cupy-cuda12x" ]
108108
cu11 = [ "cupy-cuda11x" ]
@@ -120,6 +120,9 @@ packages = [ "src/anndata", "src/testing" ]
120120
data_file = "test-data/coverage"
121121
source_pkgs = [ "anndata" ]
122122
omit = [ "src/anndata/_version.py", "**/test_*.py" ]
123+
concurrency = [ "multiprocessing" ]
124+
parallel = "true"
125+
123126
[tool.coverage.xml]
124127
output = "test-data/coverage.xml"
125128
[tool.coverage.paths]
@@ -139,8 +142,8 @@ addopts = [
139142
"-ptesting.anndata._pytest",
140143
]
141144
filterwarnings = [
142-
# all `ignore::anndata.*` entries are in `conftest.py`
143-
# See: https://github.com/pytest-dev/pytest-cov/issues/437
145+
"ignore::anndata._warnings.OldFormatWarning",
146+
"ignore::anndata._warnings.ExperimentalFeatureWarning",
144147
]
145148
# When `--strict-warnings` is used, all warnings are treated as errors, except those:
146149
filterwarnings_when_strict = [

src/anndata/tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)