Merge pull request #194 from asmeurer/intersphinx-registry #531
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |