forked from pyvista/pyvista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
414 lines (359 loc) · 12.4 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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
variables:
ALLOW_PLOTTING: true
SHELLOPTS: 'errexit:pipefail'
trigger:
branches:
include:
- '*'
exclude:
- '*no-ci*'
tags:
include:
- '*'
pr:
branches:
include:
- '*'
exclude:
- '*no-ci*'
jobs:
# DESCRIPTION: Quickly check the spelling and documentation style
- job: CodeSpellStyle
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: |
pip install -r requirements_style.txt
make doctest
displayName: 'Run doctest'
# DESCRIPTION: Core API and doc string testing for Linux
- job: Linux
pool:
vmImage: 'ubuntu-20.04'
variables:
DISPLAY: ':99.0'
PYVISTA_OFF_SCREEN: 'True'
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
PIP_CACHE_PATH=$(pip cache dir)
echo "##vso[task.setvariable variable=PIP_CACHE_PATH]$PIP_CACHE_PATH"
PYVISTA_VERSION=$(python -c "import io; exec(io.open('pyvista/_version.py').read()); print(__version__)")
echo "##vso[task.setvariable variable=PYVISTA_VERSION]$PYVISTA_VERSION"
displayName: 'Store pip cache path and pyvista version'
- task: Cache@2
inputs:
key: 'PIP_WHEEL_CACHE | $(Agent.OS) | "$(python.version)" | "$(PYVISTA_VERSION)"'
path: $(PIP_CACHE_PATH)
displayName: Cache pip
- script: |
pip install wheel
python setup.py bdist_wheel
pip install dist/pyvista*.whl
displayName: Build wheel and install pyvista
- script: |
.ci/setup_headless_display.sh
displayName: Install headless display
- script: |
sudo apt-get install python3-tk
pip install -r requirements_test.txt
python -c "import pyvista; print(pyvista.Report())"
which python
pip list
displayName: 'Install dependencies'
- script: |
pip install pytest-azurepipelines
pytest -v --cov pyvista --cov-report html
displayName: 'Test Core API'
- script: |
pytest -v --doctest-modules pyvista
displayName: 'Test Package Docstrings'
- script: |
bash <(curl -s https://codecov.io/bash)
displayName: 'Upload coverage to codecov.io'
condition: eq(variables['python.version'], '3.7')
- script: |
pip install twine
python setup.py sdist
twine upload --skip-existing dist/pyvista*
displayName: 'Upload to PyPi'
condition: and(eq(variables['python.version'], '3.7'), contains(variables['Build.SourceBranch'], 'refs/tags/'))
env:
TWINE_USERNAME: $(twine.username)
TWINE_PASSWORD: $(twine.password)
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
# don't run job on no-ci builds
condition: not(contains(variables['System.PullRequest.SourceBranch'], 'no-ci'))
# DESCRIPTION: Core API and doc string testing across VTK versions using conda
- job: LinuxConda
pool:
vmImage: 'ubuntu-20.04'
variables:
DISPLAY: ':99.0'
PYVISTA_OFF_SCREEN: 'True'
strategy:
matrix:
# VTKv81:
# VTK.VERSION: 8.1
VTKv82:
VTK.VERSION: 8.2
steps:
- script: |
.ci/setup_headless_display.sh
displayName: Install headless display
- script: |
export CONDA_ALWAYS_YES=1
source /usr/share/miniconda/etc/profile.d/conda.sh
conda config --add channels conda-forge
sed -i -e 's/- vtk$/- vtk=$(VTK.VERSION)/' environment.yml
conda env create --quiet -n pyvista-vtk$(VTK.VERSION) --file environment.yml
conda activate pyvista-vtk$(VTK.VERSION)
pip install -e .
conda list
which python
python -c "import pyvista; print(pyvista.Report(gpu=False))"
displayName: Create Anaconda environment
- script: |
source /usr/share/miniconda/etc/profile.d/conda.sh
conda activate pyvista-vtk$(VTK.VERSION)
pytest -v --ignore=tests/plotting
displayName: 'Test Core API'
- script: |
source /usr/share/miniconda/etc/profile.d/conda.sh
conda activate pyvista-vtk$(VTK.VERSION)
pytest -v tests/plotting --cov-report html
displayName: 'Test Core Plotting API'
- script: |
source /usr/share/miniconda/etc/profile.d/conda.sh
conda activate pyvista-vtk$(VTK.VERSION)
pytest -v --doctest-modules pyvista
displayName: 'Test Package Docstrings against VTK'
condition: not(contains(variables['System.PullRequest.SourceBranch'], 'no-ci'))
# DESCRIPTION: Core API testing for Windows
- job: Windows
pool:
vmIMage: 'windows-2019'
variables:
AZURE_CI_WINDOWS: 'true'
strategy:
maxParallel: 4
matrix:
Python36-64bit:
python.version: '3.6'
Python37-64bit:
python.version: '3.7'
Python38-64bit:
python.version: '3.8'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(python.version)
addToPath: true
- powershell: |
$PIP_CACHE_PATH = (pip cache dir) | Out-String
echo "##vso[task.setvariable variable=PIP_CACHE_PATH]$PIP_CACHE_PATH"
$PYVISTA_VERSION = $(python -c "import io; exec(io.open('pyvista/_version.py').read()); print(__version__)") | Out-String
echo "##vso[task.setvariable variable=PYVISTA_VERSION]$PYVISTA_VERSION"
displayName: 'Store pip cache path and pyvista version'
- powershell: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:ErrorAction']='Stop'
git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
displayName: 'Install OpenGL'
- script: |
pip install wheel
pip install .
python -c "import pyvista; print(pyvista.Report(gpu=False))"
displayName: 'Install PyVista'
- script: |
pip install -r requirements_test.txt
displayName: 'Install test dependencies'
- script: |
python -m pytest --cov -v .
displayName: 'Run Tests'
# don't run job on no-ci builds
condition: not(contains(variables['System.PullRequest.SourceBranch'], 'no-ci'))
# DESCRIPTION: Core API testing for MacOS
- job: macOS
variables:
python.architecture: 'x64'
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
Python38:
python.version: '3.8'
pool:
vmImage: 'macOS-10.15'
steps:
- script: .ci/macos-install-python.sh '$(python.version)'
displayName: Install Python
- script: |
python -m pip install wheel
python -m pip install -e .
python -c "import pyvista; print(pyvista.Report(gpu=False))"
displayName: 'Install PyVista'
- script: |
python -m pip install -r requirements_test.txt
python -m pip install pytest-azurepipelines
displayName: 'Install test dependencies'
- script: |
python -m pytest -v --cov pyvista --cov-report html --durations=0
displayName: 'Run Tests'
# don't run job on no-ci builds
condition: not(contains(variables['System.PullRequest.SourceBranch'], 'no-ci'))
# Builds the documentation
- job: BuildDocumentation
pool:
vmImage: 'ubuntu-20.04'
variables:
DISPLAY: ':99.0'
PYVISTA_OFF_SCREEN: 'True'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.7
displayName: 'Use Python 3.7'
- script: |
git config --global user.name ${GH_NAME}
git config --global user.email ${GH_EMAIL}
git config --list | grep user.
displayName: 'Configure git'
env:
GH_NAME: $(gh.name)
GH_EMAIL: $(gh.email)
- script: |
pip install -e .
displayName: Install pyvista
- script: |
.ci/setup_headless_display.sh
# python .ci/pyvista_test.py # for debug
displayName: Install headless display
- script: |
sudo apt-get install python3-tk
pip install -r requirements_docs.txt
displayName: 'Install dependencies'
- script: |
EXAMPLES_PATH=$(python -c "import pyvista; print(pyvista.EXAMPLES_PATH)")
mkdir -p EXAMPLES_PATH
echo "##vso[task.setvariable variable=EXAMPLES_PATH]$EXAMPLES_PATH"
PYVISTA_VERSION=$(python -c "import io; exec(io.open('pyvista/_version.py').read()); print(__version__)")
echo "##vso[task.setvariable variable=PYVISTA_VERSION]$PYVISTA_VERSION"
echo $EXAMPLES_PATH
displayName: 'Store location of pyvista downloads cache and version'
- task: Cache@2
inputs:
key: 'PYVISTA_EXAMPLES_CACHE | "$(PYVISTA_VERSION)"'
path: $(EXAMPLES_PATH)
displayName: Build pyvista examples directory cache
- task: Cache@2
inputs:
key: 'PYVISTA_DOC_EXAMPLES_CACHE | "$(PYVISTA_VERSION)"'
path: '$(Build.SourcesDirectory)/docs/examples'
displayName: Build pyvista doc examples cache
- script: |
make -C docs html -b coverage
cat docs/_build/coverage/python.txt
displayName: 'Build documentation'
- script: |
make -C docs doctest
displayName: 'Test documentation code snippets'
- script: |
make -C docs html
displayName: 'Update figures from doctest'
# Push example notebooks to pyvista-examples
- script: |
pip install cookiecutter
cookiecutter -f --no-input --config-file ./docs/pyvista-binder-config.yml -o .. https://github.com/pyvista/cookiecutter-pyvista-binder.git;
rm -rf ../pyvista-examples/notebooks/
cd docs
find examples -type f -name '*.ipynb' | cpio -p -d -v ../../pyvista-examples/
cd ../../pyvista-examples/
git init
git add .
git commit -am "Azure CI commit ref $(Build.SourceVersion)"
REMOTE="https://${GH_TOKEN}@github.com/pyvista/pyvista-examples"
git remote add origin ${REMOTE}
git push -uf origin master
cd $BUILD_SOURCESDIRECTORY
displayName: 'Upload binder examples'
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'))
env:
GH_TOKEN: $(gh.token)
# Push example notebooks to pyvista-examples develop branch
- script: |
pip install cookiecutter
cookiecutter -f --no-input --config-file ./docs/pyvista-binder-config.yml -o .. https://github.com/pyvista/cookiecutter-pyvista-binder.git;
rm -rf ../pyvista-examples/notebooks/
cd docs
find examples -type f -name '*.ipynb' | cpio -p -d -v ../../pyvista-examples/
cd ../../pyvista-examples/
git init
git checkout -b develop
git add .
git commit -am "Azure CI commit ref $(Build.SourceVersion)"
REMOTE="https://${GH_TOKEN}@github.com/pyvista/pyvista-examples"
git remote add origin ${REMOTE}
git push -uf origin develop
cd $BUILD_SOURCESDIRECTORY
displayName: 'Upload binder examples to develop'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
env:
GH_TOKEN: $(gh.token)
# upload documentation to pyvista-docs gh-pages on tags
- script: |
git clone --depth 1 https://${GH_TOKEN}@github.com/pyvista/pyvista-docs.git
cd pyvista-docs
git gc --prune=now
git remote prune origin
rm -rf *
cp -r $BUILD_SOURCESDIRECTORY/docs/_build/html/* .
cp $BUILD_SOURCESDIRECTORY/docs/README.md .
cp $BUILD_SOURCESDIRECTORY/docs/ads.txt .
touch .nojekyll
echo "docs.pyvista.org" >> CNAME
git add .
git commit -am "Azure CI commit ref $(Build.SourceVersion)"
git push
displayName: Upload Documentation to pyvista-docs
env:
GH_TOKEN: $(gh.token)
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'))
# upload documentation to pyvista-docs develop when merging with master
- script: |
mkdir pyvista-docs-dev
cd pyvista-docs-dev
git init
git checkout -b gh-pages
cp -r $BUILD_SOURCESDIRECTORY/docs/_build/html/* .
cp $BUILD_SOURCESDIRECTORY/docs/README.md .
cp $BUILD_SOURCESDIRECTORY/docs/ads.txt .
touch .nojekyll
echo "dev.pyvista.org" >> CNAME
git add .
REMOTE="https://${GH_TOKEN}@github.com/pyvista/pyvista-docs-dev"
git remote add origin ${REMOTE}
git commit -am "Azure CI commit ref $(Build.SourceVersion)"
git push -uf origin gh-pages
displayName: Upload Documentation to pyvista-docs-dev
env:
GH_TOKEN: $(gh.token)
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
# don't run job on no-ci builds
condition: not(contains(variables['System.PullRequest.SourceBranch'], 'no-ci'))