-
Notifications
You must be signed in to change notification settings - Fork 86
215 lines (184 loc) · 6.49 KB
/
test.yml
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
name: Test
on:
push:
pull_request:
jobs:
msys2:
runs-on: windows-latest
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@v4
- name: setup-msys2
uses: msys2/setup-msys2@v2
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@v4
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 setup --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 --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@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: ['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: Setup MSVC
uses: ilammy/[email protected]
with:
arch : ${{ matrix.architecture }}
- 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: |
# 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 }
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 --no-build-isolation -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
macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install pkg-config cairo python meson poetry ninja
poetry install
- name: Build & Test with meson
run: |
poetry run meson setup --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 --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@v4