-
Notifications
You must be signed in to change notification settings - Fork 1
337 lines (306 loc) · 12.7 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
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
name: CI
on:
push:
branches:
- main
paths-ignore:
- 'LICENSE.md'
- 'README.md'
- 'docs/**'
pull_request:
paths-ignore:
- 'LICENSE.md'
- 'README.md'
- 'docs/**'
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: "false"
jobs:
test:
name: ${{ matrix.os }} - ${{ matrix.test_type }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
test_type:
- regular
- coverage
arch:
- x64
julia_version:
- '1.10'
t8code_version:
- '3.0.0'
include:
- os: ubuntu-latest
test_type: package-compiler
arch: x64
julia_version: '1.9.3' # 1.9.4: missing nghttp2 symbols in libcurl
t8code_version: '3.0.0'
env:
# Necessary for HDF5 to play nice with Julia
LD_PRELOAD: /lib/x86_64-linux-gnu/libcurl.so.4
# Necessary such that libtrixi will not use its own default for the depot path
JULIA_DEPOT_PATH: ~/.julia
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Enable Julia cache
uses: julia-actions/cache@v2
- name: Enable t8code cache
id: cache-t8code
uses: actions/cache@v4
with:
path: ./t8code-local
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.t8code_version }}
- name: Install Julia
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia_version }}
arch: ${{ matrix.arch }}
- name: Show Julia version information
run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)'
- name: Update `apt-get`
run: sudo apt-get update
- name: Install dependencies available with `apt-get`
# - MPI
# - HDF5
# - Google Test
# - Coverage (lcov)
run: |
sudo apt-get install -y openmpi-bin libopenmpi-dev \
libhdf5-openmpi-dev \
libgtest-dev \
lcov
- name: Install t8code
if: steps.cache-t8code.outputs.cache-hit != 'true'
run: |
T8CODE_RELEASE=${{ matrix.t8code_version }}
mkdir t8code-local
cd t8code-local
wget https://github.com/DLR-AMR/t8code/releases/download/v${T8CODE_RELEASE}/T8CODE-${T8CODE_RELEASE}-Source.tar.gz
tar xf t8-${T8CODE_RELEASE}.tar.gz
mkdir build
cd build
CC=mpicc CXX=mpicxx cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PWD/../prefix" \
-DT8CODE_BUILD_TESTS=OFF \
-DT8CODE_BUILD_TUTORIALS=OFF \
-DT8CODE_BUILD_EXAMPLES=OFF \
-DT8CODE_BUILD_BENCHMARKS=OFF \
-DT8CODE_ENABLE_MPI=ON \
-DT8CODE_BUILD_FORTRAN_INTERFACE=ON
make -j 2
make install
- name: Configure (test_type == 'regular')
if: ${{ matrix.test_type == 'regular' }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Release \
-DT8CODE_ROOT=$PWD/../t8code-local/prefix \
-DENABLE_TESTING=ON -DJULIA_PROJECT_PATH=../libtrixi-julia
- name: Configure (test_type == 'coverage')
if: ${{ matrix.test_type == 'coverage' }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Debug \
-DT8CODE_ROOT=$PWD/../t8code-local/prefix \
-DCMAKE_C_FLAGS="-cpp --coverage -O0" \
-DCMAKE_Fortran_FLAGS="-cpp --coverage -O0" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="--coverage" \
-DENABLE_TESTING=ON -DJULIA_PROJECT_PATH=../libtrixi-julia
- name: Build
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build
make -j 2
- name: Install
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build
make install
- name: Test building with an external Makefile
if: ${{ matrix.test_type == 'regular' }}
run: |
cd examples
make -f MakefileExternal LIBTRIXI_PREFIX=$PWD/../install
- name: Initialize project directory
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
# Note that we set the Julia depot to `~/.julia` *ONLY* to make use of the
# julia-actions/cache above (which unfortunately hardcoded the `~/.julia`
# directory). For this reason, we also need to use `--force`
# Still create subfolder `julia-depot`, which reflects the typical default
# and is tested below
run: |
mkdir libtrixi-julia
cd libtrixi-julia
mkdir julia-depot
../install/bin/libtrixi-init-julia .. \
--hdf5-library /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so \
--t8code-library ../t8code-local/prefix/lib/libt8.so \
--julia-depot ~/.julia \
--force
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_tree1d_dgsem_advection_basic.jl .
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_p4est2d_dgsem_euler_sedov.jl .
cp ../install/share/libtrixi/LibTrixi.jl/examples/libelixir_t8code_2d_dgsem_advection_amr.jl .
- name: Initialize project directory (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
# Note that we set the Julia depot to `~/.julia` *ONLY* to make use of the
# julia-actions/cache above (which unfortunately hardcoded the `~/.julia`
# directory). For this reason, we also need to use `--force`
# Still create subfolder `julia-depot`, which reflects the typical default
# and is tested below
run: |
mkdir libtrixi-julia
cd libtrixi-julia
mkdir julia-depot
../utils/libtrixi-init-julia .. \
--hdf5-library /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so \
--t8code-library ../t8code-local/prefix/lib/libt8.so \
--julia-depot ~/.julia \
--force
- name: Configure (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Debug \
-DUSE_PACKAGE_COMPILER=ON \
-DJULIA_PROJECT_PATH=$PWD/../libtrixi-julia
- name: Build (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
run: |
cd build
make -j2
- name: Test external CMake project
if: ${{ matrix.test_type == 'regular' }}
run: |
cd examples/external
./build.sh
mpirun -n 2 ./build/trixi_controller_simple_c \
../../libtrixi-julia \
../../LibTrixi.jl/examples/libelixir_p4est2d_dgsem_euler_sedov.jl
env:
LIBTRIXI_DEBUG: all
- name: Prepare coverage reporting
if: ${{ matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
lcov --directory ../build --zerocounters
- name: Run Julia tests
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
uses: julia-actions/julia-runtest@v1
with:
coverage: ${{ matrix.test_type == 'coverage' }}
project: ./LibTrixi.jl
check_bounds: 'auto'
env:
LIBTRIXI_DEBUG: all
LD_PRELOAD: "" # Disable preloading libcurl.so since it does not work with the JLL-provided libhdf5.so
- name: Run examples
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
../build/examples/trixi_controller_simple_c . libelixir_tree1d_dgsem_advection_basic.jl
../build/examples/trixi_controller_simple_f . libelixir_tree1d_dgsem_advection_basic.jl
../build/examples/trixi_controller_simple_c . libelixir_p4est2d_dgsem_euler_sedov.jl
../build/examples/trixi_controller_simple_f . libelixir_p4est2d_dgsem_euler_sedov.jl
../build/examples/trixi_controller_data_c . libelixir_t8code_2d_dgsem_advection_amr.jl
../build/examples/trixi_controller_data_f . libelixir_t8code_2d_dgsem_advection_amr.jl
../build/examples/trixi_controller_t8code_c . libelixir_t8code_2d_dgsem_advection_amr.jl
../build/examples/trixi_controller_t8code_f . libelixir_t8code_2d_dgsem_advection_amr.jl
env:
LIBTRIXI_DEBUG: all
- name: Run examples (test_type == 'package-compiler')
if: ${{ matrix.test_type == 'package-compiler' }}
run: |
cd build/examples
mpirun -n 2 trixi_controller_simple_c \
../../libtrixi-julia \
../../LibTrixi.jl/examples/libelixir_p4est2d_dgsem_euler_sedov.jl
env:
LIBTRIXI_DEBUG: all
- name: Check error handling of examples
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
set +e # disable early exit on non-zero exit code
for command in "../build/examples/trixi_controller_simple_c" \
"../build/examples/trixi_controller_simple_c ." \
"../build/examples/trixi_controller_simple_f" \
"../build/examples/trixi_controller_simple_f ." \
"../build/examples/trixi_controller_data_c" \
"../build/examples/trixi_controller_data_c ." \
"../build/examples/trixi_controller_data_f" \
"../build/examples/trixi_controller_data_f ." \
"../build/examples/trixi_controller_t8code_c" \
"../build/examples/trixi_controller_t8code_c ." \
"../build/examples/trixi_controller_t8code_f" \
"../build/examples/trixi_controller_t8code_f ."
do
$command
if [ $? -ne 2 ]; then
echo "Wrong exit code for $command! Expected 2, got $?"
exit 1
fi
done
env:
LIBTRIXI_DEBUG: all
- name: Run C tests
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build/test/c
ctest -V
env:
LIBTRIXI_DEBUG: all
GTEST_COLOR: 'yes'
- name: Run Fortran tests
if: ${{ matrix.test_type == 'regular' || matrix.test_type == 'coverage' }}
run: |
cd build/test/fortran
ctest -V
env:
LIBTRIXI_DEBUG: all
- name: Process Julia coverage data
if: ${{ matrix.test_type == 'coverage' }}
uses: julia-actions/julia-processcoverage@v1
with:
directories: LibTrixi.jl/src
- name: Process C/Fortran coverage data
if: ${{ matrix.test_type == 'coverage' }}
run: |
cd libtrixi-julia
lcov --directory ../build --capture \
--exclude "*/julia.h" --exclude "*test-drive-src*" --exclude "*/test/*" \
--output-file lcov.info
- name: Upload coverage data (Codecov)
uses: codecov/codecov-action@v4
if: ${{ matrix.test_type == 'coverage' }}
with:
files: ./libtrixi-julia/lcov.info,./lcov.info
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage data (Coveralls)
if: ${{ matrix.test_type == 'coverage' }}
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
files: ./libtrixi-julia/lcov.info ./lcov.info
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session for debugging
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15