scikit-image
/
azure-pipelines.yml
227 строк · 8.0 Кб
1# Azure Pipelines configuration file for Continuous Integration
2# for building the package and running the tests under Windows.
3variables:
4PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
5# data cache dir determined via: print(pooch.os_cache('scikit-image'))
6SKIMAGE_DATA_CACHE_FOLDER: C:\Users\VssAdministrator\AppData\Local\scikit-image\scikit-image\Cache
7
8jobs:
9- job: "Default"
10pool:
11vmImage: "windows-latest"
12strategy:
13maxParallel: 10
14matrix:
15Python312-x64:
16PYTHON_VERSION: "3.12"
17ARCH: "x64"
18Python312-x64-pre:
19PYTHON_VERSION: "3.12"
20ARCH: "x64"
21PIP_FLAGS: "--pre"
22Python311-x64-docs:
23PYTHON_VERSION: "3.11"
24ARCH: "x64"
25BUILD_DOCS: "true"
26Python311-x64-gallery:
27PYTHON_VERSION: "3.11"
28ARCH: "x64"
29TEST_EXAMPLES: "true"
30Python310-x64:
31PYTHON_VERSION: "3.10"
32ARCH: "x64"
33Python39-x64:
34PYTHON_VERSION: "3.9"
35ARCH: "x64"
36continueOnError: false
37timeoutInMinutes: 60
38
39steps:
40- task: UsePythonVersion@0
41inputs:
42versionSpec: "$(PYTHON_VERSION)"
43architecture: "$(ARCH)"
44name: python
45
46# https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
47- task: Cache@2
48inputs:
49key: '"skimage_data" | skimage/data/_registry.py'
50path: $(SKIMAGE_DATA_CACHE_FOLDER)
51displayName: Cache scikit-image data files
52# the line below (continueOnError: true) can be removed when the following issue is addressed:
53# https://github.com/scikit-image/scikit-image/issues/6048
54continueOnError: true
55
56# https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops#pythonpip
57- task: Cache@2
58inputs:
59key: '"Python$(PYTHON_VERSION)-$(ARCH)" | "$(Agent.OS)" | requirements/build.txt | requirements/default.txt | requirements/test.txt | requirements/docs.txt'
60restoreKeys: |
61"Python$(PYTHON_VERSION)-$(ARCH)" | "$(Agent.OS)"
62"Python$(PYTHON_VERSION)-$(ARCH)"
63path: $(PIP_CACHE_DIR)
64displayName: Cache pip packages
65# the line below (continueOnError: true) can be removed when the following issue is addressed:
66# https://github.com/scikit-image/scikit-image/issues/6048
67continueOnError: true
68
69- bash: |
70set -ex
71PYTHON="$(python.pythonLocation)\\python.exe"
72
73# Update pip
74$PYTHON -m pip install -U pip
75
76# Check that we have the expected version and architecture for Python
77$PYTHON --version
78$PYTHON -m pip --version
79$PYTHON -c "import struct; print('Void pointer width is', struct.calcsize('P') * 8)"
80
81# print out the pip cache dir followed by the variable defined above
82# to confirm that they match
83$PYTHON -m pip cache dir
84echo "PIP_CACHE_DIR: $PIP_CACHE_DIR"
85
86# Install the build and runtime dependencies of the project
87$PYTHON -m pip install ${PIP_FLAGS} -r requirements/build.txt
88$PYTHON -m pip list
89
90# Disable C99 complex if PyWavelets needs to be built from source.
91# The compiler used will be MSVC, but C99 may be detected improperly
92USE_C99_COMPLEX=0 $PYTHON -m pip install ${PIP_FLAGS} -r requirements/default.txt
93
94$PYTHON -m pip list
95displayName: "Pre-installation"
96
97- bash: |
98set -ex
99PYTHON="$(python.pythonLocation)\\python.exe"
100if [ "$(ARCH)" = "x86" ] ; then
101export CXXFLAGS="-m32"
102fi
103
104## To list all installed packages:
105choco list
106
107# Remove other gcc compilers
108
109## This would be the best way to uninstall, but is SLOW:
110# choco uninstall llvm mingw rtools strawberryperl -x
111
112# Remove mingw gcc
113#rm /c/ProgramData/Chocolatey/bin/gcc
114#rm /c/ProgramData/Chocolatey/bin/g++
115#rm /c/ProgramData/Chocolatey/bin/c++
116# Remove perl gcc
117rm -rf /c/Strawberry
118
119which ccache || true
120which c++ || true
121
122## Uncomment the next line, and you'll remain with only MSVC.
123# rm -rf "/c/Program Files/LLVM"
124## We're compiling with clang for now because MSVC 19 and
125## Pythran don't play well together.
126
127which clang || true
128
129# Compile the package and build the wheel
130$PYTHON -m build --no-isolation --skip-dependency-check --wheel
131
132# Install the generated wheel package
133ls dist
134$PYTHON -m pip install ${PIP_FLAGS} --no-index --find-links dist/ scikit-image
135displayName: "Installation"
136
137- bash: |
138set -ex
139PYTHON="$(python.pythonLocation)\\python.exe"
140
141# Install the test dependencies
142$PYTHON -m pip install ${PIP_FLAGS} -r requirements/test.txt
143$PYTHON -m pip list
144
145# Set non-UI Matplotlib backend
146cd ${AGENT_BUILDDIRECTORY} # D:\a\1
147echo "backend : Agg" > matplotlibrc
148displayName: "Pre-testing"
149
150- bash: |
151set -ex
152PYTHON="$(python.pythonLocation)\\python.exe"
153
154# Change the working directory in order to run the tests
155# on the installed version of skimage
156cd ${AGENT_BUILDDIRECTORY} # D:\a\1
157
158# Show the info about the installed scikit-image
159$PYTHON -c "import skimage; print(skimage.__path__)"
160
161# Show the path pooch is using for the data cache
162# (this should match the SKIMAGE_DATA_CACHE_FOLDER variable above)
163$PYTHON -c "import pooch; print(pooch.os_cache('scikit-image'))"
164echo "SKIMAGE_DATA_CACHE_FOLDER: $SKIMAGE_DATA_CACHE_FOLDER"
165
166# Force matplotlib to use the prepared config
167export MATPLOTLIBRC=${AGENT_BUILDDIRECTORY}
168
169# Run unit tests with pytest
170# We don't test docstring examples (--doctest-plus) on
171# Windows due to inconsistent ndarray formatting in `numpy`.
172# For more details, see https://github.com/numpy/numpy/issues/13468
173export TEST_ARGS="-v --cov=skimage"
174$PYTHON -m pytest ${TEST_ARGS} --pyargs skimage
175displayName: "Package testing"
176
177- bash: |
178set -ex
179PYTHON="$(python.pythonLocation)\\python.exe"
180$PYTHON -m asv check -v -E existing
181displayName: Check benchmarks
182
183- bash: |
184set -ex
185export PYTHON="$(python.pythonLocation)\\python.exe"
186
187# Install the doc dependencies
188$PYTHON -m pip install ${PIP_FLAGS} -r requirements/docs.txt
189$PYTHON -m pip list
190
191# Build the documentation
192choco install optipng
193export SPHINXCACHE=${AGENT_BUILDDIRECTORY}/.cache/sphinx
194export SPHINXOPTS=-W
195make -C doc html
196condition: eq(variables['BUILD_DOCS'], 'true')
197displayName: "Documentation testing"
198
199- bash: |
200set -ex
201PYTHON="$(python.pythonLocation)\\python.exe"
202
203# Install the doc dependencies
204$PYTHON -m pip install ${PIP_FLAGS} -r requirements/docs.txt
205$PYTHON -m pip list
206
207# Force matplotlib to use the prepared config
208export MATPLOTLIBRC=${AGENT_BUILDDIRECTORY}
209
210# Run example applications
211for f in doc/examples/*/*.py; do
212# Comment out any plotly.io.show() calls before running the example.
213# Plotly opens a web browser, which often seemed to cause the CI to
214# hang and timeout.
215sed -i 's/plotly.io.show/# plotly.io.show/g' ${f}
216
217$PYTHON -W ignore:Matplotlib:UserWarning "${f}"
218if [ $? -ne 0 ]; then
219exit 1
220fi
221done
222condition: eq(variables['TEST_EXAMPLES'], 'true')
223displayName: "Gallery testing"
224# - bash: |
225# # -- Publish the .whl artifacts
226# # -- Upload the content of dist/*.whl to a public wheelhouse
227# displayName: 'Further consideration'
228