| 1 | name: Test |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | |
| 7 | jobs: |
| 8 | |
| 9 | msys2: |
| 10 | runs-on: windows-latest |
| 11 | strategy: |
| 12 | fail-fast: false |
| 13 | matrix: |
| 14 | include: |
| 15 | - msystem: MINGW64 |
| 16 | pkgprefix: mingw-w64-x86_64 |
| 17 | - msystem: CLANG64 |
| 18 | pkgprefix: mingw-w64-clang-x86_64 |
| 19 | steps: |
| 20 | - name: Checkout code |
| 21 | uses: actions/checkout@v4 |
| 22 | |
| 23 | - name: setup-msys2 |
| 24 | uses: msys2/setup-msys2@v2 |
| 25 | with: |
| 26 | msystem: ${{ matrix.msystem }} |
| 27 | update: true |
| 28 | install: >- |
| 29 | ${{ matrix.pkgprefix }}-cairo |
| 30 | ${{ matrix.pkgprefix }}-python |
| 31 | ${{ matrix.pkgprefix }}-python-pip |
| 32 | ${{ matrix.pkgprefix }}-python-poetry |
| 33 | ${{ matrix.pkgprefix }}-cc |
| 34 | ${{ matrix.pkgprefix }}-meson |
| 35 | ${{ matrix.pkgprefix }}-ninja |
| 36 | ${{ matrix.pkgprefix }}-pkgconf |
| 37 | |
| 38 | - name: Install dependencies |
| 39 | shell: msys2 {0} |
| 40 | run: | |
| 41 | # XXX: set CC for setuptools so it finds clang |
| 42 | export CC=cc |
| 43 | poetry install |
| 44 | |
| 45 | - name: Build & Test with meson |
| 46 | shell: msys2 {0} |
| 47 | run: | |
| 48 | # XXX: pass python, so global python3 doesn't win |
| 49 | poetry run meson setup -Dpython=python --werror _build |
| 50 | poetry run meson compile -C _build |
| 51 | poetry run meson test -v -C _build |
| 52 | rm -Rf _build |
| 53 | |
| 54 | - name: Build & Test with poetry |
| 55 | shell: msys2 {0} |
| 56 | run: | |
| 57 | export CFLAGS="-Werror -coverage" |
| 58 | export PYTHONDEVMODE=1 |
| 59 | poetry run pip install --no-build-isolation -e . |
| 60 | poetry run coverage run --branch -m pytest |
| 61 | poetry run coverage xml -i |
| 62 | |
| 63 | - name: Upload coverage to Codecov |
| 64 | uses: codecov/codecov-action@v4 |
| 65 | |
| 66 | ubuntu: |
| 67 | runs-on: ubuntu-latest |
| 68 | strategy: |
| 69 | fail-fast: false |
| 70 | matrix: |
| 71 | python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10'] |
| 72 | steps: |
| 73 | - uses: actions/checkout@v4 |
| 74 | |
| 75 | - name: Set up Python ${{ matrix.python-version }} |
| 76 | uses: actions/setup-python@v5 |
| 77 | with: |
| 78 | python-version: ${{ matrix.python-version }} |
| 79 | allow-prereleases: true |
| 80 | |
| 81 | - name: Install dependencies |
| 82 | run: | |
| 83 | sudo apt-get update -q |
| 84 | sudo apt-get install -y libcairo2-dev ninja-build |
| 85 | pipx install poetry |
| 86 | pipx install meson |
| 87 | poetry install |
| 88 | poetry run pip install --upgrade pygame || true |
| 89 | poetry run pip install --upgrade numpy || true |
| 90 | |
| 91 | - name: Build & Test with meson |
| 92 | run: | |
| 93 | poetry run meson setup --werror _build |
| 94 | poetry run meson compile -C _build |
| 95 | poetry run meson test -v -C _build |
| 96 | rm -Rf _build |
| 97 | |
| 98 | - name: Build & Test with poetry |
| 99 | run: | |
| 100 | export CFLAGS="-Werror -coverage" |
| 101 | export PYTHONDEVMODE=1 |
| 102 | poetry run pip install --no-build-isolation -e . |
| 103 | poetry run coverage run --branch -m pytest |
| 104 | poetry run coverage xml -i |
| 105 | |
| 106 | - name: Upload coverage to Codecov |
| 107 | uses: codecov/codecov-action@v4 |
| 108 | |
| 109 | - name: Run linters |
| 110 | if: ${{ matrix.python-version != 'pypy-3.10' }} |
| 111 | run: | |
| 112 | poetry run flake8 |
| 113 | poetry run mypy . |
| 114 | |
| 115 | - name: Build docs |
| 116 | if: ${{ matrix.python-version != 'pypy-3.10' }} |
| 117 | run: | |
| 118 | poetry run python -m sphinx -W -a -E -b html -n docs docs/_build |
| 119 | |
| 120 | msvc: |
| 121 | runs-on: windows-latest |
| 122 | strategy: |
| 123 | fail-fast: false |
| 124 | matrix: |
| 125 | python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 126 | architecture: ['x64'] |
| 127 | include: |
| 128 | - python-version: '3.9' |
| 129 | architecture: 'x86' |
| 130 | - python-version: '3.13' |
| 131 | architecture: 'x86' |
| 132 | |
| 133 | steps: |
| 134 | - uses: actions/checkout@v4 |
| 135 | |
| 136 | - name: Set up Python ${{ matrix.python-version }} |
| 137 | id: setup-python |
| 138 | uses: actions/setup-python@v5 |
| 139 | with: |
| 140 | python-version: ${{ matrix.python-version }} |
| 141 | architecture: ${{ matrix.architecture }} |
| 142 | allow-prereleases: true |
| 143 | |
| 144 | - name: Setup MSVC |
| 145 | uses: ilammy/[email protected] |
| 146 | with: |
| 147 | arch : ${{ matrix.architecture }} |
| 148 | |
| 149 | - name: Download and extract Cairo Binary |
| 150 | run: | |
| 151 | python .ci/download-cairo-win32.py |
| 152 | |
| 153 | - name: Install dependencies |
| 154 | run: | |
| 155 | pipx install --python "${{ steps.setup-python.outputs.python-path }}" poetry |
| 156 | pipx install --python "${{ steps.setup-python.outputs.python-path }}" meson |
| 157 | poetry install |
| 158 | |
| 159 | - name: Build & Test with meson |
| 160 | env: |
| 161 | PKG_CONFIG: ${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe |
| 162 | PKG_CONFIG_PATH: ${{ github.workspace }}/cairo-prebuild/lib/pkgconfig |
| 163 | CFLAGS: "-DCAIRO_WIN32_STATIC_BUILD=1" |
| 164 | run: | |
| 165 | # XXX: pass python, so global python3 doesn't win |
| 166 | poetry run meson setup -Dpython=python --werror _build |
| 167 | poetry run meson compile -C _build |
| 168 | poetry run meson test -v -C _build |
| 169 | if (-not $?) { exit 1 } |
| 170 | rm -r _build |
| 171 | |
| 172 | - name: Build & Test with poetry |
| 173 | env: |
| 174 | PKG_CONFIG: ${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe |
| 175 | PKG_CONFIG_PATH: ${{ github.workspace }}/cairo-prebuild/lib/pkgconfig |
| 176 | CFLAGS: "-DCAIRO_WIN32_STATIC_BUILD=1" |
| 177 | PYTHONDEVMODE: 1 |
| 178 | run: | |
| 179 | poetry run pip install --no-build-isolation -e . |
| 180 | poetry run coverage run --branch -m pytest |
| 181 | if (-not $?) { exit 1 } |
| 182 | poetry run coverage xml -i |
| 183 | |
| 184 | - name: Upload coverage to Codecov |
| 185 | uses: codecov/codecov-action@v4 |
| 186 | |
| 187 | macos: |
| 188 | runs-on: macos-latest |
| 189 | |
| 190 | steps: |
| 191 | - name: Checkout code |
| 192 | uses: actions/checkout@v4 |
| 193 | |
| 194 | - name: Install dependencies |
| 195 | run: | |
| 196 | brew install pkg-config cairo python meson poetry ninja |
| 197 | poetry install |
| 198 | |
| 199 | - name: Build & Test with meson |
| 200 | run: | |
| 201 | poetry run meson setup --werror _build |
| 202 | poetry run meson compile -C _build |
| 203 | poetry run meson test -v -C _build |
| 204 | rm -Rf _build |
| 205 | |
| 206 | - name: Build & Test with poetry |
| 207 | run: | |
| 208 | export CFLAGS="-Werror -coverage" |
| 209 | export PYTHONDEVMODE=1 |
| 210 | poetry run pip install --no-build-isolation -e . |
| 211 | poetry run coverage run --branch -m pytest |
| 212 | poetry run coverage xml -i |
| 213 | |
| 214 | - name: Upload coverage to Codecov |
| 215 | uses: codecov/codecov-action@v4 |