Merge pull request #375 from lazka/ci-cleanup #451
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@v4 | |
- 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" | |
PYTHONDEVMODE=1 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@v4 | |
- 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.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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 | |
pipx install poetry | |
pipx install meson | |
poetry install | |
poetry run pip install --upgrade pygame || true | |
poetry run pip install --upgrade numpy || true | |
- name: Build & Test with meson | |
run: | | |
poetry run meson --werror _build | |
poetry run meson compile -C _build | |
poetry run meson test -v -C _build | |
rm -Rf _build | |
- name: Build & Test with poetry | |
run: | | |
export CFLAGS="-Werror -coverage" | |
export PYTHONDEVMODE=1 | |
poetry run pip install -e . | |
poetry run coverage run --branch -m pytest | |
poetry run coverage xml -i | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
- name: Run linters | |
if: ${{ matrix.python-version != 'pypy-3.10' }} | |
run: | | |
poetry run flake8 | |
poetry run mypy . | |
- name: Build docs | |
if: ${{ matrix.python-version != 'pypy-3.10' }} | |
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.9', '3.10', '3.11', '3.12', '3.13'] | |
architecture: ['x86', 'x64'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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: Setup MSVC | |
uses: ilammy/[email protected] | |
with: | |
arch : ${{ matrix.architecture }} | |
- name: Build | |
env: | |
PKG_CONFIG: ${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe | |
PKG_CONFIG_PATH: ${{ github.workspace }}/cairo-prebuild/lib/pkgconfig | |
CFLAGS: "-DCAIRO_WIN32_STATIC_BUILD=1" | |
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 -X dev -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@v4 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.python-version }}-${{ matrix.architecture }} | |
path: dist/pycairo*.whl | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
brew install pkg-config cairo python meson | |
python3 -m venv _venv | |
source _venv/bin/activate | |
python3 -m pip install --upgrade setuptools | |
python3 -m pip install --upgrade pytest coverage hypothesis wheel | |
- name: Build & Test with setuptools | |
run: | | |
source _venv/bin/activate | |
PYTHONDEVMODE=1 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@v4 | |
- name: Build & Install with pip | |
run: | | |
git clean -xfdf | |
python3 -m venv _venv | |
source _venv/bin/activate | |
python3 -m pip install . | |
- name: Build & Test with meson | |
run: | | |
git clean -xfdf | |
python3 -m venv _venv | |
source _venv/bin/activate | |
python3 -m pip install --upgrade pytest hypothesis | |
meson --werror _build | |
meson compile -C _build | |
meson test -v -C _build |