forked from fastai/fastai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
166 lines (136 loc) · 5.04 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
# 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).
# job name must match r'\w+' (no '-', but '_' ok)
jobs:
# Build environments: Available vmImage values: 'Ubuntu-16.04', 'macOS-10.13', 'VS2017-Win2016'
################
### 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
- 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
pip install -e .[dev]
displayName: 'Upgrade pip/setuptools. Install deps, pytorch and fastai'
continueOnError: false
# Test
- script: |
pip install pytest pytest-runner pytest-pspec
py.test tests tests/test_fastai.py
displayName: 'Run tests'
continueOnError: false
# # Publish test results to the Azure DevOps server
# - task: PublishTestResults@2
# inputs:
# testResultsFiles: '**/test-*.xml'
# testRunTitle: 'Python $(python.version)'
# condition: succeededOrFailed()
- 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
- 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
# fastai deps
conda install -y -c fastai fastai
conda uninstall -y fastai
# fastai
pip install -e .[dev]
displayName: 'Upgrade pip/conda/setuptools. Install deps, pytorch and fastai'
continueOnError: false
# Test - test with pytest, collect coverage metrics with pytest-cov, and publish these metrics to codecov.io
- script: |
conda install pytest pytest-runner
pip install pytest-pspec
py.test tests tests/test_fastai.py
displayName: 'Run 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
- 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
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
# Test
- script: |
pip install pytest pytest-runner pytest-pspec
py.test tests tests/test_fastai.py
displayName: 'Run tests'
continueOnError: false