forked from scverse/scanpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.azure-pipelines.yml
137 lines (114 loc) · 3.79 KB
/
.azure-pipelines.yml
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
trigger:
- main
- "*.*.x"
variables:
python.version: '3.12'
PYTEST_ADDOPTS: '-v --color=yes --internet-tests --nunit-xml=test-data/test-results.xml'
TEST_EXTRA: 'test-full'
DEPENDENCIES_VERSION: "latest" # |"pre-release" | "minimum-version"
TEST_TYPE: "standard" # | "coverage"
jobs:
- job: PyTest
pool:
vmImage: 'ubuntu-22.04'
strategy:
matrix:
Python3.10:
python.version: '3.10'
Python3.12: {}
minimal_dependencies:
TEST_EXTRA: 'test-min'
anndata_dev:
DEPENDENCIES_VERSION: "pre-release"
TEST_TYPE: "coverage"
minimum_versions:
python.version: '3.10'
DEPENDENCIES_VERSION: "minimum-version"
TEST_TYPE: "coverage"
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade uv
echo "##vso[task.setvariable variable=uv_cache_dir]`uv cache dir`"
displayName: 'Install tools'
- task: Cache@2
inputs:
key: '"python $(python.version)" | "$(Agent.OS)" | pyproject.toml'
restoreKeys: |
"python" | "$(Agent.OS)"
"python"
path: $(uv_cache_dir)
displayName: Cache pip packages
- task: Cache@2
inputs:
key: '"pytest"'
restoreKeys: '"pytest"'
path: $(System.DefaultWorkingDirectory)/.pytest_cache/d
displayName: Cache pytest data
- script: |
export MPLBACKEND="agg"
echo $MPLBACKEND
displayName: 'Set env'
- script: uv pip install --system --compile 'scanpy[dev,$(TEST_EXTRA)] @ .'
displayName: 'Install dependencies'
condition: eq(variables['DEPENDENCIES_VERSION'], 'latest')
- script: >
uv pip install --system --compile --pre
"scanpy[dev,$(TEST_EXTRA)] @ ."
"anndata[dev,test] @ git+https://github.com/scverse/anndata"
displayName: 'Install dependencies release candidates'
condition: eq(variables['DEPENDENCIES_VERSION'], 'pre-release')
- script: |
uv pip install --system --compile tomli packaging
deps=`python3 ci/scripts/min-deps.py pyproject.toml --extra dev test`
uv pip install --system --compile $deps "scanpy @ ."
displayName: 'Install dependencies minimum version'
condition: eq(variables['DEPENDENCIES_VERSION'], 'minimum-version')
- script: pytest
displayName: 'PyTest'
condition: eq(variables['TEST_TYPE'], 'standard')
- script: |
pytest --cov --cov-report=xml --cov-context=test
displayName: 'PyTest (coverage)'
condition: eq(variables['TEST_TYPE'], 'coverage')
- task: PublishCodeCoverageResults@2
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: 'test-data/coverage.xml'
failIfCoverageEmpty: true
condition: eq(variables['TEST_TYPE'], 'coverage')
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: 'test-data/test-results.xml'
testResultsFormat: NUnit
testRunTitle: 'Publish test results for $(Agent.JobName)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '.pytest_cache/d/debug'
artifactName: debug-data
condition: eq(variables['TEST_TYPE'], 'coverage')
- script: bash <(curl -s https://codecov.io/bash)
displayName: 'Upload to codecov.io'
condition: eq(variables['TEST_TYPE'], 'coverage')
- job: CheckBuild
pool:
vmImage: 'ubuntu-22.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
displayName: 'Use Python 3.12'
- script: |
python -m pip install --upgrade pip
pip install build twine
displayName: 'Install build tools and requirements'
- script: pip list
displayName: 'Display installed versions'
- script: |
python -m build --sdist --wheel .
twine check dist/*
displayName: 'Build & Twine check'