forked from scikit-learn-contrib/hdbscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
244 lines (223 loc) · 8.39 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
# Trigger a build when there is a push to the main branch or a tag starts with release-
trigger:
branches:
include:
- master
tags:
include:
- release-*
# Trigger a build when there is a pull request to the main branch
# Ignore PRs that are just updating the docs
pr:
branches:
include:
- master
exclude:
- doc/*
- README.rst
variables:
triggeredByPullRequest: $[eq(variables['Build.Reason'], 'PullRequest')]
stages:
- stage: RunAllTests
displayName: Run test suite
jobs:
- job: run_platform_tests
strategy:
matrix:
mac_py37:
imageName: 'macOS-latest'
python.version: '3.7'
linux_py37:
imageName: 'ubuntu-latest'
python.version: '3.7'
windows_py37:
imageName: 'windows-latest'
python.version: '3.7'
mac_py38:
imageName: 'macOS-latest'
python.version: '3.8'
linux_py38:
imageName: 'ubuntu-latest'
python.version: '3.8'
windows_py38:
imageName: 'windows-latest'
python.version: '3.8'
mac_py39:
imageName: 'macOS-latest'
python.version: '3.9'
linux_py39:
imageName: 'ubuntu-latest'
python.version: '3.9'
windows_py39:
imageName: 'windows-latest'
python.version: '3.9'
mac_py310:
imageName: 'macOS-latest'
python.version: '3.10'
linux_py310:
imageName: 'ubuntu-latest'
python.version: '3.10'
windows_py310:
imageName: 'windows-latest'
python.version: '3.10'
mac_py311:
imageName: 'macOS-latest'
python.version: '3.11'
linux_py311:
imageName: 'ubuntu-latest'
python.version: '3.11'
windows_py311:
imageName: 'windows-latest'
python.version: '3.11'
pool:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: 'Install dependencies'
- script: |
pip install -e .
pip install pytest pytest-azurepipelines
pip install pytest-cov
pip install coveralls
displayName: 'Install package'
- script: |
pytest hdbscan/tests --show-capture=no -v --disable-warnings --junitxml=junit/test-results.xml --cov=hdbscan/ --cov-report=xml --cov-report=html
displayName: 'Run tests'
- bash: |
coveralls
displayName: 'Publish to coveralls'
condition: and(succeeded(), eq(variables.triggeredByPullRequest, false)) # Don't run this for PRs because they can't access pipeline secrets
env:
COVERALLS_REPO_TOKEN: $(COVERALLS_TOKEN)
- task: PublishTestResults@2
inputs:
testResultsFiles: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
testRunTitle: '$(Agent.OS) - $(Build.BuildNumber)[$(Agent.JobName)] - Python $(python.version)'
condition: succeededOrFailed()
- stage: BuildPublishArtifact
dependsOn: RunAllTests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/release-'), eq(variables.triggeredByPullRequest, false))
jobs:
# Need to use manylinux as ubuntu-latest is too new
- job: Manylinux2014Build
pool:
vmImage: 'ubuntu-latest'
container: quay.io/pypa/manylinux2014_x86_64:latest
strategy:
matrix:
linux_py37:
python.version: 'cp37-cp37m'
linux_py38:
python.version: 'cp38-cp38'
linux_py39:
python.version: 'cp39-cp39'
linux_py310:
python.version: 'cp310-cp310'
linux_py311:
python.version: 'cp311-cp311'
steps:
- script: |
"${PYBIN}/python" -m pip install --upgrade pip
"${PYBIN}/python" -m pip install wheel
"${PYBIN}/python" -m pip install -r requirements.txt
displayName: 'Install dependencies and build tools'
env:
PYBIN: /opt/python/$(python.version)/bin
- script: |
"${PYBIN}/python" setup.py sdist bdist_wheel
displayName: 'Build wheels'
env:
PYBIN: /opt/python/$(python.version)/bin
- bash: |
auditwheel repair dist/*linux_x86_64.whl --plat manylinux2014_x86_64 -w wheelhouse-manylinux/
displayName: 'Audit wheels'
- task: DownloadSecureFile@1
name: PYPIRC_CONFIG
displayName: 'Download pypirc'
inputs:
secureFile: 'pypirc'
- bash: |
"${PYBIN}/python" -m pip install twine
"${PYBIN}/python" -m twine upload -r pypi --config-file $(PYPIRC_CONFIG.secureFilePath) --skip-existing --disable-progress-bar wheelhouse-manylinux/*
"${PYBIN}/python" -m twine upload -r pypi --config-file $(PYPIRC_CONFIG.secureFilePath) --skip-existing --disable-progress-bar dist/*.tar.gz
displayName: 'Publish wheel to PyPi'
env:
PYBIN: /opt/python/$(python.version)/bin
- job: BuildWindowsAndMacOSArtifacts
displayName: Build source dists and wheels for windows and macOS
strategy:
matrix:
mac_py37:
imageName: 'macOS-latest'
python.version: '3.7'
windows_py37:
imageName: 'windows-latest'
python.version: '3.7'
mac_py38:
imageName: 'macOS-latest'
python.version: '3.8'
windows_py38:
imageName: 'windows-latest'
python.version: '3.8'
mac_py39:
imageName: 'macOS-latest'
python.version: '3.9'
windows_py39:
imageName: 'windows-latest'
python.version: '3.9'
mac_py310:
imageName: 'macOS-latest'
python.version: '3.10'
windows_py310:
imageName: 'windows-latest'
python.version: '3.10'
mac_py311:
imageName: 'macOS-latest'
python.version: '3.11'
windows_py311:
imageName: 'windows-latest'
python.version: '3.11'
pool:
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements.txt
displayName: 'Install dependencies'
- script: |
pip install -e .
displayName: 'Install package locally'
- bash: |
python setup.py sdist bdist_wheel
displayName: 'Build package'
- bash: |
export PACKAGE_VERSION="$(python setup.py --version)"
echo "Package Version: ${PACKAGE_VERSION}"
echo "##vso[task.setvariable variable=packageVersionFormatted;]release-${PACKAGE_VERSION}"
displayName: 'Get package version'
- script: |
echo "Version in git tag $(Build.SourceBranchName) does not match version derived from setup.py $(packageVersionFormatted)"
exit 1
displayName: Raise error if version doesnt match tag
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))
- task: DownloadSecureFile@1
name: PYPIRC_CONFIG
displayName: 'Download pypirc'
inputs:
secureFile: 'pypirc'
- script: |
pip install twine
twine upload -r pypi --config-file $(PYPIRC_CONFIG.secureFilePath) --skip-existing dist/*
displayName: 'Upload to PyPI'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))