forked from scikit-image/scikit-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
216 lines (182 loc) · 7.23 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
# Azure Pipelines configuration file for Continuous Integration
# for building the package and running the tests under Windows.
variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
# data cache dir determined via: print(pooch.os_cache('scikit-image'))
SKIMAGE_DATA_CACHE_FOLDER: C:\Users\VssAdministrator\AppData\Local\scikit-image\scikit-image\Cache
jobs:
- job: 'Default'
pool:
vmImage: 'windows-latest'
strategy:
maxParallel: 10
matrix:
Python38:
PYTHON_VERSION: '3.8'
ARCH: 'x86'
PIP_FLAGS: ''
Python38-x64:
PYTHON_VERSION: '3.8'
ARCH: 'x64'
PIP_FLAGS: ''
BUILD_DOCS: 'true'
# build pre release packages on Python 3.8 since it has been out long
# enough for wheels to be built for packages that need to be compiled.
Python38-x64-pre:
PYTHON_VERSION: '3.8'
ARCH: 'x64'
PIP_FLAGS: '--pre'
Python39:
PYTHON_VERSION: '3.9'
ARCH: 'x86'
PIP_FLAGS: ''
Python39-x64:
PYTHON_VERSION: '3.9'
ARCH: 'x64'
PIP_FLAGS: ''
TEST_EXAMPLES: 'true'
# NOTE(honles): winpty is required by one of the doc dependencies,
# but does not provide a wheel for Python 3.9
# TEST_EXAMPLES: 'true'
continueOnError: false
timeoutInMinutes: 60
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
architecture: '$(ARCH)'
name: python
# https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
- task: Cache@2
inputs:
key: '"skimage_data" | skimage/data/_registry.py'
path: $(SKIMAGE_DATA_CACHE_FOLDER)
displayName: Cache scikit-image data files
# the line below (continueOnError: true) can be removed when the following issue is addressed:
# https://github.com/scikit-image/scikit-image/issues/6048
continueOnError: true
# https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops#pythonpip
- task: Cache@2
inputs:
key: '"Python$(PYTHON_VERSION)-$(ARCH)" | "$(Agent.OS)" | requirements/build.txt | requirements/default.txt | requirements/test.txt | requirements/docs.txt'
restoreKeys: |
"Python$(PYTHON_VERSION)-$(ARCH)" | "$(Agent.OS)"
"Python$(PYTHON_VERSION)-$(ARCH)"
path: $(PIP_CACHE_DIR)
displayName: Cache pip packages
# the line below (continueOnError: true) can be removed when the following issue is addressed:
# https://github.com/scikit-image/scikit-image/issues/6048
continueOnError: true
- script: |
choco install --$(ARCH) -y llvm
set PATH=C:\Program Files\LLVM\bin;%PATH%
set PATH=C:\Program Files (x86)\LLVM\bin;%PATH%
echo '##vso[task.setvariable variable=PATH]%PATH%'
displayName: 'Install clang-cl'
- bash: |
set -ex
PYTHON="$(python.pythonLocation)\\python.exe"
# Update pip
$PYTHON -m pip install -U pip setuptools wheel
# print out the pip cache dir followed by the variable defined above
# to confirm that they match
$PYTHON -m pip cache dir
echo "PIP_CACHE_DIR: $PIP_CACHE_DIR"
# Check that we have the expected version and architecture for Python
$PYTHON --version
$PYTHON -m pip --version
$PYTHON -c "import struct; print('Void pointer width is', struct.calcsize('P') * 8)"
$PYTHON -m pip list
# Install the build and runtime dependencies of the project
$PYTHON -m pip install ${PIP_FLAGS} -r requirements/build.txt
# Disable C99 complex if PyWavelets needs to be built from source.
# The compiler used will be MSVC, but C99 may be detected improperly
USE_C99_COMPLEX=0 $PYTHON -m pip install ${PIP_FLAGS} -r requirements/default.txt
$PYTHON -m pip list
displayName: 'Pre-installation'
- bash: |
set -ex
PYTHON="$(python.pythonLocation)\\python.exe"
if [ "$(ARCH)" = "x86" ] ; then
export CXXFLAGS="-m32"
fi
# Compile the package and build the wheel
$PYTHON setup.py bdist_wheel
# Install the generated wheel package
ls dist
$PYTHON -m pip install ${PIP_FLAGS} --no-index --find-links dist/ scikit-image
displayName: 'Installation'
- bash: |
set -ex
PYTHON="$(python.pythonLocation)\\python.exe"
# Install the test dependencies
$PYTHON -m pip install ${PIP_FLAGS} -r requirements/test.txt
$PYTHON -m pip list
# Set non-UI Matplotlib backend
cd ${AGENT_BUILDDIRECTORY} # D:\a\1
echo "backend : Agg" > matplotlibrc
displayName: 'Pre-testing'
- bash: |
set -ex
PYTHON="$(python.pythonLocation)\\python.exe"
# Change the working directory in order to run the tests
# on the installed version of skimage
cd ${AGENT_BUILDDIRECTORY} # D:\a\1
# Show the info about the installed scikit-image
$PYTHON -c "import skimage; print(skimage.__path__)"
# Show the path pooch is using for the data cache
# (this should match the SKIMAGE_DATA_CACHE_FOLDER variable above)
$PYTHON -c "import pooch; print(pooch.os_cache('scikit-image'))"
echo "SKIMAGE_DATA_CACHE_FOLDER: $SKIMAGE_DATA_CACHE_FOLDER"
# Force matplotlib to use the prepared config
export MATPLOTLIBRC=${AGENT_BUILDDIRECTORY}
# Run unit tests with pytest
# We don't test docstring examples (--doctest-modules) on
# Windows due to inconsistent ndarray formatting in `numpy`.
# For more details, see https://github.com/numpy/numpy/issues/13468
export TEST_ARGS="-v --cov=skimage"
$PYTHON -m pytest ${TEST_ARGS} --pyargs skimage
displayName: 'Package testing'
- bash: |
set -ex
PYTHON="$(python.pythonLocation)\\python.exe"
$PYTHON -m asv check -v -E existing
displayName: Check benchmarks
- bash: |
set -ex
export PYTHON="$(python.pythonLocation)\\python.exe"
# Install the doc dependencies
$PYTHON -m pip install ${PIP_FLAGS} -r requirements/docs.txt
$PYTHON -m pip list
# Build the documentation
choco install optipng
export SPHINXCACHE=${AGENT_BUILDDIRECTORY}/.cache/sphinx
export SPHINXOPTS=-W
make -C doc html
condition: eq(variables['BUILD_DOCS'], 'true')
displayName: 'Documentation testing'
- bash: |
set -ex
PYTHON="$(python.pythonLocation)\\python.exe"
# Install the doc dependencies
$PYTHON -m pip install ${PIP_FLAGS} -r requirements/docs.txt
$PYTHON -m pip list
# Force matplotlib to use the prepared config
export MATPLOTLIBRC=${AGENT_BUILDDIRECTORY}
# Run example applications
for f in doc/examples/*/*.py; do
# Comment out any plotly.io.show() calls before running the example.
# Plotly opens a web browser, which often seemed to cause the CI to
# hang and timeout.
sed -i 's/plotly.io.show/# plotly.io.show/g' ${f}
$PYTHON -W ignore:Matplotlib:UserWarning "${f}"
if [ $? -ne 0 ]; then
exit 1
fi
done
condition: eq(variables['TEST_EXAMPLES'], 'true')
displayName: 'Gallery testing'
# - bash: |
# # -- Publish the .whl artifacts
# # -- Upload the content of dist/*.whl to a public wheelhouse
# displayName: 'Further consideration'