-
Notifications
You must be signed in to change notification settings - Fork 15
307 lines (273 loc) · 8.46 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
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
name: samurai CI
on: [pull_request]
jobs:
#
# Check samurai with pre-commit
#
#########################################################
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.0
#
# Check samurai with cppcheck
#
#########################################################
cppcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cache/ccache
~/micromamba/envs/samurai-env
key: cppcheck
- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/environment.yml
environment-name: samurai-env
cache-environment: true
- name: cppcheck installation
shell: bash -el {0}
run: |
conda install -y cppcheck=2.12 python=3.12 cxx-compiler
- name: Configure
shell: bash -el {0}
run: |
cmake . -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMOS=ON
- name: Run cppcheck on samurai
shell: bash -el {0}
run: |
cppcheck --enable=all -q --project=./build/compile_commands.json --suppressions-list=.cppcheck --inline-suppr 2> cppcheck_err.txt
- name: Check for errors
run: |
if [[ -s cppcheck_err.txt ]];
then
cat cppcheck_err.txt
exit -1
fi
#
# Check linux build with mamba environment
#
#########################################################
linux-mamba:
needs: [pre-commit, cppcheck]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
# - cpp-version: gcc-9
# compiler: "gcc"
# package: "gcc-9 g++-9"
# cc: "gcc-9"
# cxx: "g++-9"
- cpp-version: gcc-10
compiler: "gcc"
package: "gcc-10 g++-10"
cc: "gcc-10"
cxx: "g++-10"
- cpp-version: gcc-11
compiler: "gcc"
package: "gcc-11 g++-11"
cc: "gcc-11"
cxx: "g++-11"
- cpp-version: gcc-12
compiler: "gcc"
package: "gcc-12 g++-12"
cc: "gcc-12"
cxx: "g++-12"
- cpp-version: clang-11
compiler: "clang"
package: "clang-11"
cc: "clang-11"
cxx: "clang++-11"
- cpp-version: clang-12
compiler: "clang"
package: "clang-12"
cc: "clang-12"
cxx: "clang++-12"
- cpp-version: clang-13
compiler: "clang"
package: "clang-13"
cc: "clang-13"
cxx: "clang++-13"
- cpp-version: clang-14
compiler: "clang"
package: "clang-14"
cc: "clang-14"
cxx: "clang++-14"
- cpp-version: clang-15
compiler: "clang"
package: "clang-15"
cc: "clang-15"
cxx: "clang++-15"
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cache/ccache
~/micromamba-root/envs/samurai-env
key: linux-${{ matrix.cpp-version }}
restore-keys: |
linux-${{ matrix.cpp-version }}
- name: Compiler and dev tools installation
run: |
sudo apt update
sudo apt install ${{ matrix.package }}
# - name: Information about ccache
# run: |
# ccache -s -v
- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/environment.yml
environment-name: samurai-env
cache-environment: true
- name: Petsc installation
shell: bash -l {0}
run: |
conda install -y petsc pkg-config
- name: Conda informations
shell: bash -l {0}
run: |
conda info
conda list
- name: Configure
shell: bash -l {0}
run: |
export LDFLAGS="${LDFLAGS} -L$CONDA_PREFIX/lib"
CC=${{ matrix.cc }} CXX=${{ matrix.cxx }} cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_DEMOS=ON \
-DBUILD_TESTS=ON
- name: Build
shell: bash -l {0}
run: |
cmake --build build --target all --parallel 3
- name: Test with googletest
shell: bash -l {0}
run: |
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd build
./tests/test_samurai_lib
- name: Test with pytest
shell: bash -l {0}
run: |
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd tests
pytest -v -s --h5diff
#
# Check linux build with mamba environment
#
#########################################################
linux-mpi-mamba:
needs: [pre-commit, cppcheck]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cache/ccache
~/micromamba-root/envs/samurai-env
key: linux-mpi
restore-keys: |
linux-mpi
- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/mpi-environment.yml
environment-name: samurai-env
cache-environment: false # somehow the cache doesn't work in this case...
- name: Petsc installation
shell: bash -l {0}
run: |
conda install -y mpich petsc pkg-config cxx-compiler
- name: Conda informations
shell: bash -l {0}
run: |
conda info
conda list
- name: Configure
shell: bash -l {0}
run: |
cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_MPI=ON \
-DBUILD_DEMOS=ON \
-DBUILD_TESTS=ON
- name: Build
shell: bash -l {0}
run: |
cmake --build build --target finite-volume-advection-2d --parallel 4
- name: MPI test
shell: bash -l {0}
run: |
cd build
mpiexec -n 1 ./demos/FiniteVolume/finite-volume-advection-2d --Tf 0.02
mpiexec -n 2 ./demos/FiniteVolume/finite-volume-advection-2d --Tf 0.02
mpiexec -n 3 ./demos/FiniteVolume/finite-volume-advection-2d --Tf 0.02
mpiexec -n 4 ./demos/FiniteVolume/finite-volume-advection-2d --Tf 0.02
mpiexec -n 9 ./demos/FiniteVolume/finite-volume-advection-2d --Tf 0.02
python ../python/compare.py FV_advection_2d_size_1 FV_advection_2d_size_2
python ../python/compare.py FV_advection_2d_size_1 FV_advection_2d_size_3
python ../python/compare.py FV_advection_2d_size_1 FV_advection_2d_size_4
python ../python/compare.py FV_advection_2d_size_1 FV_advection_2d_size_9
macos-mamba:
needs: [pre-commit, cppcheck]
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Mamba and samurai env installation
uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda/environment.yml
environment-name: samurai-env
cache-environment: true
# - name: Petsc installation
# shell: bash -l {0}
# run: |
# micromamba install -y petsc=3.18 pkg-config
- name: Installl cxx compiler
shell: bash -l {0}
run: |
micromamba install -y cxx-compiler
- name: micromamba informations
shell: bash -l {0}
run: |
micromamba info
micromamba list
- name: Configure
shell: bash -l {0}
run: |
cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_DEMOS=ON \
-DBUILD_TESTS=ON
- name: Build
shell: bash -l {0}
run: |
cmake --build ./build --config Release --parallel 3
- name: Run tests
shell: bash -l {0}
run: |
./build/tests/test_samurai_lib
cd tests; pytest --h5diff