-
-
Notifications
You must be signed in to change notification settings - Fork 119
390 lines (342 loc) · 12.3 KB
/
main-job.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
on:
workflow_call:
inputs:
cmake_build_type:
description: 'Value for CMAKE_BUILD_TYPE'
type: string
default: Release
required: true
add_cmake_cfg_args:
description: 'Additional arguments for configuration step'
required: false
type: string
branch_name:
description: 'Branch to checkout when tests are manually triggered'
required: false
type: string
code_coverage:
description: 'Code coverage'
required: false
default: true
type: boolean
# job
jobs:
ci:
if: "! contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
# Launch a matrix of jobs
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04,macos-12]
pattern: [on,off]
pointmap: [off]
scotch: [on,off]
vtk: [off]
int: [int32_t]
include:
# test vtk only without scotch and with delaunay insertion (more
# tests are useless)
- os: ubuntu-20.04
pattern: off
pointmap: off
scotch: off
vtk: on
int: int32_t
- os: macos-14
pattern: off
pointmap: off
scotch: off
vtk: on
int: int32_t
# Test pointmap with scotch except on windows
- os: ubuntu-20.04
pattern: off
pointmap: on
scotch: on
vtk: off
int: int32_t
- os: macos-12
pattern: off
pointmap: on
scotch: on
vtk: off
int: int32_t
# Add windows basic test (matrix is not testable as dependencies
# don't build with MSVC)
- os: windows-2022
pattern: off
pointmap: off
scotch: off
vtk: off
int: int32_t
- os: windows-2022
pattern: on
pointmap: off
scotch: off
vtk: off
int: int32_t
# Add test for pointmap only if pattern off
- os: windows-2022
pattern: off
pointmap: on
scotch: off
vtk: off
int: int32_t
# Test int64_t build on all archi, and try to cover all code
- os: ubuntu-20.04
pattern: on
pointmap: on
scotch: on
vtk: on
int: int64_t
- os: ubuntu-20.04
pattern: off
pointmap: off
scotch: on
vtk: on
int: int64_t
- os: ubuntu-20.04
pattern: off
pointmap: off
scotch: off
vtk: off
int: int64_t
- os: macos-14
pattern: on
pointmap: on
scotch: on
vtk: on
int: int64_t
- os: macos-12
pattern: off
pointmap: off
scotch: off
vtk: off
int: int64_t
- os: windows-2022
pattern: on
pointmap: on
scotch: off
vtk: off
int: int64_t
- os: windows-2022
pattern: off
pointmap: off
scotch: off
vtk: off
int: int64_t
steps:
- name: Set cmake_build_type and export coverage flags
run: |
if ${{ matrix.os == 'ubuntu-20.04' && inputs.code_coverage == true }}; then
# if code coverage is enabled, linux build is runned in Debug mode
if [[ ${{ inputs.cmake_build_type }} != Debug ]]; then
echo "WARNING: build type is forced to debug mode on ubuntu to allow coverage."
fi
echo "BUILD_TYPE=Debug" >> "$GITHUB_ENV"
echo "C_FLG_PROF=-fprofile-arcs -ftest-coverage" >> "$GITHUB_ENV"
else
echo "BUILD_TYPE=${{ inputs.cmake_build_type }}" >> "$GITHUB_ENV"
fi
shell: bash
- name: Print options and set environment variables
run: |
echo "${{ github.event.inputs.name }}:
Os: ${{ matrix.os }},
Pattern: ${{ matrix.pattern }},
Scotch: ${{ matrix.scotch }},
VTK: ${{ matrix.vtk }},
int: ${{ matrix.int }},
Build: ${{ env.BUILD_TYPE }}"
# gfortran compiler and scotch makefile depends on the os
if [ "$RUNNER_OS" == "macOS" ]; then
echo "SCOTCH_MAKE=Make.inc/Makefile.inc.i686_mac_darwin10" >> "$GITHUB_ENV"
echo "FORT_FLG=\"-DCMAKE_Fortran_COMPILER=gfortran-14\"" >> "$GITHUB_ENV"
elif [ "$RUNNER_OS" == "Linux" ]; then
echo "SCOTCH_MAKE=Make.inc/Makefile.inc.x86-64_pc_linux2" >> "$GITHUB_ENV"
echo "FORT_FLG=\"-DCMAKE_Fortran_COMPILER=gfortran-9\"" >> "$GITHUB_ENV"
fi
echo "NJOBS=$NJOBS" >> "$GITHUB_ENV"
# Remark: variable values are still empty inside this context
shell: bash
env:
NJOBS: "2"
- name: Set environment variables for output comparison
if: "! contains(github.event.head_commit.message, '[skip output comparison]')"
run: |
echo "C_FLG=-DMMG_COMPARABLE_OUTPUT" >> "$GITHUB_ENV"
echo "MMG_ERROR_RULE=\"COMMAND_ERROR_IS_FATAL ANY\"" >> "$GITHUB_ENV"
- name: Assign CMAKE_C_FLAGS if needed
if: ${{ env.C_FLG || env.C_FLG_PROF }}
run: |
echo "CMAKE_C_FLG=-DCMAKE_C_FLAGS=\"${{ env.C_FLG }} ${{ env.C_FLG_PROF }}\"" >> "$GITHUB_ENV"
- name: Install VTK
# Download vtk only if used
if: matrix.vtk == 'on'
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install vtk
elif [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y libvtk7-dev
fi
- name: Install Sctoch
# Download scotch only if used
if: matrix.scotch == 'on'
run: |
git clone https://gitlab.inria.fr/scotch/scotch.git
cd scotch
git checkout v6.1.3
cd src
cp ${{ env.SCOTCH_MAKE }} Makefile.inc
make scotch -j ${{ env.NJOBS }}
make prefix=../../scotch-install install -j ${{ env.NJOBS }}
- name: Install LibCommons
# LinearElasticity don't build with MSVC
if: runner.os != 'windows'
run: |
git clone https://github.com/ISCDtoolbox/Commons.git
cd Commons
mkdir build
cd build
cmake ..
make install
- name: Install LinearElasticity
# LinearElasticity don't build with MSVC
if: runner.os != 'windows'
run: |
git clone https://github.com/ISCDtoolbox/LinearElasticity.git
cd LinearElasticity
mkdir build
cd build
cmake ..
make install
# checkout the provided branch name if workflow is manually run
- uses: actions/checkout@v4
if: inputs.branch_name
with:
ref: ${{github.event.inputs.branch}}
path: mmg
# checkout the event branch for automatic workflows
- uses: actions/checkout@v4
if: inputs.branch_name == ''
with:
path: mmg
- name: Test compilation with shared libs linkage
run: |
cmake -Smmg -Bbuild_shared \
${{ env.CMAKE_C_FLG }} \
${{ env.FORT_FLG }} \
-DCI_CONTEXT=ON \
-DBUILD_TESTING=ON \
-DUSE_POINTMAP=${{ matrix.pointmap }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DMMG_PATTERN=${{ matrix.pattern }} \
-DUSE_SCOTCH=${{ matrix.scotch }} \
-DSCOTCH_DIR=scotch-install \
-DUSE_VTK=${{ matrix.vtk }} \
-DMMG5_INT=${{ matrix.int }} \
-DBUILD_SHARED_LIBS=ON \
-DTEST_LIBMMG=ON \
-DTEST_LIBMMGS=ON \
-DTEST_LIBMMG2D=ON \
-DTEST_LIBMMG3D=ON \
${{ inputs.add_cmake_cfg_args }}
cmake --build build_shared --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
shell: bash
- name: Test compilation without library linkage
run: |
cmake -Smmg -Bbuild_nolibs \
${{ env.CMAKE_C_FLG }} \
${{ env.FORT_FLG }} \
-DCI_CONTEXT=ON \
-DBUILD_TESTING=ON \
-DUSE_POINTMAP=${{ matrix.pointmap }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DMMG_PATTERN=${{ matrix.pattern }} \
-DUSE_SCOTCH=${{ matrix.scotch }} \
-DSCOTCH_DIR=scotch-install \
-DUSE_VTK=${{ matrix.vtk }} \
-DMMG5_INT=${{ matrix.int }} \
-DLIBMMG_STATIC=OFF \
-DLIBMMGS_STATIC=OFF \
-DLIBMMG2D_STATIC=OFF \
-DLIBMMG3D_STATIC=OFF \
${{ inputs.add_cmake_cfg_args }}
cmake --build build_nolibs --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
shell: bash
- name: Configure Mmg with static libs (default behaviour)
run: |
cmake -Smmg -Bbuild \
${{ env.CMAKE_C_FLG }} \
${{ env.FORT_FLG }} \
-DCMAKE_INSTALL_PREFIX=mmg-install \
-DCI_CONTEXT=ON \
-DBUILD_TESTING=ON \
-DUSE_POINTMAP=${{ matrix.pointmap }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DMMG_PATTERN=${{ matrix.pattern }} \
-DUSE_SCOTCH=${{ matrix.scotch }} \
-DSCOTCH_DIR=scotch-install \
-DUSE_VTK=${{ matrix.vtk }} \
-DMMG5_INT=${{ matrix.int }} \
-DTEST_LIBMMG=ON \
-DTEST_LIBMMGS=ON \
-DTEST_LIBMMG2D=ON \
-DTEST_LIBMMG3D=ON \
${{ inputs.add_cmake_cfg_args }}
shell: bash
- name: Build Mmg
run: |
cmake --build build --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
- name: Install Mmg
run: |
cmake --build build --target install --config ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
- name: Test Mmg with in32_t integers
# Run long tests only with vtk off and int32_t integers
if: matrix.vtk == 'off' && matrix.int == 'int32_t'
run: |
cd build
ctest --timeout 7200 -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
- name: Test Mmg with int64_t integers
# Run long tests only on ubuntu with pattern off, scotch on, vtk on and int64_t integers
if: matrix.os == 'ubuntu-20.04' && matrix.pattern == 'off' && matrix.scotch == 'on' && matrix.vtk == 'on' && matrix.int == 'int64_t'
run: |
cd build
ctest --timeout 7200 -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
- name: Test non native I/Os of Mmg
if: matrix.vtk == 'on'
run: |
cd build
ctest -R "msh|vtk" -VV -C ${{ env.BUILD_TYPE }} -j ${{ env.NJOBS }}
- name: Archive production artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.pattern }}-${{ matrix.pointmap }}-${{ matrix.scotch }}-${{ matrix.vtk }}-${{ matrix.int }}
path: |
build
upload_coverage:
runs-on: ubuntu-latest
needs: ci
steps:
- name: Checkout repository
# Codecov need the source code to pair with coverage
uses: actions/checkout@v4
with:
path: mmg
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
pattern: build-ubuntu-*
- name: Upload coverage to Codecov
if: inputs.code_coverage == true
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
root_dir: .
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}