-
-
Notifications
You must be signed in to change notification settings - Fork 538
302 lines (279 loc) · 11 KB
/
Copy pathtests.yml
File metadata and controls
302 lines (279 loc) · 11 KB
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Tests
on:
push:
branches:
- v1.**
pull_request:
branches:
- main
- v1.**
concurrency:
# avoid duplicate runs on both pushes and PRs
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Coloured output for GitHub Actions
FORCE_COLOR: 3
# Some common environment variables for both GNU/Linux and macOS jobs
MPLBACKEND: Agg
NUMPY_MIN: numpy==1.26.4
CYTHON_MIN: cython==3.1.3
jobs:
test_pywavelets_linux:
name: ${{ matrix.runs-on }}-cp${{ matrix.python-version }}-${{ matrix.OPTIONS_NAME }}
runs-on: ${{ matrix.runs-on }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
runs-on: [ubuntu-latest] # Arm runner tested separately, see below
python-version: ["3.12", "3.14"]
MINIMUM_REQUIREMENTS: [0]
USE_SDIST: [0]
REFGUIDE_CHECK: [1]
PIP_FLAGS: [""]
OPTIONS_NAME: ["default"]
include:
# Linux arm64
- runs-on: ubuntu-22.04-arm
python-version: "3.14"
# Linux amd64
- runs-on: ubuntu-latest
python-version: "3.12"
MINIMUM_REQUIREMENTS: 1
OPTIONS_NAME: "minimum-req"
- runs-on: ubuntu-latest
python-version: "3.12"
- runs-on: ubuntu-latest
python-version: "3.14"
USE_SDIST: 1
OPTIONS_NAME: "install-from-sdist"
- runs-on: ubuntu-latest
python-version: "3.14"
PIP_FLAGS: "--pre"
OPTIONS_NAME: "pre-releases"
- runs-on: ubuntu-latest
python-version: "3.14"
OPTIONS_NAME: "editable-install"
steps:
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v4.1.2
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v5.5.0
with:
python-version: ${{ matrix.python-version}}
allow-prereleases: true
- name: Build package
env:
VERSION: ${{ matrix.python-version }}
MINIMUM_REQUIREMENTS: ${{ matrix.MINIMUM_REQUIREMENTS }}
PIP_FLAGS: ${{ matrix.PIP_FLAGS }}
USE_SDIST: ${{ matrix.USE_SDIST }}
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
OPTIONS_NAME: ${{ matrix.OPTIONS_NAME }}
run: |
uname -a
df -h
ulimit -a
# ccache -s
which python
python --version
# sudo apt-get install libatlas-base-dev
pip install --upgrade pip build
# Set numpy version first, other packages link against it
if [ "${MINIMUM_REQUIREMENTS}" == "1" ]; then
pip install ${CYTHON_MIN}
pip install ${NUMPY_MIN}
else
pip install ${PIP_FLAGS} cython
pip install ${PIP_FLAGS} numpy
fi
pip install ${PIP_FLAGS} matplotlib pytest
set -o pipefail
if [ "${USE_SDIST}" == "1" ]; then
python -m build --sdist
pip install dist/pyw*.tar.gz -v
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
pip install sphinx numpydoc scipy-doctest
pip install . -v
else
pip install . -v
fi
if [ "${OPTIONS_NAME}" == "editable-install" ]; then
pip install meson-python>=0.16.0 matplotlib pytest ninja
pip install -e . --no-build-isolation
fi
- name: Run tests
env:
USE_SDIST: ${{ matrix.USE_SDIST }}
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
OPTIONS_NAME: ${{ matrix.OPTIONS_NAME }}
run: |
set -o pipefail
# Move out of source directory to avoid finding local pywt
pushd demo
if [ "${USE_SDIST}" == "1" ]; then
pytest --pyargs pywt
python ../pywt/tests/test_doc.py
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
# doctest docstrings
pytest --doctest-modules --pyargs pywt -v --doctest-collect=api
# Run Sphinx HTML docs builder, converting warnings to errors
# Move back out of demo/ to root directory
cd ..
pip install -r util/readthedocs/requirements.txt
sphinx-build -b html -W --keep-going -d _build/doctrees doc/source doc/build
else
pytest --pyargs pywt
fi
popd
test_pywavelets_linux_free_threaded:
name: linux-cp${{ matrix.python-version }}-default
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.14t"]
steps:
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v4.1.2
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v5.5.0
with:
python-version: ${{ matrix.python-version}}
- name: Build package
run: |
pip install --upgrade pip build
pip install cython numpy meson-python ninja pytest
pip install . -v --no-build-isolation
- name: Run tests
run: |
# Move out of source directory to avoid finding local pywt
cd demo
pytest --pyargs pywt
test_pywavelets_macos:
name: macos-cp${{ matrix.python-version }}-${{ matrix.OPTIONS_NAME }}
runs-on: macos-latest
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
python-version: ["3.12", "3.14"]
MINIMUM_REQUIREMENTS: [0]
USE_SDIST: [0]
REFGUIDE_CHECK: [0]
PIP_FLAGS: [""]
OPTIONS_NAME: ["default"]
include:
- python-version: "3.12"
MINIMUM_REQUIREMENTS: 1
OPTIONS_NAME: "osx-minimum-req"
- python-version: "3.14"
PIP_FLAGS: "--pre"
OPTIONS_NAME: "pre-releases"
steps:
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v4.1.2
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v5.5.0
with:
python-version: ${{ matrix.python-version}}
allow-prereleases: true
- name: Build package
env:
VERSION: ${{ matrix.python-version }}
MINIMUM_REQUIREMENTS: ${{ matrix.MINIMUM_REQUIREMENTS }}
PIP_FLAGS: ${{ matrix.PIP_FLAGS }}
USE_SDIST: ${{ matrix.USE_SDIST }}
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
CC: /usr/bin/clang
CXX: /usr/bin/clang++
run: |
uname -a
df -h
ulimit -a
which python
python --version
pip install --upgrade pip build
# Set numpy version first, other packages link against it
if [ "${MINIMUM_REQUIREMENTS}" == "1" ]; then
pip install ${CYTHON_MIN} ${NUMPY_MIN}
else
pip install ${PIP_FLAGS} cython numpy
fi
pip install ${PIP_FLAGS} matplotlib pytest
set -o pipefail
if [ "${USE_SDIST}" == "1" ]; then
python -m build --sdist
pip install pywavelets* -v
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
pip install sphinx numpydoc scipy-doctest
pip install . -v
else
pip install . -v
fi
- name: Run tests
env:
PIP_FLAGS: ${{ matrix.PIP_FLAGS }}
USE_SDIST: ${{ matrix.USE_SDIST }}
REFGUIDE_CHECK: ${{ matrix.REFGUIDE_CHECK }}
run: |
# Move out of source directory to avoid finding local pywt
pushd demo
if [ "${USE_SDIST}" == "1" ]; then
pytest --pyargs pywt
python ../pywt/tests/test_doc.py
elif [ "${REFGUIDE_CHECK}" == "1" ]; then
# doctests docstrings
pytest --doctest-modules --doctest-only-doctests=true --pyargs pywt -v --doctest-collect=api
pytest --doctest-modules --doctest-only-doctests=true --pyargs pywt.data -v
else
pytest --pyargs pywt
fi
popd
clang_ASan_UBSan:
name: Test under ASan and UBSan
runs-on: ubuntu-latest
container:
# Prebuilt ASan-instrumented CPython 3.14 + clang-21, from
# https://github.com/nascheme/cpython_sanity. To refresh the digest:
# docker pull ghcr.io/nascheme/cpython-asan:3.14 && \
# docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/nascheme/cpython-asan:3.14
image: ghcr.io/nascheme/cpython-asan:3.14@sha256:5e7cfa58bbaff0a31efc199d7d39902b80f99ab526c9c74104cd909ff075fd0a
options: --shm-size=2g
env:
# LeakSanitizer is on by default under ASan on Linux (unlike on macOS, where it is
# unsupported). Without this, every Python subprocess spawned during the build exits
# non-zero over small leaks in CPython's own startup/import code - which breaks meson's
# `run_command(py, ..., check: true)` probe for numpy's include dir. Leak checking for
# the test run itself is configured in the "Test" step below.
ASAN_OPTIONS: detect_leaks=0
steps:
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v4.2.2
with:
submodules: recursive
fetch-tags: true
persist-credentials: false
- name: Trust working directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install NumPy dependencies from PyPI
run: |
pip install meson-python ninja cython
- name: Build NumPy with ASan
run: |
pip install numpy --no-binary numpy --no-build-isolation -Csetup-args="-Db_sanitize=address" -v
# pyenv only creates shims for newly installed scripts on rehash; without this
# `numpy-config` is not on PATH and meson falls back to probing the interpreter
pyenv rehash
- name: Install dependencies from PyPI
run: |
pip install spin pytest pytest-timeout
- name: Build PyWavelets with ASan and UBSan
run: |
export CFLAGS=-fno-sanitize=function # suppressed upstream, see cython#7437
# -j2 rather than -j4: ASan builds are memory-hungry and OOM in CI otherwise
spin build -j2 -- -Db_sanitize=address,undefined -Db_lundef=false
- name: Test
run: |
# pass -s to pytest to see ASAN errors and warnings, otherwise pytest captures them
export ASAN_OPTIONS=detect_leaks=0:symbolize=1:strict_init_order=true:allocator_may_return_null=1:use_sigaltstack=0
export UBSAN_OPTIONS=halt_on_error=1
# test_swt2_iswt2_integration takes ~3.5 minutes under ASan and adds little here:
# it loops swt2/iswt2 over every discrete wavelet, but the same C code is already
# covered by test_swt2_iswt2_quick and test_swtn_iswtn_integration
spin test -- -v -s --timeout=600 --durations=10 \
-k "not test_swt2_iswt2_integration"