forked from fastai/fastai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
374 lines (312 loc) · 12.2 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
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=vsts
# Capabilities and limitations:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=vsts&tabs=yaml#capabilities-and-limitations
# - Provide at least 10 GB of storage for your source and build outputs.
# - Can run jobs for up to 360 minutes (6 hours).
# Notes on pipeline definitions:
#
# the number after @ in task definition indicates the azure internal version of the specific task, e.g:
# - task: CondaEnvironment@1
# means use azure's CondaEnvironment's version 1, so need to check the docs for each specific task's desired (usually latest) version. If later 1.2 is released then use:
# - task: [email protected]
# instead
#
# job name must match r'\w+' (no '-', but '_' ok)
#
# Build environments: Available vmImage values: 'Ubuntu-16.04', 'macOS-10.13', 'VS2017-Win2016'
#
jobs:
################
### Linux CI ###
################
- job: 'Linux_PyPI'
pool:
vmImage: 'Ubuntu-16.04'
# Run the pipeline with multiple Python versions
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
# Increase the maxParallel value to simultaneously run the job for all versions in the matrix (max 10 for free open-source)
maxParallel: 4
steps:
# Set the UsePythonVersion task to reference the matrix variable for its Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
# Install dependencies and fastai git HEAD or PR
- script: |
python -m pip install --upgrade pip && pip3 install --upgrade setuptools
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# test that we can install fastai package (and torchvision)
pip install fastai
pip uninstall -y fastai
# install editable fastai, which tests the HEAD or PR
pip install -e .[dev]
displayName: 'Upgrade pip/setuptools. Install deps, pytorch and fastai'
continueOnError: false
# Install Test deps
- script: |
pip install pytest pytest-runner
displayName: 'Install test deps'
continueOnError: false
# Run Tests
- script: |
py.test tests --cache-clear --junitxml=result.xml
displayName: 'Run tests'
continueOnError: false
# Publish test results to the Azure DevOps server
- task: PublishTestResults@2
inputs:
testResultsFiles: 'result.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
# Jupyter Test
- script: |
# 1. test that we can run jupyter (have all the deps figured out)
# 2. that we can execute a fastai nb
jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to notebook examples/tabular.ipynb
# 3. check for expected in the output string and bail if it's not there.
echo "Testing expected output"
grep "Total time" examples/tabular.nbconvert.ipynb
# 4. test that python kernel is available
echo "Testing jupyter kernelspec list"
jupyter kernelspec list | grep python3
displayName: 'Run jupyter notebook tests'
continueOnError: false
- job: 'Linux_Conda'
pool:
vmImage: 'Ubuntu-16.04'
# Run the pipeline with multiple Python versions
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
# Increase the maxParallel value to simultaneously run the job for all versions in the matrix (max 10 for free open-source)
maxParallel: 4
steps:
# Set the UsePythonVersion task to reference the matrix variable for its Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
# XXX: should be fixed in 1.140 release https://github.com/Microsoft/vsts-tasks/issues/8299#issuecomment-427095427
- script: sudo install -d -m 0777 /usr/envs
displayName: Fix Conda permissions
# Conda setup environment.
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/conda-environment?view=vsts
#
- task: CondaEnvironment@0
inputs:
environmentName: 'fastai-cpu'
packageSpecs: 'python=$(python.version)'
# Install dependencies and fastai git HEAD or PR
- script: |
conda activate fastai-cpu
conda install -y conda
conda install -y pip setuptools
# pytorch + torchvision
conda install -y -c pytorch pytorch-nightly-cpu
conda install -y -c fastai torchvision-nightly-cpu
# test that we can install fastai package
conda install -y -c fastai fastai
conda uninstall -y fastai
# install editable fastai, which tests the HEAD or PR
pip install -e .[dev]
displayName: 'Upgrade pip/conda/setuptools. Install deps, pytorch and fastai'
continueOnError: false
# Install Test deps
- script: |
conda install -y pytest pytest-runner
displayName: 'Install test deps'
continueOnError: false
# Run Tests
- script: |
py.test tests --cache-clear --junitxml=result.xml
displayName: 'Run tests'
continueOnError: false
# Publish test results to the Azure DevOps server
- task: PublishTestResults@2
inputs:
testResultsFiles: 'result.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
# Jupyter Test
- script: |
# 1. test that we can run jupyter (have all the deps figured out)
# 2. that we can execute a fastai nb
jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to notebook examples/tabular.ipynb
# 3. check for expected in the output string and bail if it's not there.
echo "Testing expected output"
grep "Total time" examples/tabular.nbconvert.ipynb
# 4. test that python kernel is available
echo "Testing jupyter kernelspec list"
jupyter kernelspec list | grep python3
displayName: 'Run jupyter notebook tests'
continueOnError: false
################
### MacOS CI ###
################
- job: MacOS_PyPI
pool:
vmImage: 'macOS-10.13'
# Run the pipeline with multiple Python versions
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
maxParallel: 4
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
# Install dependencies and fastai git HEAD or PR
- script: |
python -m pip install --upgrade pip && pip3 install --upgrade setuptools
pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# test that we can install fastai package (and torchvision)
pip install fastai
pip uninstall -y fastai
# install editable fastai, which tests the HEAD or PR
pip install -e .[dev]
# workaround for matplotlib bug on macOS: https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python
mkdir -p ~/.matplotlib
echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc
displayName: 'Upgrade pip and setuptools, install pytorch and fastai deps'
continueOnError: false
# Install Test deps
- script: |
pip install pytest pytest-runner
displayName: 'Install test deps'
continueOnError: false
# Run Tests
- script: |
py.test tests --cache-clear --junitxml=result.xml
displayName: 'Run tests'
continueOnError: false
# Publish test results to the Azure DevOps server
- task: PublishTestResults@2
inputs:
testResultsFiles: 'result.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
# Jupyter Test
- script: |
# 1. test that we can run jupyter (have all the deps figured out)
# 2. that we can execute a fastai nb
jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to notebook examples/tabular.ipynb
# 3. check for expected in the output string and bail if it's not there.
echo "Testing expected output"
grep "Total time" examples/tabular.nbconvert.ipynb
# 4. test that python kernel is available
echo "Testing jupyter kernelspec list"
jupyter kernelspec list | grep python3
displayName: 'Run jupyter notebook tests'
continueOnError: false
- job: 'MacOS_Conda'
pool:
vmImage: 'macOS-10.13'
# Run the pipeline with multiple Python versions
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
# Increase the maxParallel value to simultaneously run the job for all versions in the matrix (max 10 for free open-source)
maxParallel: 4
steps:
# Set the UsePythonVersion task to reference the matrix variable for its Python version
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: sudo install -d -m 0777 /usr/local/miniconda/envs/
displayName: Fix Conda permissions
# Conda setup environment.
# https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/conda-environment?view=vsts
#
- task: CondaEnvironment@0
inputs:
environmentName: 'fastai-cpu'
packageSpecs: 'python=$(python.version)'
# Install dependencies and fastai git HEAD or PR
- script: |
conda activate fastai-cpu
conda install -y conda
conda install -y pip setuptools
# pytorch + torchvision
conda install -y -c pytorch pytorch-nightly-cpu
conda install -y -c fastai torchvision-nightly-cpu
# test that we can install fastai package
conda install -y -c fastai fastai
conda uninstall -y fastai
# install editable fastai, which tests the HEAD or PR
pip install -e .[dev]
# workaround for matplotlib bug on macOS: https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python
mkdir -p ~/.matplotlib
echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc
displayName: 'Upgrade pip/conda/setuptools. Install deps, pytorch and fastai'
continueOnError: false
# Install Test deps
- script: |
conda install -y pytest pytest-runner
displayName: 'Install test deps'
continueOnError: false
# Run Tests
- script: |
py.test tests --cache-clear --junitxml=result.xml
displayName: 'Run tests'
continueOnError: false
# Publish test results to the Azure DevOps server
- task: PublishTestResults@2
inputs:
testResultsFiles: 'result.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
# Jupyter Test
- script: |
# 1. test that we can run jupyter (have all the deps figured out)
# 2. that we can execute a fastai nb
jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to notebook examples/tabular.ipynb
# 3. check for expected in the output string and bail if it's not there.
echo "Testing expected output"
grep "Total time" examples/tabular.nbconvert.ipynb
# 4. test that python kernel is available
echo "Testing jupyter kernelspec list"
jupyter kernelspec list | grep python3
displayName: 'Run jupyter notebook tests'
continueOnError: false
##################
### nbstripout ###
##################
- job: 'nbstripout_config'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'
# check that notebooks are stripped out. if they aren't that means the committer doesn't have the correct configuration for the stripout filter.
- script: |
echo "Check we are starting with clean git checkout"
if [ -n "$(git status -uno -s)" ]; then echo "git status is not clean"; false; fi
echo "Trying to strip out notebooks"
tools/fastai-nbstripout -d examples/*ipynb
echo "Check that strip out was unnecessary"
git status -s # display the status to see which nbs need cleaning up
if [ -n "$(git status -uno -s)" ]; then echo -e "!!! Detected unstripped out notebooks\n!!!Remember to run tools/run-after-git-clone"; false; fi
displayName: 'Detect unstripped out notebook commits'
continueOnError: false