-
Notifications
You must be signed in to change notification settings - Fork 12
83 lines (82 loc) · 3.41 KB
/
tests.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
name: Tests
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev']
# https://numpy.org/neps/nep-0029-deprecation_policy.html
numpy-version: ['1.22', 'latest', 'dev']
exclude:
- python-version: '3.12'
numpy-version: '1.22'
- python-version: '3.13-dev'
numpy-version: '1.22'
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
set -x
set -e
python -m pip install -r requirements-dev.txt
if [[ ${{ matrix.numpy-version }} == 'latest' ]]; then
python -m pip install --upgrade numpy
elif [[ ${{ matrix.numpy-version }} == 'dev' ]]; then
python -m pip install --pre --upgrade --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
else
python -m pip install --upgrade numpy==${{ matrix.numpy-version }}.*
fi
- name: Test Installation
run: |
python -m pip install --verbose .
# COVERAGE_CORE=sysmon does not work with Cython. Since coverage is
# really slow without it (see
# https://github.com/nedbat/coveragepy/issues/1665), just omit Cython
# coverage in 3.12. Hopefully by the time it is our minimal version it
# will work with Cython, or trace coverage will be faster again.
- name: Set CYTHON_COVERAGE=1
run: echo "CYTHON_COVERAGE=1" >> $GITHUB_ENV
if: matrix.python-version != '3.12' && matrix.python-version != '3.13-dev'
- name: Disable Coverage Plugin
run: sed -i '/plugins = Cython.Coverage/d' .coveragerc
if: matrix.python-version == '3.12' || matrix.python-version == '3.13-dev'
- name: In-place build
run: |
python setup.py clean
python setup.py build_ext --inplace
- name: Run Doctests
run: |
./run_doctests
# A NumPy 2.0 compatible skimage doesn't support 3.9, and we need a
# version of matplotlib that requires NumPy 1.23. Easiest to just
# skip this for now.
if: matrix.numpy-version != 'dev' && matrix.python-version != '3.9' && matrix.numpy-version != '1.22'
- name: Run Slotscheck
run: |
python -m slotscheck ndindex
# Enable experimental faster sys.monitoring coverage for Python 3.12
- name: Set COVERAGE_CORE=sysmon
run: echo "COVERAGE_CORE=sysmon" >> $GITHUB_ENV
if: matrix.python-version == '3.12' || matrix.python-version == '3.13-dev'
- name: Run Tests
run: |
set -x
set -e
python -We:invalid -We::SyntaxWarning -m compileall -f -q ndindex/
# The coverage requirement check is done by the coverage report line below
PYTEST_FLAGS="$PYTEST_FLAGS -v --cov-fail-under=0";
pytest $PYTEST_FLAGS
# Coverage. This also sets the failing status if the
# coverage is not 100%. Travis sometimes cuts off the last command, which is
# why we print stuff at the end.
if ! coverage report -m; then
echo "Coverage failed";
false;
else
echo "Coverage passed";
fi;