-
Notifications
You must be signed in to change notification settings - Fork 92
245 lines (214 loc) · 7.5 KB
/
test.yml
File metadata and controls
245 lines (214 loc) · 7.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Test
on:
push:
pull_request:
permissions: {}
jobs:
msys2:
runs-on: windows-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- msystem: MINGW64
pkgprefix: mingw-w64-x86_64
- msystem: CLANG64
pkgprefix: mingw-w64-clang-x86_64
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: setup-msys2
uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
${{ 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: |
# XXX: set CC for setuptools so it finds clang
export CC=cc
poetry install
- name: Build & Test with meson
shell: msys2 {0}
run: |
# 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 & Test with poetry
shell: msys2 {0}
run: |
export CFLAGS="-Werror -coverage"
export PYTHONDEVMODE=1
poetry run pip install --no-build-isolation -e .
poetry run coverage run --branch -m pytest
poetry run coverage xml -i
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
ubuntu:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t', 'pypy-3.11']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
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 uv
pipx install meson
uv sync
- name: Install optional test dependencies
if: ${{ !contains(matrix.python-version, 'pypy') && !contains(matrix.python-version, '3.14') }}
run: |
uv sync --group test-extras
- name: Build & Test with meson
run: |
uv run meson setup --werror _build
uv run meson compile -C _build
uv run meson test -v -C _build
rm -Rf _build
- name: Build & Test with uv
run: |
export CFLAGS="-Werror -coverage"
export PYTHONDEVMODE=1
uv pip install --no-build-isolation -e .
uv run coverage run --branch -m pytest
uv run coverage xml -i
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
- name: Run linters
if: ${{ !contains(matrix.python-version, 'pypy') }}
run: |
uv run flake8
uv run mypy .
- name: Build docs
if: ${{ !contains(matrix.python-version, 'pypy') }}
run: |
uv sync --group docs
uv run python -m sphinx -W -a -E -b html -n docs docs/_build
msvc:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t', 'pypy-3.11']
architecture: ['x64']
os: ['windows-2022']
include:
- python-version: '3.10'
architecture: 'x86'
os: 'windows-2022'
- python-version: '3.14'
architecture: 'x86'
os: 'windows-2022'
- python-version: '3.14'
architecture: 'arm64'
os: 'windows-11-arm'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
allow-prereleases: true
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch : ${{ matrix.architecture }}
- name: Download and extract Cairo Binary
env:
PYCAIRO_ARCH: ${{ matrix.architecture }}
run: |
python .ci/download-cairo-win32.py "$env:PYCAIRO_ARCH"
- name: Install dependencies
env:
PYTHON_PATH: ${{ steps.setup-python.outputs.python-path }}
run: |
pipx install --python "$env:PYTHON_PATH" uv
pipx install --python "$env:PYTHON_PATH" meson
uv sync
- 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: |
# XXX: pass python, so global python3 doesn't win
uv run meson setup -Dpython=python --werror _build
uv run meson compile -C _build
uv run meson test -v -C _build
if (-not $?) { exit 1 }
rm -r _build
- name: Build & Test with uv
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: |
uv pip install --no-build-isolation -e .
uv run coverage run --branch -m pytest
if (-not $?) { exit 1 }
uv run coverage xml -i
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
macos:
runs-on: macos-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install dependencies
run: |
brew install pkg-config cairo python meson ninja uv
uv sync
- name: Build & Test with meson
run: |
uv run meson setup --werror _build
uv run meson compile -C _build
uv run meson test -v -C _build
rm -Rf _build
- name: Build & Test with uv
run: |
export CFLAGS="-Werror -coverage"
export PYTHONDEVMODE=1
uv pip install --no-build-isolation -e .
uv run coverage run --branch -m pytest
uv run coverage xml -i
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0