-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathazure-pipelines.yml
276 lines (240 loc) · 9.38 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# Trigger a build when there is a push to the main branch or a tag starts with release-
trigger:
branches:
include:
- main
tags:
include:
- release-*
# Trigger a build when there is a pull request to the main branch
# Ignore PRs that are just updating the docs
pr:
branches:
include:
- main
exclude:
- doc/*
- README.rst
# Trigger a run on main at 00:00 (midnight) UTC every day
# Run even if there are no code changes
schedules:
- cron: "0 0 * * *"
displayName: "Nightly Test Runs"
always: true
branches:
include:
- main
parameters:
- name: matrix
displayName: Pool Image and Python Version Matrix
type: object
default:
mac_py310:
imageName: 'macOS-latest'
python.version: '3.10'
linux_py310:
imageName: 'ubuntu-latest'
python.version: '3.10'
# windows_py310:
# imageName: 'windows-latest'
# python.version: '3.10'
mac_py311:
imageName: 'macOS-latest'
python.version: '3.11'
linux_py311:
imageName: 'ubuntu-latest'
python.version: '3.11'
# windows_py311:
# imageName: 'windows-latest'
# python.version: '3.11'
mac_py312:
imageName: 'macOS-latest'
python.version: '3.12'
linux_py312:
imageName: 'ubuntu-latest'
python.version: '3.12'
# windows_py312:
# imageName: 'windows-latest'
# python.version: '3.12'
variables:
triggeredByPullRequest: $[eq(variables['Build.Reason'], 'PullRequest')]
stages:
- stage: RunAllTests
displayName: Run python test suite
jobs:
- job: run_tests
strategy:
matrix: ${{ parameters.matrix }}
pool:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
echo "##vso[task.setvariable variable=PIP_CACHE_DIR]$(pip cache dir)"
displayName: 'Set PIP_CACHE_DIR'
- task: Cache@2
inputs:
key: 'pip | "$(Build.SourcesDirectory)/test-requirements.txt" | "$(Build.SourcesDirectory)/setup.cfg"'
restoreKeys: |
pip |
path: $(PIP_CACHE_DIR)
displayName: 'Cache pip dependencies'
- script: |
python -m pip install --upgrade pip setuptools wheel
displayName: 'Upgrade pip'
- script: |
pip install -r test-requirements.txt
displayName: 'Install pip dependencies'
- script: |
pip install -e .
displayName: 'Install local package'
# # Debugging import datashader
# - script: |
# echo "Installed packages:"
# pip list
# echo "Dask information:"
# python -c "import dask; print('Dask version:', dask.__version__)"
# python -c "import dask.dataframe; print('Dask DataFrame path:', dask.dataframe.__file__)"
# echo "Datashader information:"
# python -c "import datashader; print('Datashader version:', datashader.__version__)"
# displayName: 'Debug dependency versions'
- script: |
export CI=true
mkdir -p $(Build.ArtifactStagingDirectory)/mpl
pytest datamapplot/tests --mpl --show-capture=no --disable-warnings \
--cov=datamapplot/ --cov-report=html \
--mpl-generate-summary=html \
--mpl-results-path=$(Build.ArtifactStagingDirectory)/mpl
displayName: 'Run python tests'
- script: |
echo "Listing contents of $(Build.ArtifactStagingDirectory)/mpl:"
ls -la $(Build.ArtifactStagingDirectory)/mpl
displayName: 'List contents of $(Build.ArtifactStagingDirectory)/mpl'
condition: ne(variables['Agent.OS'], 'Windows_NT')
# - bash: |
# coveralls
# displayName: 'Publish to coveralls'
# condition: and(succeeded(), eq(variables.triggeredByPullRequest, false)) # Don't run this for PRs because they can't access pipeline secrets
# env:
# COVERALLS_REPO_TOKEN: $(COVERALLS_TOKEN)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)/mpl
artifactName: 'mpl-test-results-$(Build.BuildId)-$(Agent.OS)-py$(python.version)'
displayName: 'Publish MPL Test Artifacts'
condition: always()
- script: |
echo "Listing contents of html dir:"
ls -la $(Build.SourcesDirectory)/datamapplot/tests/html
displayName: 'List contents of html dir'
condition: ne(variables['Agent.OS'], 'Windows_NT')
- script: |
python -m http.server 8000 -d $(Build.SourcesDirectory)/datamapplot/tests/html &
displayName: 'Start HTTP server (Unix)'
condition: ne(variables['Agent.OS'], 'Windows_NT')
- powershell: |
$serverJob = Start-Process python -ArgumentList "-m", "http.server", "8000", "-d", "$env:BUILD_SOURCESDIRECTORY\datamapplot\tests\html" -PassThru -NoNewWindow
Start-Sleep -Seconds 5
$retry = 0
do {
try {
$response = Invoke-WebRequest -Uri "http://localhost:8000" -Method Head
Write-Host "Server started successfully"
break
} catch {
Write-Host "Waiting for server to start... Attempt $retry"
Start-Sleep -Seconds 2
$retry++
}
} while ($retry -lt 5)
if ($retry -eq 5) {
Write-Error "Server failed to start after multiple attempts"
exit 1
}
displayName: 'Start HTTP server (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- task: NodeTool@0
inputs:
versionSpec: '22'
displayName: 'Use Node.js for frontend tests'
- script: |
npm ci
displayName: 'Install npm dependencies'
workingDirectory: '$(Build.SourcesDirectory)/datamapplot/interactive_tests'
- script: |
npx playwright install --with-deps
displayName: 'Install Playwright browsers'
workingDirectory: '$(Build.SourcesDirectory)/datamapplot/interactive_tests'
- script: |
if [[ "$(Build.Reason)" == "PullRequest" ]]; then
npx playwright test --grep-invert @slow
else
npx playwright test
fi
displayName: 'Run Playwright tests'
workingDirectory: '$(Build.SourcesDirectory)/datamapplot/interactive_tests'
env:
CI: 'true'
- task: PublishTestResults@2
displayName: 'Publish frontest test results'
inputs:
searchFolder: 'test-results'
testResultsFormat: 'JUnit'
testResultsFiles: 'e2e-junit-results.xml'
mergeTestResults: true
failTaskOnFailedTests: true
testRunTitle: 'Playwright Test Results-$(Agent.OS)-py$(python.version)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.SourcesDirectory)/datamapplot/interactive_tests/playwright-report'
artifactName: 'playwright-report-$(Build.BuildId)-$(Agent.OS)-py$(python.version)'
displayName: 'Publish Playwright Test Report'
condition: succeededOrFailed()
- stage: BuildPublishArtifact
dependsOn:
- RunAllTests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/release-'), eq(variables.triggeredByPullRequest, false))
jobs:
- job: BuildArtifacts
displayName: Build source dists and wheels
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
displayName: 'Use Python 3.10'
- script: |
python -m pip install --upgrade pip
pip install wheel
displayName: 'Install dependencies'
- script: |
pip install -e .
displayName: 'Install package locally'
- script: |
python setup.py sdist bdist_wheel
displayName: 'Build package'
- bash: |
export PACKAGE_VERSION="$(python setup.py --version)"
echo "Package Version: ${PACKAGE_VERSION}"
echo "##vso[task.setvariable variable=packageVersionFormatted;]release-${PACKAGE_VERSION}"
displayName: 'Get package version'
- script: |
echo "Version in git tag $(Build.SourceBranchName) does not match version derived from setup.py $(packageVersionFormatted)"
exit 1
displayName: Raise error if version doesnt match tag
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))
- task: DownloadSecureFile@1
name: PYPIRC_CONFIG
displayName: 'Download pypirc'
inputs:
secureFile: 'pypirc'
- script: |
pip install twine
twine upload --repository pypi --config-file $(PYPIRC_CONFIG.secureFilePath) dist/*
displayName: 'Upload to PyPI'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))