-
Notifications
You must be signed in to change notification settings - Fork 21
263 lines (260 loc) · 9.04 KB
/
ci.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
name: CI
on:
pull_request:
branches: [ main ]
workflow_dispatch:
env:
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_DEBUG: -1
BUILDCACHE_LOG_FILE: ""
jobs:
cpp_python:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: 'Windows static - C++/Python'
os: windows-latest
bindings_python: ON
build_shared: OFF
unit_tests: ON
set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path
additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib"
- name: 'Windows shared - C++/Python'
os: windows-latest
bindings_python: ON
build_shared: ON
unit_tests: ON
set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path
additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib"
- name: 'Linux static - C++ (build only)'
os: ubuntu-latest
bindings_python: OFF
build_shared: OFF
unit_tests: OFF
- name: 'Linux shared - C++/Python'
os: ubuntu-latest
bindings_python: ON
build_shared: ON
unit_tests: ON
- name: 'macOS static - C++ (Intel)'
os: macos-13
bindings_python: OFF
build_shared: OFF
unit_tests: ON
- name: 'macOS shared - C++/Python (Intel)'
os: macos-13
bindings_python: ON
build_shared: ON
unit_tests: ON
- name: 'macOS static - C++ (ARM)'
os: macos-latest
bindings_python: OFF
build_shared: OFF
unit_tests: ON
- name: 'macOS shared - C++/Python (ARM)'
os: macos-latest
bindings_python: ON
build_shared: ON
unit_tests: ON
steps:
- name: Check out libCellML
uses: actions/checkout@v4
- name: Install Python (if needed)
if: ${{ matrix.bindings_python == 'ON' }}
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: mikehardy/buildcache-action@v2
with:
cache_key: ${{ matrix.os }}-${{ matrix.build_shared }}
- name: Configure MSVC (Windows only)
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Install libxml2 (Windows only)
if: ${{ runner.os == 'Windows' }}
run: |
Invoke-WebRequest -UseBasicParsing https://github.com/cellml/gha/releases/download/gha/libxml2.zip -OutFile libxml2.zip
Expand-Archive -LiteralPath libxml2.zip -DestinationPath C:\
- name: Install SWIG (macOS only and if needed)
if: ${{ runner.os == 'macOS' && matrix.bindings_python == 'ON' }}
run: |
brew install swig
- name: Install zlib (Windows only)
if: ${{ runner.os == 'Windows' }}
run: |
Invoke-WebRequest -UseBasicParsing https://github.com/cellml/gha/releases/download/gha/zlib.zip -OutFile zlib.zip
Expand-Archive -LiteralPath zlib.zip -DestinationPath C:\
- name: Configure libCellML
run: |
mkdir build
cd build
${{ matrix.set_path }}
cmake -G Ninja -DBINDINGS_PYTHON=${{ matrix.bindings_python }} -DBUILD_SHARED=${{ matrix.build_shared }} -DCOVERAGE=OFF -DLLVM_COVERAGE=OFF -DMEMCHECK=OFF -DUNIT_TESTS=${{ matrix.unit_tests }} ${{ matrix.additional_cmake_options }} ..
- name: Build libCellML
run: |
cd build
ninja
- name: Unit testing
if: ${{ matrix.unit_tests == 'ON' }}
run: |
cd build
ninja test
javascript:
name: JavaScript
runs-on: macos-latest
strategy:
fail-fast: false
env:
LIBCELLML_WASM_DIR: wasm
LIBXML2_VERSION: 2.9.10
ZLIB_VERSION: 1.2.3
steps:
- name: Check out libCellML
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: mikehardy/buildcache-action@v2
- name: Install Emscripten
run: |
brew install --overwrite emscripten
- name: Set up the build directory
run: |
mkdir build
- name: Build zlib
run: |
cd build
ZLIB_BUILD_DIR=zlib-wasm
git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION}
mkdir ${ZLIB_BUILD_DIR}
emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF
cmake --build ${ZLIB_BUILD_DIR}
cmake --install ${ZLIB_BUILD_DIR}
- name: Build libxml2
run: |
cd build
LIBXML2_BUILD_DIR=libxml2-wasm
git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION}
mkdir ${LIBXML2_BUILD_DIR}
emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF
cmake --build ${LIBXML2_BUILD_DIR}
cmake --install ${LIBXML2_BUILD_DIR}
- name: Build libCellML
run: |
cd build
mkdir ${LIBCELLML_WASM_DIR}
emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release
cmake --build ${LIBCELLML_WASM_DIR}
- name: Unit testing
run: |
cd build
cmake --build ${LIBCELLML_WASM_DIR} --target jest_test
code_formatting:
name: Code formatting
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Check out libCellML
uses: actions/checkout@v4
- name: Install ClangFormat
run: |
sudo apt update
sudo apt install clang-format
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Configure libCellML
run: |
mkdir build
cd build
cmake -G Ninja ..
- name: Code formatting
run: |
cd build
ninja test_clang_format
coverage:
name: Code coverage
runs-on: macos-latest
strategy:
fail-fast: false
steps:
- name: Check out libCellML
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: mikehardy/buildcache-action@v2
- name: Install LLVM
run: |
brew install --overwrite llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile
- name: Configure libCellML
run: |
mkdir build
cd build
cmake -G Ninja -DBINDINGS_PYTHON=OFF ..
- name: Code coverage
run: |
cd build
ninja llvm_coverage
if [ `ninja llvm_coverage | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi
memory_leaks:
name: Memory leaks
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Check out libCellML
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: mikehardy/buildcache-action@v2
- name: Install Valgrind
run: |
sudo apt update
sudo apt install valgrind
- name: Configure libCellML
run: |
mkdir build
cd build
cmake -G Ninja -DBINDINGS_PYTHON=OFF ..
- name: Memory leaks
run: |
cd build
ninja memcheck
documentation:
name: Documentation
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Check out libCellML
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: mikehardy/buildcache-action@v2
- name: Install Doxygen
run: |
sudo apt update
sudo apt install doxygen
- name: Install Sphinx
run: |
pip3 install sphinx
- name: Configure libCellML
run: |
mkdir build
cd build
cmake -G Ninja -DBINDINGS_PYTHON=OFF ..
- name: Documentation
run: |
cd build
ninja docs