Debian Codegraph @

.github/workflows/test.yml

raw
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@v5
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@v5
65
66 ubuntu:
67 runs-on: ubuntu-latest
68 strategy:
69 fail-fast: false
70 matrix:
71 python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t', 'pypy-3.11']
72 steps:
73 - uses: actions/checkout@v5
74
75 - name: Set up Python ${{ matrix.python-version }}
76 uses: actions/setup-python@v6
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 uv
86 pipx install meson
87 uv sync
88
89 - name: Install optional test dependencies
90 if: ${{ !contains(matrix.python-version, 'pypy') && !contains(matrix.python-version, '3.14') }}
91 run: |
92 uv sync --group test-extras
93
94 - name: Build & Test with meson
95 run: |
96 uv run meson setup --werror _build
97 uv run meson compile -C _build
98 uv run meson test -v -C _build
99 rm -Rf _build
100
101 - name: Build & Test with uv
102 run: |
103 export CFLAGS="-Werror -coverage"
104 export PYTHONDEVMODE=1
105 uv pip install --no-build-isolation -e .
106 uv run coverage run --branch -m pytest
107 uv run coverage xml -i
108
109 - name: Upload coverage to Codecov
110 uses: codecov/codecov-action@v5
111
112 - name: Run linters
113 if: ${{ !contains(matrix.python-version, 'pypy') }}
114 run: |
115 uv run flake8
116 uv run mypy .
117
118 - name: Build docs
119 if: ${{ !contains(matrix.python-version, 'pypy') }}
120 run: |
121 uv sync --group docs
122 uv run python -m sphinx -W -a -E -b html -n docs docs/_build
123
124 msvc:
125 runs-on: ${{ matrix.os }}
126 strategy:
127 fail-fast: false
128 matrix:
129 python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t', 'pypy-3.11']
130 architecture: ['x64']
131 os: ['windows-2022']
132 include:
133 - python-version: '3.10'
134 architecture: 'x86'
135 os: 'windows-2022'
136 - python-version: '3.14'
137 architecture: 'x86'
138 os: 'windows-2022'
139 - python-version: '3.14'
140 architecture: 'arm64'
141 os: 'windows-11-arm'
142 steps:
143 - uses: actions/checkout@v5
144
145 - name: Set up Python ${{ matrix.python-version }}
146 id: setup-python
147 uses: actions/setup-python@v6
148 with:
149 python-version: ${{ matrix.python-version }}
150 architecture: ${{ matrix.architecture }}
151 allow-prereleases: true
152
153 - name: Setup MSVC
154 uses: ilammy/[email protected]
155 with:
156 arch : ${{ matrix.architecture }}
157
158 - name: Download and extract Cairo Binary
159 run: |
160 python .ci/download-cairo-win32.py "${{ matrix.architecture }}"
161
162 - name: Install dependencies
163 run: |
164 pipx install --python "${{ steps.setup-python.outputs.python-path }}" uv
165 pipx install --python "${{ steps.setup-python.outputs.python-path }}" meson
166 uv sync
167
168 - name: Build & Test with meson
169 env:
170 PKG_CONFIG: ${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe
171 PKG_CONFIG_PATH: ${{ github.workspace }}/cairo-prebuild/lib/pkgconfig
172 CFLAGS: "-DCAIRO_WIN32_STATIC_BUILD=1"
173 run: |
174 # XXX: pass python, so global python3 doesn't win
175 uv run meson setup -Dpython=python --werror _build
176 uv run meson compile -C _build
177 uv run meson test -v -C _build
178 if (-not $?) { exit 1 }
179 rm -r _build
180
181 - name: Build & Test with uv
182 env:
183 PKG_CONFIG: ${{ github.workspace }}/cairo-prebuild/bin/pkgconf.exe
184 PKG_CONFIG_PATH: ${{ github.workspace }}/cairo-prebuild/lib/pkgconfig
185 CFLAGS: "-DCAIRO_WIN32_STATIC_BUILD=1"
186 PYTHONDEVMODE: 1
187 run: |
188 uv pip install --no-build-isolation -e .
189 uv run coverage run --branch -m pytest
190 if (-not $?) { exit 1 }
191 uv run coverage xml -i
192
193 - name: Upload coverage to Codecov
194 uses: codecov/codecov-action@v5
195
196 macos:
197 runs-on: macos-latest
198
199 steps:
200 - name: Checkout code
201 uses: actions/checkout@v5
202
203 - name: Install dependencies
204 run: |
205 brew install pkg-config cairo python meson ninja uv
206 uv sync
207
208 - name: Build & Test with meson
209 run: |
210 uv run meson setup --werror _build
211 uv run meson compile -C _build
212 uv run meson test -v -C _build
213 rm -Rf _build
214
215 - name: Build & Test with uv
216 run: |
217 export CFLAGS="-Werror -coverage"
218 export PYTHONDEVMODE=1
219 uv pip install --no-build-isolation -e .
220 uv run coverage run --branch -m pytest
221 uv run coverage xml -i
222
223 - name: Upload coverage to Codecov
224 uses: codecov/codecov-action@v5