forked from mapnik/python-mapnik
-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (201 loc) · 7.07 KB
/
Copy pathtest.yml
File metadata and controls
225 lines (201 loc) · 7.07 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
name: Test
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
workflow_call:
jobs:
test-linux:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
container: python:3.12-bookworm
platform: linux_x86_64
arch: x86_64
arch_label: x86_64
- os: ubuntu-24.04-arm
container: python:3.12-bookworm
platform: linux_aarch64
arch: arm64
arch_label: arm64
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
UV_LINK_MODE: copy
UV_CACHE_DIR: /github/home/.cache/uv
permissions:
actions: write
contents: read
checks: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Cache uv downloads
uses: actions/cache@v5
with:
path: /github/home/.cache/uv
key: uvcache-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
restore-keys: |
uvcache-${{ runner.os }}-${{ matrix.arch_label }}-
- name: Cache uv virtual environment and build artifacts
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'setup.py') }}-${{ hashFiles('src/**/*.cpp', 'src/**/*.hpp', 'packaging/**/*.py') }}
restore-keys: |
venv-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'setup.py') }}-
venv-${{ runner.os }}-${{ matrix.arch_label }}-
- name: Add Debian sid repository
run: |
echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list.d/sid.list
echo 'Package: *\nPin: release a=sid\nPin-Priority: 100' > /etc/apt/preferences.d/sid
- name: Install system dependencies
run: |
apt-get update
# Ensure /etc/os-release exists (required by some actions' OS detection).
apt-get install -y base-files
apt-get install -y build-essential pkg-config libbz2-dev
apt-get install -y -t sid libmapnik-dev fonts-noto-cjk
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
# Work around container-job failures determining Linux distribution during
# setup-uv's built-in caching path; we cache UV_CACHE_DIR ourselves above.
enable-cache: false
- name: Install Python dependencies and build package
run: |
# Use lockfile when present; avoid doing two full syncs (which can rebuild twice).
if [ -f uv.lock ]; then
uv sync --extra test --frozen --verbose
else
uv sync --extra test --verbose
fi
- name: Run tests with coverage
run: |
uv run pytest test/python_tests -v \
--cov=mapnik \
--cov-report=term \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov \
--junitxml=junit.xml
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-reports-linux-${{ matrix.arch_label }}
path: |
coverage.xml
htmlcov/
junit.xml
retention-days: 30
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: junit.xml
check_name: Test Results (Linux ${{ matrix.arch_label }})
comment_mode: off
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: always()
with:
files: ./coverage.xml
flags: unittests-linux-${{ matrix.arch_label }}
name: python-mapnik-coverage-linux-${{ matrix.arch_label }}
fail_ci_if_error: false
test-macos:
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
platform: macosx_10_9_x86_64
arch: x86_64
arch_label: x86_64
- os: macos-14
platform: macosx_11_0_arm64
arch: arm64
arch_label: arm64
runs-on: ${{ matrix.os }}
env:
UV_LINK_MODE: copy
UV_CACHE_DIR: /Users/runner/.cache/uv
permissions:
actions: write
contents: read
checks: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Cache uv downloads
uses: actions/cache@v5
with:
path: /Users/runner/.cache/uv
key: uvcache-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
restore-keys: |
uvcache-${{ runner.os }}-${{ matrix.arch_label }}-
- name: Cache uv virtual environment and build artifacts
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'setup.py') }}-${{ hashFiles('src/**/*.cpp', 'src/**/*.hpp', 'packaging/**/*.py') }}
restore-keys: |
venv-${{ runner.os }}-${{ matrix.arch_label }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'setup.py') }}-
venv-${{ runner.os }}-${{ matrix.arch_label }}-
- name: Install system dependencies
run: |
brew update
brew install mapnik
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: false
- name: Install Python dependencies and build package
run: |
# Use lockfile when present; avoid doing two full syncs (which can rebuild twice).
if [ -f uv.lock ]; then
uv sync --extra test --frozen --verbose
else
uv sync --extra test --verbose
fi
- name: Run tests with coverage
run: |
uv run pytest test/python_tests -v \
--cov=mapnik \
--cov-report=term \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov \
--junitxml=junit.xml
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-reports-macos-${{ matrix.arch_label }}
path: |
coverage.xml
htmlcov/
junit.xml
retention-days: 30
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: junit.xml
check_name: Test Results (macOS ${{ matrix.arch_label }})
comment_mode: off
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: always()
with:
files: ./coverage.xml
flags: unittests-macos-${{ matrix.arch_label }}
name: python-mapnik-coverage-macos-${{ matrix.arch_label }}
fail_ci_if_error: false