diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ba12a2..97f6c16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,9 @@ jobs: matrix: include: - msystem: MINGW64 - arch: x86_64 - - msystem: MINGW32 - arch: i686 + pkgprefix: mingw-w64-x86_64 + - msystem: CLANG64 + pkgprefix: mingw-w64-clang-x86_64 steps: - name: Checkout code uses: actions/checkout@v4 @@ -26,48 +26,42 @@ jobs: 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 + ${{ matrix.pkgprefix }}-cairo + ${{ matrix.pkgprefix }}-python + ${{ matrix.pkgprefix }}-python-pip + ${{ matrix.pkgprefix }}-python-poetry + ${{ matrix.pkgprefix }}-cc + ${{ matrix.pkgprefix }}-meson + ${{ matrix.pkgprefix }}-ninja + ${{ matrix.pkgprefix }}-pkgconf - name: Install dependencies shell: msys2 {0} run: | - python -m pip install pytest coverage hypothesis setuptools wheel + # XXX: set CC for setuptools so it finds clang + export CC=cc + poetry install - - name: Build & Test with setuptools + - name: Build & Test with meson 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 + # XXX: pass python, so global python3 doesn't win + poetry run meson setup -Dpython=python --werror _build + poetry run meson compile -C _build + poetry run meson test -v -C _build + rm -Rf _build - - name: Build & Install with pip + - name: Build & Test with poetry shell: msys2 {0} run: | - git clean -xfdf - export SETUPTOOLS_USE_DISTUTILS=stdlib - python -m pip install . + 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: Build & Test with meson - shell: msys2 {0} - run: | - git clean -xfdf - meson --werror _build - meson compile -C _build - meson test -v -C _build + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 ubuntu: runs-on: ubuntu-latest @@ -96,7 +90,7 @@ jobs: - name: Build & Test with meson run: | - poetry run meson --werror _build + poetry run meson setup --werror _build poetry run meson compile -C _build poetry run meson test -v -C _build rm -Rf _build @@ -129,68 +123,67 @@ jobs: fail-fast: false matrix: python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] - architecture: ['x86', 'x64'] + architecture: ['x64'] + include: + - python-version: '3.9' + architecture: 'x86' + - python-version: '3.13' + architecture: 'x86' + steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} + id: setup-python 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/msvc-dev-cmd@v1.13.0 with: arch : ${{ matrix.architecture }} - - name: Build + - name: Download and extract Cairo Binary + run: | + python .ci/download-cairo-win32.py + + - name: Install dependencies + run: | + pipx install --python "${{ steps.setup-python.outputs.python-path }}" poetry + pipx install --python "${{ steps.setup-python.outputs.python-path }}" meson + poetry install + + - name: Build & Test with meson 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 + # XXX: pass python, so global python3 doesn't win + poetry run meson setup -Dpython=python --werror _build + poetry run meson compile -C _build + poetry run meson test -v -C _build 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 . + rm -r _build + + - name: Build & Test with poetry + 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" + PYTHONDEVMODE: 1 + run: | + poetry run pip install -e . + poetry run coverage run --branch -m pytest if (-not $?) { exit 1 } + poetry run coverage xml -i - 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 @@ -200,38 +193,23 @@ jobs: - 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 + brew install pkg-config cairo python meson poetry ninja + poetry install - - name: Build & Test with setuptools + - name: Build & Test with meson 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 + poetry run meson setup --werror _build + poetry run meson compile -C _build + poetry run meson test -v -C _build + rm -Rf _build - - name: Build & Install with pip + - name: Build & Test with poetry run: | - git clean -xfdf - python3 -m venv _venv - source _venv/bin/activate - python3 -m pip install . + 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: 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 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4