|
1 |
| -jobs: |
2 |
| - - |
3 |
| - job: code_style_check |
| 1 | +# Trigger on a PR to master (this includes PRs from forks but secrets are not exposed). |
| 2 | +pr: |
| 3 | + - master |
| 4 | + |
| 5 | +# Release to PyPI when a tag (vX.X.X) is pushed to master |
| 6 | +trigger: |
| 7 | + tags: |
| 8 | + include: |
| 9 | + - v* |
| 10 | + |
| 11 | +stages: |
| 12 | + - stage: AnalyseTest |
| 13 | + displayName: 'Analyse and Test' |
| 14 | + jobs: |
| 15 | + - job: code_style_check |
| 16 | + |
4 | 17 | pool:
|
5 |
| - vmImage: ubuntu-16.04 |
| 18 | + vmImage: ubuntu-16.04 |
| 19 | + |
6 | 20 | steps:
|
7 |
| - - |
8 |
| - task: UsePythonVersion@0 |
9 |
| - inputs: |
10 |
| - versionSpec: "3.7" |
11 |
| - architecture: x64 |
12 |
| - - |
13 |
| - script: pip install --user flake8==3.7.3 |
14 |
| - displayName: "Install flake8" |
15 |
| - - |
16 |
| - script: python -m flake8 |
17 |
| - displayName: "Run flake8" |
18 |
| - - |
19 |
| - job: test |
| 21 | + - task: UsePythonVersion@0 |
| 22 | + inputs: |
| 23 | + versionSpec: "3.7" |
| 24 | + architecture: x64 |
| 25 | + - script: pip install --user flake8==3.7.3 |
| 26 | + displayName: "Install flake8" |
| 27 | + |
| 28 | + - script: python -m flake8 |
| 29 | + displayName: "Run flake8" |
| 30 | + |
| 31 | + - job: test |
20 | 32 | strategy:
|
21 |
| - matrix: |
22 |
| - linux_python_2_7: |
23 |
| - python.version: "2.7" |
24 |
| - imageName: ubuntu-16.04 |
25 |
| - sendCoverage: "false" |
26 |
| - linux_python_3_5: |
27 |
| - python.version: "3.5" |
28 |
| - imageName: ubuntu-16.04 |
29 |
| - sendCoverage: "false" |
30 |
| - linux_python_3_6: |
31 |
| - python.version: "3.6" |
32 |
| - imageName: ubuntu-16.04 |
33 |
| - sendCoverage: "false" |
34 |
| - linux_python_3_7: |
35 |
| - python.version: "3.7" |
36 |
| - imageName: ubuntu-16.04 |
37 |
| - sendCoverage: "false" |
38 |
| - linux_python_3_8: |
39 |
| - python.version: "3.8" |
40 |
| - imageName: ubuntu-16.04 |
41 |
| - sendCoverage: "true" |
42 |
| - mac_python_2_7: |
43 |
| - python.version: "2.7" |
44 |
| - imageName: macOS-10.15 |
45 |
| - sendCoverage: "false" |
46 |
| - mac_python_3_5: |
47 |
| - python.version: "3.5" |
48 |
| - imageName: macOS-10.15 |
49 |
| - sendCoverage: "false" |
50 |
| - mac_python_3_6: |
51 |
| - python.version: "3.6" |
52 |
| - imageName: macOS-10.15 |
53 |
| - sendCoverage: "false" |
54 |
| - mac_python_3_7: |
55 |
| - python.version: "3.7" |
56 |
| - imageName: macOS-10.15 |
57 |
| - sendCoverage: "false" |
58 |
| - mac_python_3_8: |
59 |
| - python.version: "3.8" |
60 |
| - imageName: macOS-10.15 |
61 |
| - sendCoverage: "false" |
62 |
| - windows_python_2_7: |
63 |
| - python.version: "2.7" |
64 |
| - imageName: vs2017-win2016 |
65 |
| - sendCoverage: "false" |
66 |
| - windows_python_3_5: |
67 |
| - python.version: "3.5" |
68 |
| - imageName: vs2017-win2016 |
69 |
| - sendCoverage: "false" |
70 |
| - windows_python_3_6: |
71 |
| - python.version: "3.6" |
72 |
| - imageName: vs2017-win2016 |
73 |
| - sendCoverage: "false" |
74 |
| - windows_python_3_7: |
75 |
| - python.version: "3.7" |
76 |
| - imageName: vs2017-win2016 |
77 |
| - sendCoverage: "false" |
78 |
| - windows_python_3_8: |
79 |
| - python.version: "3.8" |
80 |
| - imageName: vs2017-win2016 |
81 |
| - sendCoverage: "false" |
82 |
| - maxParallel: 10 |
| 33 | + maxParallel: 10 |
| 34 | + matrix: |
| 35 | + linux_python_2_7: |
| 36 | + python.version: "2.7" |
| 37 | + imageName: ubuntu-16.04 |
| 38 | + sendCoverage: "false" |
| 39 | + linux_python_3_5: |
| 40 | + python.version: "3.5" |
| 41 | + imageName: ubuntu-16.04 |
| 42 | + sendCoverage: "false" |
| 43 | + linux_python_3_6: |
| 44 | + python.version: "3.6" |
| 45 | + imageName: ubuntu-16.04 |
| 46 | + sendCoverage: "false" |
| 47 | + linux_python_3_7: |
| 48 | + python.version: "3.7" |
| 49 | + imageName: ubuntu-16.04 |
| 50 | + sendCoverage: "false" |
| 51 | + linux_python_3_8: |
| 52 | + python.version: "3.8" |
| 53 | + imageName: ubuntu-16.04 |
| 54 | + sendCoverage: "true" |
| 55 | + mac_python_2_7: |
| 56 | + python.version: "2.7" |
| 57 | + imageName: macOS-10.15 |
| 58 | + sendCoverage: "false" |
| 59 | + mac_python_3_5: |
| 60 | + python.version: "3.5" |
| 61 | + imageName: macOS-10.15 |
| 62 | + sendCoverage: "false" |
| 63 | + mac_python_3_6: |
| 64 | + python.version: "3.6" |
| 65 | + imageName: macOS-10.15 |
| 66 | + sendCoverage: "false" |
| 67 | + mac_python_3_7: |
| 68 | + python.version: "3.7" |
| 69 | + imageName: macOS-10.15 |
| 70 | + sendCoverage: "false" |
| 71 | + mac_python_3_8: |
| 72 | + python.version: "3.8" |
| 73 | + imageName: macOS-10.15 |
| 74 | + sendCoverage: "false" |
| 75 | + windows_python_2_7: |
| 76 | + python.version: "2.7" |
| 77 | + imageName: vs2017-win2016 |
| 78 | + sendCoverage: "false" |
| 79 | + windows_python_3_5: |
| 80 | + python.version: "3.5" |
| 81 | + imageName: vs2017-win2016 |
| 82 | + sendCoverage: "false" |
| 83 | + windows_python_3_6: |
| 84 | + python.version: "3.6" |
| 85 | + imageName: vs2017-win2016 |
| 86 | + sendCoverage: "false" |
| 87 | + windows_python_3_7: |
| 88 | + python.version: "3.7" |
| 89 | + imageName: vs2017-win2016 |
| 90 | + sendCoverage: "false" |
| 91 | + windows_python_3_8: |
| 92 | + python.version: "3.8" |
| 93 | + imageName: vs2017-win2016 |
| 94 | + sendCoverage: "false" |
| 95 | + |
83 | 96 | pool:
|
84 |
| - vmImage: $(imageName) |
| 97 | + vmImage: $(imageName) |
| 98 | + |
85 | 99 | steps:
|
86 |
| - - |
87 |
| - task: UsePythonVersion@0 |
88 |
| - inputs: |
89 |
| - versionSpec: $(python.version) |
90 |
| - architecture: x64 |
91 |
| - - |
92 |
| - script: "python -m pip install --upgrade pip && pip install -r test_requirements.txt" |
93 |
| - displayName: "Install mbed-os test dependencies" |
94 |
| - - |
95 |
| - script: "pip install lxml" |
96 |
| - env: { STATIC_DEPS: true } |
97 |
| - displayName: "Install lxml separately on Linux/MacOS" |
98 |
| - - |
99 |
| - script: 'pip install --user "urllib3<1.25"' |
100 |
| - displayName: "Fix dependency issue for requests package" |
101 |
| - - |
102 |
| - script: "python -m coverage run setup.py test" |
103 |
| - displayName: "Test mbed-os-tools" |
104 |
| - - |
105 |
| - bash: "python setup.py sdist && pip install dist/*" |
106 |
| - displayName: "Install mbed-os-tools" |
107 |
| - - |
108 |
| - bash: "python setup.py sdist && pip install dist/*" |
109 |
| - displayName: "Install mbed-ls" |
110 |
| - workingDirectory: "packages/mbed-ls" |
111 |
| - - |
112 |
| - bash: "python setup.py sdist && pip install dist/*" |
113 |
| - displayName: "Install mbed-host-tests" |
114 |
| - workingDirectory: "packages/mbed-host-tests" |
115 |
| - - |
116 |
| - bash: "python setup.py sdist && pip install dist/*" |
117 |
| - displayName: "Install mbed-greentea" |
118 |
| - workingDirectory: "packages/mbed-greentea" |
119 |
| - - |
120 |
| - script: "python -m coverage run setup.py test" |
121 |
| - displayName: "Test mbed-ls" |
122 |
| - workingDirectory: "packages/mbed-ls" |
123 |
| - - |
124 |
| - script: "python -m coverage run setup.py test" |
125 |
| - displayName: "Test mbed-host-tests" |
126 |
| - workingDirectory: "packages/mbed-host-tests" |
127 |
| - - |
128 |
| - script: "python -m coverage run setup.py test" |
129 |
| - displayName: "Test mbed-greentea" |
130 |
| - workingDirectory: "packages/mbed-greentea" |
131 |
| - - |
132 |
| - script: | |
133 |
| - python -m coverage combine .coverage packages/*/.coverage |
134 |
| - python -m coveralls |
135 |
| - condition: eq(variables['sendCoverage'], 'true') |
136 |
| - displayName: "Send coverage results to coveralls" |
137 |
| - - |
138 |
| - script: "pip uninstall -y mbed-os-tools mbed-ls mbed-greentea mbed-host-tests" |
139 |
| - displayName: "Uninstall sdist packages" |
140 |
| - - |
141 |
| - script: "pip install ." |
142 |
| - displayName: "Ensure mbed-os-tools can be installed locally for development" |
143 |
| - - |
144 |
| - script: "pip install ." |
145 |
| - displayName: "Ensure mbed-ls can be installed locally for development" |
146 |
| - workingDirectory: "packages/mbed-ls" |
147 |
| - - |
148 |
| - script: "pip install ." |
149 |
| - displayName: "Ensure mbed-host-tests can be installed locally for development" |
150 |
| - workingDirectory: "packages/mbed-host-tests" |
151 |
| - - |
152 |
| - script: "pip install ." |
153 |
| - displayName: "Ensure mbed-greentea can be installed locally for development" |
154 |
| - workingDirectory: "packages/mbed-greentea" |
| 100 | + - task: UsePythonVersion@0 |
| 101 | + inputs: |
| 102 | + versionSpec: $(python.version) |
| 103 | + architecture: x64 |
| 104 | + |
| 105 | + - script: "python -m pip install --upgrade pip && pip install -r test_requirements.txt" |
| 106 | + displayName: "Install mbed-os test dependencies" |
| 107 | + |
| 108 | + - script: "pip install lxml" |
| 109 | + env: { STATIC_DEPS: true } |
| 110 | + displayName: "Install lxml separately on Linux/MacOS" |
| 111 | + |
| 112 | + - script: 'pip install --user "urllib3<1.25"' |
| 113 | + displayName: "Fix dependency issue for requests package" |
| 114 | + |
| 115 | + - script: "python -m coverage run setup.py test" |
| 116 | + displayName: "Test mbed-os-tools" |
| 117 | + |
| 118 | + - bash: "python setup.py sdist && pip install dist/*" |
| 119 | + displayName: "Install mbed-os-tools" |
| 120 | + |
| 121 | + - bash: "python setup.py sdist && pip install dist/*" |
| 122 | + displayName: "Install mbed-ls" |
| 123 | + workingDirectory: "packages/mbed-ls" |
| 124 | + |
| 125 | + - bash: "python setup.py sdist && pip install dist/*" |
| 126 | + displayName: "Install mbed-host-tests" |
| 127 | + workingDirectory: "packages/mbed-host-tests" |
| 128 | + |
| 129 | + - bash: "python setup.py sdist && pip install dist/*" |
| 130 | + displayName: "Install mbed-greentea" |
| 131 | + workingDirectory: "packages/mbed-greentea" |
| 132 | + |
| 133 | + - script: "python -m coverage run setup.py test" |
| 134 | + displayName: "Test mbed-ls" |
| 135 | + workingDirectory: "packages/mbed-ls" |
| 136 | + |
| 137 | + - script: "python -m coverage run setup.py test" |
| 138 | + displayName: "Test mbed-host-tests" |
| 139 | + workingDirectory: "packages/mbed-host-tests" |
| 140 | + |
| 141 | + - script: "python -m coverage run setup.py test" |
| 142 | + displayName: "Test mbed-greentea" |
| 143 | + workingDirectory: "packages/mbed-greentea" |
| 144 | + |
| 145 | + - script: | |
| 146 | + python -m coverage combine .coverage packages/*/.coverage |
| 147 | + python -m coveralls |
| 148 | + condition: eq(variables['sendCoverage'], 'true') |
| 149 | + displayName: "Send coverage results to coveralls" |
| 150 | +
|
| 151 | + - script: "pip uninstall -y mbed-os-tools mbed-ls mbed-greentea mbed-host-tests" |
| 152 | + displayName: "Uninstall sdist packages" |
| 153 | + |
| 154 | + - script: "pip install ." |
| 155 | + displayName: "Ensure mbed-os-tools can be installed locally for development" |
| 156 | + |
| 157 | + - script: "pip install -e ." |
| 158 | + displayName: "Ensure mbed-ls can be installed locally for development" |
| 159 | + workingDirectory: "packages/mbed-ls" |
| 160 | + |
| 161 | + - script: "pip install -e ." |
| 162 | + displayName: "Ensure mbed-host-tests can be installed locally for development" |
| 163 | + workingDirectory: "packages/mbed-host-tests" |
| 164 | + |
| 165 | + - script: "pip install -e ." |
| 166 | + displayName: "Ensure mbed-greentea can be installed locally for development" |
| 167 | + workingDirectory: "packages/mbed-greentea" |
| 168 | + |
| 169 | + # Collect test and build stages together before the release stages to provide a pass/fail point for the status badge. |
| 170 | + - stage: CiCheckpoint |
| 171 | + displayName: 'CI Checkpoint' |
| 172 | + dependsOn: |
| 173 | + - AnalyseTest |
| 174 | + jobs: |
| 175 | + - job: ChecksPassing |
| 176 | + displayName: 'Checks Passing' |
| 177 | + # A dummy job is required due to a bug in Azure which runs the previous job if nothing is defined. |
| 178 | + steps: |
| 179 | + - bash: echo "All prerequisite stages have passed and the package should be suitable for release." |
| 180 | + |
| 181 | + - stage: ProductionReleasePyPI |
| 182 | + displayName: 'Production Release' |
| 183 | + # Only allow production releases if the tests pass and a tag (vX.X.X) is pushed to master. |
| 184 | + dependsOn: |
| 185 | + - CiCheckpoint |
| 186 | + condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/v')) |
| 187 | + jobs: |
| 188 | + - deployment: PyPIProductionRelease |
| 189 | + displayName: 'PyPI Production Release' |
| 190 | + # Create an environment to keep track of PyPI releases |
| 191 | + environment: 'PyPI Release' |
| 192 | + strategy: |
| 193 | + runOnce: |
| 194 | + deploy: |
| 195 | + pool: |
| 196 | + vmImage: 'ubuntu-latest' |
| 197 | + steps: |
| 198 | + - checkout: self |
| 199 | + |
| 200 | + - task: UsePythonVersion@0 |
| 201 | + inputs: |
| 202 | + versionSpec: '3.7' |
| 203 | + |
| 204 | + - script: | |
| 205 | + python -m pip install --upgrade wheel |
| 206 | + python -m pip install --upgrade twine |
| 207 | + python -m pip install --upgrade setuptools-scm |
| 208 | + displayName: 'Install python modules required for release' |
| 209 | +
|
| 210 | + - template: pypi-release.yml |
| 211 | + parameters: |
| 212 | + repoName: mbed-os-tools |
| 213 | + wDirectory: $(Build.SourcesDirectory) |
| 214 | + |
| 215 | + - template: pypi-release.yml |
| 216 | + parameters: |
| 217 | + repoName: mbed-ls |
| 218 | + wDirectory: packages/mbed-ls |
| 219 | + |
| 220 | + - template: pypi-release.yml |
| 221 | + parameters: |
| 222 | + repoName: mbed-host-tests |
| 223 | + wDirectory: packages/mbed-host-tests |
| 224 | + |
| 225 | + - template: pypi-release.yml |
| 226 | + parameters: |
| 227 | + repoName: mbed-greentea |
| 228 | + wDirectory: packages/mbed-greentea |
0 commit comments