Merge pull request #333 from sitic/patch-1 #346
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: Test | |
on: | |
push: | |
pull_request: | |
jobs: | |
msys2: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- msystem: MINGW64 | |
arch: x86_64 | |
- msystem: MINGW32 | |
arch: i686 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: setup-msys2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msystem }} | |
update: true | |
install: >- | |
git | |
mingw-w64-${{ matrix.arch }}-cairo | |
mingw-w64-${{ matrix.arch }}-python | |
mingw-w64-${{ matrix.arch }}-python-pip | |
mingw-w64-${{ matrix.arch }}-cc | |
mingw-w64-${{ matrix.arch }}-meson | |
mingw-w64-${{ matrix.arch }}-ninja | |
mingw-w64-${{ matrix.arch }}-pkg-config | |
- name: Install dependencies | |
shell: msys2 {0} | |
run: | | |
python -m pip install pytest coverage hypothesis setuptools wheel | |
- name: Build & Test with setuptools | |
shell: msys2 {0} | |
run: | | |
export SETUPTOOLS_USE_DISTUTILS=stdlib | |
export CFLAGS="-std=c90 -Wall -Wno-long-long -Werror -coverage" | |
python -m coverage run --branch setup.py test | |
python -m coverage xml -i | |
python setup.py sdist | |
python setup.py bdist_wheel | |
python setup.py install --root="$(pwd)"/_root_abs | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Build & Install with pip | |
shell: msys2 {0} | |
run: | | |
git clean -xfdf | |
export SETUPTOOLS_USE_DISTUTILS=stdlib | |
python -m pip install . | |
- name: Build & Test with meson | |
shell: msys2 {0} | |
run: | | |
git clean -xfdf | |
meson --werror _build | |
meson compile -C _build | |
meson test -v -C _build | |
ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -q | |
sudo apt-get install -y libcairo2-dev ninja-build | |
python -m pip install --upgrade setuptools | |
python -m pip install --upgrade pytest flake8 coverage hypothesis wheel poetry meson | |
python -m pip install --upgrade pygame || true | |
- name: Build & Test with setuptools | |
run: | | |
export CFLAGS="-Werror -coverage" | |
python -m coverage run --branch setup.py test | |
python -m coverage xml -i | |
python setup.py sdist | |
python setup.py bdist_wheel | |
python setup.py install --root="$(pwd)"/_root_abs | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Build & Install with pip | |
run: | | |
git clean -xfdf | |
python -m pip install . | |
- name: Build & Test with meson | |
run: | | |
git clean -xfdf | |
meson --werror _build | |
meson compile -C _build | |
meson test -v -C _build | |
- name: Build & Test with poetry | |
if: ${{ matrix.python-version != 'pypy-3.8' }} | |
run: | | |
git clean -xfdf | |
poetry install | |
poetry run python setup.py test | |
- name: Run linters | |
if: ${{ matrix.python-version != 'pypy-3.8' }} | |
run: | | |
poetry run flake8 | |
poetry run mypy . | |
- name: Build docs | |
if: ${{ matrix.python-version != 'pypy-3.8' }} | |
run: | | |
poetry run python -m sphinx -W -a -E -b html -n docs docs/_build | |
msvc: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
architecture: ['x86', 'x64'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
allow-prereleases: true | |
- name: Download and extract Cairo Binary | |
run: | | |
python .ci/download-cairo-win32.py | |
- name: Build | |
env: | |
PKG_CONFIG: ${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe | |
PKG_CONFIG_PATH: ${{ github.workspace }}/cairo-prebuild/lib/pkgconfig | |
run: | | |
python -m pip install --upgrade pip | |
if (-not $?) { exit 1 } | |
python -m pip install --upgrade wheel | |
if (-not $?) { exit 1 } | |
python -m pip install --upgrade setuptools | |
if (-not $?) { exit 1 } | |
python -m pip install --upgrade pytest flake8 coverage hypothesis | |
if (-not $?) { exit 1 } | |
python -m pip install --upgrade pygame | |
python -m coverage run --branch setup.py test | |
if (-not $?) { exit 1 } | |
python -m coverage xml -i | |
if (-not $?) { exit 1 } | |
python -m flake8 . | |
if (-not $?) { exit 1 } | |
python setup.py sdist | |
if (-not $?) { exit 1 } | |
python setup.py bdist | |
if (-not $?) { exit 1 } | |
python setup.py install --root=_root | |
if (-not $?) { exit 1 } | |
python setup.py bdist_wheel | |
if (-not $?) { exit 1 } | |
python setup.py install --root=_root_setup | |
if (-not $?) { exit 1 } | |
python -m pip install . | |
if (-not $?) { exit 1 } | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels-${{ matrix.python-version }} | |
path: dist/pycairo*.whl | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
brew install pkg-config cairo python meson | |
python3 -m pip install --upgrade setuptools | |
python3 -m pip install --upgrade pytest coverage hypothesis wheel | |
- name: Build & Test with setuptools | |
run: | | |
python3 -m coverage run --branch setup.py test | |
python3 -m coverage xml -i | |
python3 setup.py sdist | |
python3 setup.py install --root="$(pwd)"/_root_abs | |
python3 setup.py bdist_wheel | |
python3 -m pip install . | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Build & Install with pip | |
run: | | |
git clean -xfdf | |
python3 -m pip install . | |
- name: Build & Test with meson | |
run: | | |
git clean -xfdf | |
meson --werror _build | |
meson compile -C _build | |
meson test -v -C _build |