-
Notifications
You must be signed in to change notification settings - Fork 2
503 lines (501 loc) · 19.3 KB
/
ci.yml
File metadata and controls
503 lines (501 loc) · 19.3 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
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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
name: CI
on:
pull_request:
branches: [main]
workflow_dispatch:
jobs:
ci:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: 'Windows static library (Intel)'
os: windows-2022
arch: amd64
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
- name: 'Windows shared library (Intel)'
os: windows-2022
arch: amd64
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
copy_dll: ON
- name: 'Windows static library (ARM)'
os: windows-11-arm
arch: amd64_arm64
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
- name: 'Windows shared library (ARM)'
os: windows-11-arm
arch: amd64_arm64
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
copy_dll: ON
- name: 'Linux static library (Intel)'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'Linux shared library (Intel)'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'Linux static library (ARM)'
os: ubuntu-22.04-arm
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'Linux shared library (ARM)'
os: ubuntu-22.04-arm
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'macOS static library (Intel)'
os: macos-15-intel
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'macOS shared library (Intel)'
os: macos-15-intel
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'macOS static library (ARM)'
os: macos-15
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'macOS shared library (ARM)'
os: macos-15
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
target: unit_testing
install_uninstall_and_package: ON
use_install_prefix: ON
- name: 'JavaScript bindings'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: ON
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: OFF
target: javascript_unit_testing
- name: 'Windows Python bindings'
os: windows-2022
arch: amd64
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: ON
shared_libs: OFF
unit_testing: OFF
target: python_unit_testing
pip_install_test_and_uninstall: ON
- name: 'Linux Python bindings'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: ON
shared_libs: OFF
unit_testing: OFF
target: python_unit_testing
pip_install_test_and_uninstall: ON
- name: 'macOS Python bindings'
os: macos-15
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: ON
shared_libs: OFF
unit_testing: OFF
context: PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
target: python_unit_testing
pip_install_prerequisites: sudo uv pip install --system cmake scikit-build
pip_install_test_and_uninstall: ON
- name: 'Code formatting'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: OFF
context: PATH=$GITHUB_WORKSPACE:$PATH
target: check_code_formatting
- name: 'JavaScript code formatting'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: OFF
target: javascript_check_code_formatting
- name: 'Python code formatting'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: OFF
target: python_check_code_formatting
- name: 'Code analysis'
os: ubuntu-22.04
build_type: Release
code_analysis: ON
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: ON
context: PATH=$GITHUB_WORKSPACE:$PATH CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++
- name: 'Code coverage'
os: macos-15
build_type: Release
code_analysis: OFF
code_coverage: ON
documentation: OFF
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: ON
unit_testing: ON
context: PATH=/opt/homebrew/opt/llvm@20/bin:$PATH CC=/opt/homebrew/opt/llvm@20/bin/clang CXX=/opt/homebrew/opt/llvm@20/bin/clang++
target: code_coverage
- name: 'Memory checks'
os: ubuntu-22.04
build_type: Debug
code_analysis: OFF
code_coverage: OFF
documentation: OFF
javascript_support: OFF
memory_checks: ON
python_support: OFF
shared_libs: ON
unit_testing: ON
target: memory_checks
- name: 'Documentation'
os: ubuntu-22.04
build_type: Release
code_analysis: OFF
code_coverage: OFF
documentation: ON
javascript_support: OFF
memory_checks: OFF
python_support: OFF
shared_libs: OFF
unit_testing: OFF
target: documentation
env:
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_DEBUG: -1
BUILDCACHE_LOG_FILE: ""
steps:
- name: Set the timezone to New Zealand
uses: szenius/set-timezone@v2.0
with:
timezoneWindows: 'New Zealand Standard Time'
timezoneLinux: 'Pacific/Auckland'
timezoneMacos: 'Pacific/Auckland'
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Install Python
if: ${{ matrix.documentation == 'ON' || matrix.python_support == 'ON' || matrix.target == 'python_check_code_formatting' }}
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: opencor/buildcache-action@v1
with:
cache_key: ci-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.code_analysis }}-${{ matrix.code_coverage }}-${{ matrix.documentation }}-${{ matrix.javascript_support }}-${{ matrix.memory_checks }}-${{ matrix.python_support }}-${{ matrix.shared_libs }}-${{ matrix.unit_testing }}-${{ matrix.target }}
- name: Configure MSVC
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Install LLVM
if: ${{ matrix.code_coverage == 'ON' }}
run: brew install --overwrite llvm@20
- name: Install Clang
if: ${{ matrix.code_analysis == 'ON' }}
run: |
wget https://github.com/opencor/gha/releases/download/gha/clang.tar.gz -O - | tar -xz
sudo mv clang /usr/local/bin
sudo cp /usr/local/bin/clang /usr/local/bin/clang++
wget https://github.com/opencor/gha/releases/download/gha/clang-include.tar.gz -O - | tar -xz
sudo mv include/* /usr/local/include
- name: Install ClangFormat
if: ${{ matrix.target == 'check_code_formatting' }}
run: |
wget https://github.com/opencor/gha/releases/download/gha/clang-format.tar.gz -O - | tar -xz
sudo mv clang-format /usr/local/bin
- name: Install Clang-Tidy
if: ${{ matrix.name == 'Code analysis' }}
run: |
wget https://github.com/opencor/gha/releases/download/gha/clang-tidy.tar.gz -O - | tar -xz
sudo mv clang-tidy /usr/local/bin
- name: Install Emscripten
if: ${{ matrix.javascript_support == 'ON' }}
uses: mymindstorm/setup-emsdk@v14
- name: Install Biome
if: ${{ matrix.target == 'javascript_check_code_formatting' }}
run: |
curl -L https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64 -o biome
chmod +x biome
mv biome /usr/local/bin
- name: Install uv
if: ${{ matrix.documentation == 'ON' || matrix.python_support == 'ON' || matrix.target == 'python_check_code_formatting' }}
uses: astral-sh/setup-uv@v6
- name: Install Black
if: ${{ matrix.target == 'python_check_code_formatting' }}
run: uv pip install --system black
- name: Install Valgrind
if: ${{ matrix.memory_checks == 'ON' }}
run: |
sudo apt update
sudo apt install valgrind
- name: Install pytest and pytest-html
if: ${{ matrix.python_support == 'ON' }}
run: uv pip install --system pytest pytest-html
- name: Install Sphinx and some Sphinx packages
if: ${{ matrix.documentation == 'ON' }}
run: uv pip install --system sphinx~=8.0 sphinx-copybutton sphinx-inline-tabs
- name: Install Doxygen
if: ${{ matrix.documentation == 'ON' }}
run: |
wget https://github.com/opencor/gha/releases/download/gha/doxygen.tar.gz -O - | tar -xz
sudo mv doxygen /usr/local/bin
- name: Configure libOpenCOR
shell: bash
run: |
if [ '${{ matrix.use_install_prefix }}' == 'ON' ]; then export D_INSTALL_PREFIX='-DINSTALL_PREFIX=${{ github.workspace }}/install'; fi
${{ matrix.context }} cmake -G Ninja -S . -B build -DBUILD_TYPE=${{ matrix.build_type }} -DCODE_ANALYSIS=${{ matrix.code_analysis }} -DCODE_COVERAGE=${{ matrix.code_coverage }} -DDOCUMENTATION=${{ matrix.documentation }} $D_INSTALL_PREFIX -DJAVASCRIPT_BINDINGS=${{ matrix.javascript_support }} -DJAVASCRIPT_UNIT_TESTING=${{ matrix.javascript_support }} -DMEMORY_CHECKS=${{ matrix.memory_checks }} -DPYTHON_BINDINGS=${{ matrix.python_support }} -DPYTHON_UNIT_TESTING=${{ matrix.python_support }} -DSHARED_LIBS=${{ matrix.shared_libs }} -DUNIT_TESTING=${{ matrix.unit_testing }}
- name: Build libOpenCOR
if: ${{ (matrix.install_uninstall_and_package == 'ON') || (matrix.javascript_support == 'ON') || (matrix.python_support == 'ON') }}
run: cmake --build build
- name: Unit testing
if: ${{ (matrix.unit_testing == 'ON') && (matrix.code_analysis == 'OFF') && (matrix.code_coverage == 'OFF') && (matrix.memory_checks == 'OFF') }}
run: cmake --build build --target ${{ matrix.target }}
- name: JavaScript unit testing
if: ${{ matrix.javascript_support == 'ON' }}
run: cmake --build build --target ${{ matrix.target }}
- name: Python unit testing
if: ${{ matrix.python_support == 'ON' }}
run: cmake --build build --target ${{ matrix.target }}
- name: Python unit testing report
if: ${{ matrix.python_support == 'ON' }}
run: cmake --build build --target ${{ matrix.target }}_report
- name: Code formatting
if: ${{ matrix.target == 'check_code_formatting' }}
run: cmake --build build --target ${{ matrix.target }}
- name: JavaScript code formatting
if: ${{ matrix.target == 'javascript_check_code_formatting' }}
run: cmake --build build --target ${{ matrix.target }}
- name: Python code formatting
if: ${{ matrix.target == 'python_check_code_formatting' }}
run: cmake --build build --target ${{ matrix.target }}
- name: Code analysis
if: ${{ matrix.name == 'Code analysis' }}
run: cmake --build build
- name: Code coverage
if: ${{ matrix.code_coverage == 'ON' }}
run: |
cmake --build build --target ${{ matrix.target }}
if [ `cmake --build build --target ${{ matrix.target }} | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi
- name: Code coverage report
if: ${{ matrix.code_coverage == 'ON' }}
run: cmake --build build --target ${{ matrix.target }}_report
- name: Memory checks
if: ${{ matrix.memory_checks == 'ON' }}
run: cmake --build build --target ${{ matrix.target }}
- name: Documentation
if: ${{ matrix.documentation == 'ON' }}
run: cmake --build build --target ${{ matrix.target }}
- name: Install libOpenCOR
if: ${{ matrix.install_uninstall_and_package == 'ON' }}
run: cmake --build build --target install
- name: Test libOpenCOR
if: ${{ matrix.install_uninstall_and_package == 'ON' }}
shell: bash
run: |
cd tests/install
if [ '${{ matrix.use_install_prefix }}' == 'ON' ]; then export D_CMAKE_PREFIX_PATH='-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install'; fi
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $D_CMAKE_PREFIX_PATH
cmake --build build
if [ '${{ matrix.copy_dll }}' == 'ON' ]; then cp "C:/Program Files (x86)/libOpenCOR/bin/libOpenCOR.dll" build; fi
build/testInstall
- name: Uninstall libOpenCOR
if: ${{ matrix.install_uninstall_and_package == 'ON' }}
run: cmake --build build --target uninstall
- name: Package libOpenCOR
if: ${{ matrix.install_uninstall_and_package == 'ON' }}
run: |
cd build
cpack
- name: pip install libOpenCOR
if: ${{ matrix.pip_install_test_and_uninstall == 'ON' }}
run: |
${{ matrix.pip_install_prerequisites }}
uv pip install --system .
- name: Test libOpenCOR Python
if: ${{ matrix.pip_install_test_and_uninstall == 'ON' }}
run: |
cd tests/install/bindings/python
python3 test_install.py
- name: pip uninstall libOpenCOR
if: ${{ matrix.pip_install_test_and_uninstall == 'ON' }}
run: uv pip uninstall --system libopencor
spell_check:
name: Spell check
runs-on: ubuntu-22.04
steps:
- name: Set the timezone to New Zealand
uses: szenius/set-timezone@v2.0
with:
timezoneLinux: 'Pacific/Auckland'
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Spell check
uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
skip: ./extern
exclude_file: .codespellexclude