-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathazure-pipelines.yml
185 lines (161 loc) · 6.1 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
# Trigger a build when there is a push to the main branch or a tag starts with release-
trigger:
branches:
include:
- main
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:
- main
exclude:
- doc/*
- README.rst
# Trigger a run on main at 00:00 (midnight) UTC on Sundays
# Run even if there are no code changes
schedules:
- cron: "0 0 * * 0"
displayName: "Sunday Test Runs"
always: true
branches:
include:
- main
variables:
triggeredByPullRequest: $[eq(variables['Build.Reason'], 'PullRequest')]
stages:
- stage: RunAllTests
displayName: Run test suite
jobs:
- job: run_platform_tests
strategy:
matrix:
# 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: |
echo "##vso[task.setvariable variable=PIP_CACHE_DIR]$(pip cache dir)"
displayName: 'Set PIP_CACHE_DIR'
- task: Cache@2
inputs:
key: 'pip | "$(Build.SourcesDirectory)/test-requirements.txt" | "$(Build.SourcesDirectory)/setup.cfg"'
restoreKeys: |
pip |
path: $(PIP_CACHE_DIR)
displayName: 'Cache pip dependencies'
- script: |
python -m pip install --upgrade pip
displayName: 'Upgrade pip'
- script: |
pip install -r test-requirements.txt
displayName: 'Install pip dependencies'
- script: |
pip install -e .
displayName: 'Install local package'
# # Debugging import datashader
# - script: |
# echo "Installed packages:"
# pip list
# echo "Dask information:"
# python -c "import dask; print('Dask version:', dask.__version__)"
# python -c "import dask.dataframe; print('Dask DataFrame path:', dask.dataframe.__file__)"
# echo "Datashader information:"
# python -c "import datashader; print('Datashader version:', datashader.__version__)"
# displayName: 'Debug dependency versions'
- script: |
export CI=true
mkdir -p $(Build.ArtifactStagingDirectory)/mpl
pytest datamapplot/tests --mpl --show-capture=no --disable-warnings \
--cov=datamapplot/ --cov-report=html \
--mpl-generate-summary=html \
--mpl-results-path=$(Build.ArtifactStagingDirectory)/mpl
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: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)/mpl
artifactName: 'mpl-test-results-$(Build.BuildId)-$(Agent.OS)-py$(python.version)'
displayName: 'Publish MPL Test Artifacts'
condition: always()
- stage: BuildPublishArtifact
dependsOn: RunAllTests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/release-'), eq(variables.triggeredByPullRequest, false))
jobs:
- job: BuildArtifacts
displayName: Build source dists and wheels
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
displayName: 'Use Python 3.10'
- script: |
python -m pip install --upgrade pip
pip install wheel
displayName: 'Install dependencies'
- script: |
pip install -e .
displayName: 'Install package locally'
- script: |
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 --repository pypi --config-file $(PYPIRC_CONFIG.secureFilePath) dist/*
displayName: 'Upload to PyPI'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))