-
Notifications
You must be signed in to change notification settings - Fork 68
/
azure-pipelines.yml
206 lines (173 loc) · 7.05 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
# Trigger on a PR to master (this includes PRs from forks but secrets are not exposed).
pr:
- master
# Release to PyPI when a tag (vX.X.X) is pushed to master
trigger:
tags:
include:
- v*
stages:
- stage: AnalyseTest
displayName: 'Analyse and Test'
jobs:
- job: code_style_check
pool:
vmImage: ubuntu-20.04
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.7"
architecture: x64
- script: pip install --user flake8==3.7.3
displayName: "Install flake8"
- script: python -m flake8
displayName: "Run flake8"
- job: test
strategy:
maxParallel: 10
matrix:
linux_python_3_6:
python.version: "3.6"
imageName: ubuntu-20.04
sendCoverage: "false"
linux_python_3_7:
python.version: "3.7"
imageName: ubuntu-20.04
sendCoverage: "false"
linux_python_3_8:
python.version: "3.8"
imageName: ubuntu-20.04
sendCoverage: "true"
mac_python_3_6:
python.version: "3.6"
imageName: macOS-10.15
sendCoverage: "false"
mac_python_3_7:
python.version: "3.7"
imageName: macOS-10.15
sendCoverage: "false"
mac_python_3_8:
python.version: "3.8"
imageName: macOS-10.15
sendCoverage: "false"
windows_python_3_6:
python.version: "3.6"
imageName: windows-2019
sendCoverage: "false"
windows_python_3_7:
python.version: "3.7"
imageName: windows-2019
sendCoverage: "false"
windows_python_3_8:
python.version: "3.8"
imageName: windows-2019
sendCoverage: "false"
pool:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(python.version)
architecture: x64
- script: "python -m pip install --upgrade pip && pip install -r test_requirements.txt"
displayName: "Install mbed-os test dependencies"
- script: "pip install lxml"
env: { STATIC_DEPS: true }
displayName: "Install lxml separately on Linux/MacOS"
- script: 'pip install --user "urllib3<1.25"'
displayName: "Fix dependency issue for requests package"
- script: "python -m coverage run setup.py test"
displayName: "Test mbed-os-tools"
- bash: "python setup.py sdist && pip install dist/*"
displayName: "Install mbed-os-tools"
- bash: "python setup.py sdist && pip install dist/*"
displayName: "Install mbed-ls"
workingDirectory: "packages/mbed-ls"
- bash: "python setup.py sdist && pip install dist/*"
displayName: "Install mbed-host-tests"
workingDirectory: "packages/mbed-host-tests"
- bash: "python setup.py sdist && pip install dist/*"
displayName: "Install mbed-greentea"
workingDirectory: "packages/mbed-greentea"
- script: "python -m coverage run setup.py test"
displayName: "Test mbed-ls"
workingDirectory: "packages/mbed-ls"
- script: "python -m coverage run setup.py test"
displayName: "Test mbed-host-tests"
workingDirectory: "packages/mbed-host-tests"
- script: "python -m coverage run setup.py test"
displayName: "Test mbed-greentea"
workingDirectory: "packages/mbed-greentea"
- script: |
python -m coverage combine .coverage packages/*/.coverage
python -m coveralls
condition: eq(variables['sendCoverage'], 'true')
displayName: "Send coverage results to coveralls"
- script: "pip uninstall -y mbed-os-tools mbed-ls mbed-greentea mbed-host-tests"
displayName: "Uninstall sdist packages"
- script: "pip install ."
displayName: "Ensure mbed-os-tools can be installed locally for development"
- script: "pip install -e ."
displayName: "Ensure mbed-ls can be installed locally for development"
workingDirectory: "packages/mbed-ls"
- script: "pip install -e ."
displayName: "Ensure mbed-host-tests can be installed locally for development"
workingDirectory: "packages/mbed-host-tests"
- script: "pip install -e ."
displayName: "Ensure mbed-greentea can be installed locally for development"
workingDirectory: "packages/mbed-greentea"
# Collect test and build stages together before the release stages to provide a pass/fail point for the status badge.
- stage: CiCheckpoint
displayName: 'CI Checkpoint'
dependsOn:
- AnalyseTest
jobs:
- job: ChecksPassing
displayName: 'Checks Passing'
pool:
vmImage: ubuntu-20.04
# A dummy job is required due to a bug in Azure which runs the previous job if nothing is defined.
steps:
- bash: echo "All prerequisite stages have passed and the package should be suitable for release."
- stage: ProductionReleasePyPI
displayName: 'Production Release'
# Only allow production releases if the tests pass and a tag (vX.X.X) is pushed to master.
dependsOn:
- CiCheckpoint
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/v'))
jobs:
- deployment: PyPIProductionRelease
displayName: 'PyPI Production Release'
# Create an environment to keep track of PyPI releases
environment: 'PyPI Release'
strategy:
runOnce:
deploy:
pool:
vmImage: 'ubuntu-20.04'
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: |
python -m pip install --upgrade wheel
python -m pip install --upgrade twine
python -m pip install --upgrade setuptools-scm
displayName: 'Install python modules required for release'
- template: pypi-release.yml
parameters:
repoName: mbed-os-tools
wDirectory: $(Build.SourcesDirectory)
- template: pypi-release.yml
parameters:
repoName: mbed-ls
wDirectory: packages/mbed-ls
- template: pypi-release.yml
parameters:
repoName: mbed-host-tests
wDirectory: packages/mbed-host-tests
- template: pypi-release.yml
parameters:
repoName: mbed-greentea
wDirectory: packages/mbed-greentea