-
Notifications
You must be signed in to change notification settings - Fork 1
443 lines (389 loc) · 14.4 KB
/
windows.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
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
name: Windows
on: [push, pull_request]
jobs:
build-mingw:
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: true
matrix:
build_type: [Release, Debug]
sys: [mingw64]
include:
- sys: mingw64
env: x86_64
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
# Running Ninja requires cmd.exe to be in the PATH
path-type: minimal
install: >-
mingw-w64-${{matrix.env}}-boost
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-eigen3
mingw-w64-${{matrix.env}}-fmt
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-lld
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-opencv
mingw-w64-${{matrix.env}}-pybind11
mingw-w64-${{matrix.env}}-python
mingw-w64-${{matrix.env}}-python-jinja
mingw-w64-${{matrix.env}}-python-lxml
mingw-w64-${{matrix.env}}-python-numpy
mingw-w64-${{matrix.env}}-python-pillow
mingw-w64-${{matrix.env}}-python-pip
mingw-w64-${{matrix.env}}-python-pygments
mingw-w64-${{matrix.env}}-python-pytest
mingw-w64-${{matrix.env}}-python-pytest-xdist
mingw-w64-${{matrix.env}}-python-sphinx
- name: Setup Coverage Dependencies
if: matrix.build_type == 'Debug'
run: |
pip install 'gcovr==8.2'
- name: Setup Dependencies
run: |
pip install -r docs/requirements.txt
- name: Setup Environment
run: |
echo "Python_ROOT=$(dirname $(dirname $(which python)))" >> $GITHUB_ENV
- name: Setup Debug Environment
if: ${{matrix.build_type == 'Debug'}}
run: |
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
- name: Configure
env:
CXX: ${{matrix.env}}-w64-mingw32-g++
CXXFLAGS: -fuse-ld=lld -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wundef -Wfloat-equal -Werror ${{env.CXXFLAGS}}
run: |
cmake -S . -B build_${{matrix.build_type}}/ \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON \
-G Ninja
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}}
- name: Test
run: |
ctest --test-dir build_${{matrix.build_type}} \
-j$(nproc) \
--output-on-failure
- name: Generate Documentation
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}} \
--target sphinx
- name: Generate Coverage
if: matrix.build_type == 'Debug'
run: |
cd build_${{matrix.build_type}}
gcovr -r .. . -s --cobertura coverage.xml
- name: Upload Coverage to Codecov
if: ${{matrix.build_type == 'Debug'}}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build_${{matrix.build_type}}/coverage.xml
fail_ci_if_error: true
verbose: true
build-msvc:
name: ${{matrix.msvc}}-${{matrix.arch}}-${{matrix.build_type}}-Python-${{matrix.python}}
runs-on: ${{matrix.os}}
defaults:
run:
shell: powershell
env:
CL: /MP
strategy:
fail-fast: true
matrix:
arch:
- x64
build_type:
- Debug
- Release
msvc:
- VS-16-2019
- VS-17-2022
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy3.10'
include:
- msvc: VS-16-2019
os: windows-2019
generator: 'Visual Studio 16 2019'
marker: vc16
- msvc: VS-17-2022
os: windows-2022
generator: 'Visual Studio 17 2022'
marker: vc17
- arch: x64
address_model: 64
steps:
- uses: actions/checkout@v4
# NOTE Extracting Boost using Expand-Archive is very slow taking more than
# 20 min. whereas 7z takes less than a 1 min.
- name: Cache Boost
id: cache-boost
uses: actions/cache@v4
with:
path: boost/
key: ${{runner.os}}-boost-1.84-${{matrix.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.7z", "boost_1_84_0.7z");
7z x boost_1_84_0.7z;
- name: Setup Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
cd boost_1_84_0
./bootstrap.bat
./b2 address-model=${{matrix.address_model}} `
variant=$('${{matrix.build_type}}'.ToLower()) `
--prefix=${{github.workspace}}/boost `
--with-test install
- name: Cache Eigen
id: cache-eigen
uses: actions/cache@v4
with:
path: eigen/
key: ${{runner.os}}-eigen-3.4.0
- name: Download Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip", "eigen-3.4.0.zip");
7z x eigen-3.4.0.zip;
- name: Setup Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
cmake -S eigen-3.4.0 -B build-eigen `
-A ${{matrix.arch}} `
-DBUILD_TESTING=OFF `
-DCMAKE_Fortran_COMPILER= `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/eigen `
-DEIGEN_BUILD_DOC=OFF
cmake --build build-eigen --target install
- name: Cache fmt
id: cache-fmt
uses: actions/cache@v4
with:
path: fmt/
key: ${{runner.os}}-fmt-10.2.1-${{matrix.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip", "fmt-10.2.1.zip");
7z x fmt-10.2.1.zip;
- name: Setup fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
cmake -S fmt-10.2.1 -B build-fmt `
-A ${{matrix.arch}} `
-DFMT_TEST=OFF `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/fmt
cmake --build build-fmt `
--config ${{matrix.build_type}} `
--target install
- name: Cache OpenCV
id: cache-opencv
uses: actions/cache@v4
with:
path: opencv/
key: ${{runner.os}}-opencv-4.10.0-${{matrix.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/opencv/opencv/archive/refs/tags/4.10.0.zip", "4.10.0.zip");
7z x 4.10.0.zip;
- name: Setup OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
cmake -S opencv-4.10.0 -B build-opencv `
-A ${{matrix.arch}} `
-DBUILD_LIST="core,imgproc" `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/opencv
cmake --build build-opencv `
--config ${{matrix.build_type}} `
--target install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
architecture: ${{matrix.arch}}
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Setup Dependencies
run: |
pip install -r requirements.txt
- name: Setup Dependencies (VC17)
if: matrix.msvc == 'VS-17-2022'
run: |
# pybind11 prior to version 2.9.0 causes compilation erros in debug
# builds that use Visual Studio 2022.
pip install pybind11>=2.9.0
- name: Setup Environment
run: |
echo "Boost_ROOT=${{github.workspace}}/boost" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "Eigen3_ROOT=${{github.workspace}}/eigen" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "fmt_ROOT=${{github.workspace}}/fmt" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "OpenCV_ROOT=${{github.workspace}}/opencv" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "pybind11_ROOT=$(pybind11-config --cmakedir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Runtime Environment
run: |
echo "${{github.workspace}}/opencv/${{matrix.arch}}/${{matrix.marker}}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "HOGPPPATH=${{github.workspace}}/opencv/${{matrix.arch}}/${{matrix.marker}}/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Configure
env:
CXXFLAGS: /WX
Python_ROOT: ${{env.pythonLocation}}
run: |
cmake -S . -B build_${{matrix.build_type}}/ `
-A ${{matrix.arch}} `
-DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} `
-DCMAKE_INSTALL_PREFIX:PATH=./install `
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON `
-DCMAKE_REQUIRE_FIND_PACKAGE_Python=ON `
-DCMAKE_REQUIRE_FIND_PACKAGE_Sphinx=ON `
-G "${{matrix.generator}}"
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}}
- name: Test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}} `
--target RUN_TESTS
- name: Generate Documentation
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}} `
--target sphinx
build-wheel:
name: Python-${{matrix.python}}-${{matrix.build_type}}-wheel
runs-on: ${{matrix.os}}
defaults:
run:
shell: powershell
env:
CL: /MP
strategy:
fail-fast: true
matrix:
arch:
- x64
build_type:
- Debug
- Release
msvc:
- VS-17-2022
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy3.10'
include:
- msvc: VS-17-2022
os: windows-2022
generator: 'Visual Studio 17 2022'
steps:
- uses: actions/checkout@v4
- name: Cache Eigen
id: cache-eigen
uses: actions/cache@v4
with:
path: eigen/
key: ${{runner.os}}-eigen-3.4.0
- name: Download Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip", "eigen-3.4.0.zip");
7z x eigen-3.4.0.zip;
- name: Setup Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
cmake -S eigen-3.4.0 -B build-eigen `
-A ${{matrix.arch}} `
-DBUILD_TESTING=OFF `
-DCMAKE_Fortran_COMPILER= `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/eigen `
-DEIGEN_BUILD_DOC=OFF
cmake --build build-eigen --target install
- name: Cache fmt
id: cache-fmt
uses: actions/cache@v4
with:
path: fmt/
key: ${{runner.os}}-fmt-10.2.1-${{matrix.arch}}-${{matrix.msvc}}-${{matrix.build_type}}
- name: Download fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip", "fmt-10.2.1.zip");
7z x fmt-10.2.1.zip;
- name: Setup fmt
if: steps.cache-fmt.outputs.cache-hit != 'true'
run: |
cmake -S fmt-10.2.1 -B build-fmt `
-A ${{matrix.arch}} `
-DFMT_TEST=OFF `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/fmt
cmake --build build-fmt `
--config ${{matrix.build_type}} `
--target install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
architecture: ${{matrix.arch}}
cache: 'pip'
cache-dependency-path: requirements.txt
- name: Setup Dependencies
run: |
pip install -r requirements.txt
- name: Setup Environment
run: |
echo "Eigen3_ROOT=${{github.workspace}}/eigen" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "fmt_ROOT=${{github.workspace}}/fmt" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "pybind11_ROOT=$(pybind11-config --cmakedir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build
env:
CXXFLAGS: /WX
run: |
pip install --no-build-isolation `
--config-settings build-dir=build/ `
--config-settings cmake.build-type=${{matrix.build_type}} `
--verbose `
--editable .
- name: Test
run: |
coverage run -m pytest --junit-xml=report.xml
- name: Generate Documentation
run: |
sphinx-build -M html docs/ docs/_build -W --keep-going
- name: Generate Coverage
run: |
coverage report
coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: true
verbose: true