forked from pyvista/pyvista
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
337 lines (298 loc) · 10.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
variables:
ALLOW_PLOTTING: true
jobs:
# DESCRIPTION: Quickly check the spelling and documentation style
- job: CodeSpellStyle
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: |
pip install codespell pydocstyle
make doctest
displayName: 'Run doctest'
# DESCRIPTION: Core API and doc string testing for Linux
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
variables:
DISPLAY: ':99.0'
PYVISTA_OFF_SCREEN: 'True'
strategy:
matrix:
Python35:
python.version: '3.5'
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 install -e .
displayName: Install pyvista
- script: |
.ci/setup_headless_display.sh
# python .ci/pyvista_test.py
displayName: Install headless display
- script: |
sudo apt-get install python3-tk
pip install -r requirements_test.txt
# python -c "import vtk; print(vtk.VTK_VERSION)"
python -c "import pyvista; print(pyvista.Report())"
which python
pip list
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 cache
- script: |
pip install pytest-azurepipelines
pytest -v --cov pyvista --cov-report html
displayName: 'Test Core API'
- script: |
pip install pytest pytest-azurepipelines
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*.gz
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/"
# DESCRIPTION: Core API testing for Windows
- job: Windows
pool:
vmIMage: 'VS2017-Win2016'
variables:
AZURE_CI_WINDOWS: 'true'
strategy:
maxParallel: 4
matrix:
Python35-64bit:
PYTHON_VERSION: '3.5'
PYTHON_ARCH: 'x64'
Python36-64bit:
PYTHON_VERSION: '3.6'
PYTHON_ARCH: 'x64'
Python37-64bit:
PYTHON_VERSION: '3.7'
PYTHON_ARCH: 'x64'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
architecture: $(PYTHON_ARCH)
addToPath: true
- 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'
- powershell: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:ErrorAction']='Stop'
pip install -r requirements_test.txt
displayName: 'Install dependencies with pip'
- script: |
python setup.py sdist
python setup.py install
python -c "import pyvista; print(pyvista.Report())"
displayName: 'Install PyVista'
- script: |
python -m pytest --cov -v .
displayName: 'Run Tests'
# DESCRIPTION: Core API testing for MacOS
- job: macOS
variables:
python.architecture: 'x64'
strategy:
matrix:
# Skipping Python 3.5: doesn't have great support on Azure
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
pool:
vmImage: 'macOS-10.14'
steps:
- script: .ci/macos-install-python.sh '$(python.version)'
displayName: Install Python
- script: |
python setup.py sdist
python setup.py install
python -c "import pyvista; print(pyvista.Report())"
displayName: 'Install PyVista'
- 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 cache
- script: |
python -m pip install -r requirements_test.txt
python -m pip install pytest-azurepipelines
python -m pytest -v --cov pyvista --cov-report html
displayName: 'Run Tests'
# Builds the documentation
- job: BuildDocumentation
pool:
vmImage: 'ubuntu-16.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 cache
- script: |
make -C docs html
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 .
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 .
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'))