Skip to content

Fix test suite.

Fix test suite. #183

Workflow file for this run

name: build
on: [push, pull_request]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build & install
shell: bash
run: |
set -x &&
export DISTUTILS_DEBUG=1 &&
python -mpip install --upgrade pip &&
case "$(python -c 'import sys; print(sys.platform)')" in
linux)
sudo PY_VERS='${{ matrix.python-version }}' tools/build-manylinux-wheel.sh &&
sudo apt update &&
sudo apt install ghostscript inkscape cm-super dvipng \
texlive-latex-{base,recommended,extra} texlive-fonts-recommended
;;
darwin)
# Don't install inkscape: building it from source is a bit silly.
export HOMEBREW_NO_INSTALL_CLEANUP=1 &&
brew install cairo pkg-config &&
MACOSX_DEPLOYMENT_TARGET=10.13 PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig \
tools/build-macos-wheel.sh &&
brew install ghostscript
;;
win32)
# Don't install inkscape (see note in run-mpl-test-suite.py).
# Skip known-bad version of numpy.
python -mpip install setuptools &&
python tools/build-windows-wheel.py &&
choco install --no-progress ghostscript &&
pip install 'numpy!=1.19.4'
;;
*)
exit 1
;;
esac &&
python -mpip install dist/*.whl &&
python tools/ensure-mpl-test-data.py &&
# pytest-{instafail,timeout} useful for hanging tests.
python -mpip install pytest pytest-instafail pytest-timeout
- name: Test
shell: bash
run: |
set -x &&
python -mpip list &&
python -c 'import mplcairo as m, pprint as p; p.pprint(m.get_versions())' &&
# Skip tests triggering to-be-investigated fatal error on Windows :(
(
if [[ "$(python -c 'import sys; print(sys.platform)')" != win32 ]]; then
./run-mpl-test-suite.py --tolerance=55 --instafail --timeout=300 --capture=no --verbose
fi
) &&
PYTHONFAULTHANDLER=1 PYTHONIOENCODING=utf-8 ./run-examples.py
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/*.whl
if: ${{ always() }}
- uses: actions/upload-artifact@v4
with:
name: result_images-${{ matrix.os }}-py${{ matrix.python-version }}
path: result_images/
if: ${{ failure() }}
merge-wheels:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/upload-artifact/merge@v4
with:
name: wheels
pattern: wheel-*
delete-merged: true