forked from IBAMR/IBAMR
-
Notifications
You must be signed in to change notification settings - Fork 0
411 lines (400 loc) · 14.7 KB
/
push-pull.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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
## ---------------------------------------------------------------------
##
## Copyright (c) 2021 - 2021 by the IBAMR developers
## All rights reserved.
##
## This file is part of IBAMR.
##
## IBAMR is free software and is distributed under the 3-clause BSD
## license. The full text of the license can be found in the file
## COPYRIGHT at the top level directory of IBAMR.
##
## ---------------------------------------------------------------------
name: Pull/push
on:
# Trigger the workflow on push or pull request,
# but only when targeting the main branch
push:
branches:
- master
pull_request:
branches:
- master
jobs:
# build IBAMR with CMake and run tests
build_ibamr:
runs-on: ubuntu-latest
name: Build IBAMR and run tests
container:
image: 'docker://wellsd2/ibamr:ibamr-0.14-bundled-deps'
env:
# For now, hardwire the configuration since we have only one.
# This is used by ctest_configure.cmake to initialize the
# CMake cache by including
# `.github/cmake/configure_${CMAKE_CONFIGURATION}.cmake`
# so it is possible to run the same container with different
# values to build different configurations (e.g., release vs
# debug, with/without in situ processing, static analysis).
CMAKE_CONFIGURATION: fedora33
# If this variable is set, cause any build warnings to
# be treated as an error (causing the build to fail before
# testing and preventing merging).
CTEST_NO_WARNINGS_ALLOWED: true
CMAKE_GENERATOR: Unix Makefiles
# Delete old files in the cache (10G, the default limit, is GitHub's limit
# for all cached artifacts)
CCACHE_MAXSIZE: 250M
# For uniformity, always explicitly define the compilation cache instead
# of relying on how ccache interacts with XDG_CACHE_HOME
CCACHE_DIR: /compilationcache
steps:
- name: Checkout Source
uses: actions/checkout@v4
id: git
- name: Verify that clang-format was run
id: format
run: |
git config --global --add safe.directory '*'
./scripts/formatting/download-clang-format
./scripts/formatting/check-indentation
- name: Create keys
id: keys
run: |
echo "key1=$(( ${{ github.run_number }} - 1))" >> $GITHUB_ENV
echo "key2=$(( ${{ github.run_number }} - 2))" >> $GITHUB_ENV
echo "key3=$(( ${{ github.run_number }} - 3))" >> $GITHUB_ENV
echo "key4=$(( ${{ github.run_number }} - 4))" >> $GITHUB_ENV
echo "key5=$(( ${{ github.run_number }} - 5))" >> $GITHUB_ENV
- name: Populate ccache
uses: actions/cache@v4
env:
cache-name: ccache
id: cache
with:
path: ${{ env.CCACHE_DIR }}
# A fundamental problem with the cache is that it is identified by a
# single key and, should a cache with that key already exist, the
# cache will not be updated. This makes sense for things like NPM but
# not so much for ccache, since we get a new and unique cache each
# time we rebuild the library with a new branch.
#
# To get around this, always make the key unique and rely on
# restore-keys to find the highest-indexed key available. Explicitly
# try to restore things from the most recent builds.
key: ${{ runner.os }}-build-cmake-libmesh-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-build-cmake-libmesh-${{ env.key1 }}
${{ runner.os }}-build-cmake-libmesh-${{ env.key2 }}
${{ runner.os }}-build-cmake-libmesh-${{ env.key3 }}
${{ runner.os }}-build-cmake-libmesh-${{ env.key4 }}
${{ runner.os }}-build-cmake-libmesh-${{ env.key5 }}
${{ runner.os }}-build-cmake-libmesh-
${{ runner.os }}-build-cmake
- name: Configure IBAMR
id: configure
run: |
# HDF5 is installed in a weird way on Fedora - since we aren't using
# modules we have to intervene manually
pushd ../
mkdir -p hdf5-shim
ln -s /usr/include/mpich-x86_64 hdf5-shim/include
ln -s /usr/lib64/mpich/lib hdf5-shim/lib
export HDF5_ROOT=$(pwd)/hdf5-shim
popd
# If configuration fails we still want to save the output files:
set +e
bash -c "ctest -VV -S .github/cmake/ctest_configure.cmake"
configure_status=$?
set -e
# The directory /build/ibamr is hardcoded in cmake/github_ci.cmake
#
# Archive doesn't like absolute paths to files so dump everything in ~/
find /build -name CMakeConfigureLog.yaml -exec cp {} ./ \;
ccache --show-stats
exit $configure_status
- name: Archive CMakeConfigureLog.yaml
if: always()
uses: actions/upload-artifact@v4
with:
name: fedora33-CMakeError.log
path: CMakeConfigureLog.yaml
- name: Compile IBAMR
id: build-library
run: |
cd /build/ibamr
make -j2
ccache --show-stats
- name: Compile IBAMR examples
id: build-examples
run: |
cd /build/ibamr
make -j2 examples
ccache --show-stats
- name: Compile IBAMR tests
id: build-tests
run: |
cd /build/ibamr
make -j2 tests
ccache --show-stats
- name: Test IBAMR
id: test
run: |
bash -c "ctest --output-on-failure -VV -S .github/cmake/ctest_test.cmake"
ccache --show-stats
# build IBAMR with CMake, no libMesh, and run tests
build_ibamr_no_libmesh:
runs-on: ubuntu-latest
name: Build IBAMR and run tests (no libMesh)
container:
image: 'docker://wellsd2/ibamr:ibamr-0.14-bundled-deps'
env:
CMAKE_CONFIGURATION: fedora33_no_libmesh
# If this variable is set, cause any build warnings to
# be treated as an error (causing the build to fail before
# testing and preventing merging).
CTEST_NO_WARNINGS_ALLOWED: true
CMAKE_GENERATOR: Unix Makefiles
CCACHE_MAXSIZE: 250M
CCACHE_DIR: /compilationcache
steps:
- name: Checkout Source
uses: actions/checkout@v4
id: git
- name: Verify that clang-format was run
id: format
run: |
git config --global --add safe.directory '*'
./scripts/formatting/download-clang-format
./scripts/formatting/check-indentation
- name: Create keys
id: keys
run: |
echo "key1=$(( ${{ github.run_number }} - 1))" >> $GITHUB_ENV
echo "key2=$(( ${{ github.run_number }} - 2))" >> $GITHUB_ENV
echo "key3=$(( ${{ github.run_number }} - 3))" >> $GITHUB_ENV
echo "key4=$(( ${{ github.run_number }} - 4))" >> $GITHUB_ENV
echo "key5=$(( ${{ github.run_number }} - 5))" >> $GITHUB_ENV
- name: Populate ccache
uses: actions/cache@v4
env:
cache-name: ccache
id: cache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-build-cmake-no-libmesh-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-build-cmake-no-libmesh-${{ env.key1 }}
${{ runner.os }}-build-cmake-no-libmesh-${{ env.key2 }}
${{ runner.os }}-build-cmake-no-libmesh-${{ env.key3 }}
${{ runner.os }}-build-cmake-no-libmesh-${{ env.key4 }}
${{ runner.os }}-build-cmake-no-libmesh-${{ env.key5 }}
${{ runner.os }}-build-cmake-no-libmesh-
- name: Configure IBAMR
id: configure
run: |
# HDF5 is installed in a weird way on Fedora - since we aren't using
# modules we have to intervene manually
pushd ../
mkdir -p hdf5-shim
ln -s /usr/include/mpich-x86_64 hdf5-shim/include
ln -s /usr/lib64/mpich/lib hdf5-shim/lib
export HDF5_ROOT=$(pwd)/hdf5-shim
popd
bash -c "ctest -VV -S .github/cmake/ctest_configure.cmake"
ccache --show-stats
- name: Compile IBAMR
id: build-library
run: |
cd /build/ibamr
make -j2
ccache --show-stats
- name: Compile IBAMR examples
id: build-examples
run: |
cd /build/ibamr
make -j2 examples
ccache --show-stats
- name: Compile IBAMR tests
id: build-tests
run: |
cd /build/ibamr
make -j2 tests
ccache --show-stats
- name: Test IBAMR
id: test
run: |
bash -c "ctest --output-on-failure -VV -S .github/cmake/ctest_test.cmake"
# build IBAMR with autotools
build_ibamr_autotools:
runs-on: ubuntu-latest
name: Build IBAMR (autotools)
container:
image: 'docker://wellsd2/ibamr:ibamr-0.14-bundled-deps'
env:
CMAKE_GENERATOR: Unix Makefiles
CCACHE_MAXSIZE: 250M
CCACHE_DIR: /compilationcache
steps:
- name: Checkout Source
uses: actions/checkout@v4
id: git
- name: Verify that clang-format was run
id: format
run: |
git config --global --add safe.directory '*'
./scripts/formatting/download-clang-format
./scripts/formatting/check-indentation
- name: Create keys
id: keys
run: |
echo "key1=$(( ${{ github.run_number }} - 1))" >> $GITHUB_ENV
echo "key2=$(( ${{ github.run_number }} - 2))" >> $GITHUB_ENV
echo "key3=$(( ${{ github.run_number }} - 3))" >> $GITHUB_ENV
echo "key4=$(( ${{ github.run_number }} - 4))" >> $GITHUB_ENV
echo "key5=$(( ${{ github.run_number }} - 5))" >> $GITHUB_ENV
- name: Populate ccache
uses: actions/cache@v4
env:
cache-name: ccache
id: cache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-build-autotools-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-build-autotools-${{ env.key1 }}
${{ runner.os }}-build-autotools-${{ env.key2 }}
${{ runner.os }}-build-autotools-${{ env.key3 }}
${{ runner.os }}-build-autotools-${{ env.key4 }}
${{ runner.os }}-build-autotools-${{ env.key5 }}
${{ runner.os }}-build-autotools-
- name: Configure IBAMR (autotools)
id: configure
run: |
source /etc/profile.d/modules.sh
module load mpi
export CC="ccache $(which mpicc)"
export CXX="ccache $(which mpic++)"
# we are just compiling things so go for speed
export CFLAGS="-O0"
export CXXFLAGS="-O0"
export FFLAGS="-O0"
mkdir build
cd build
../configure PETSC_DIR=/petsc/ --with-samrai=/samrai \
--enable-libmesh --with-libmesh=/libmesh --with-libmesh-method=opt
ccache --show-stats
- name: archive
if: always()
uses: actions/upload-artifact@v4
with:
name: autotools-config.log
path: build/config.log
- name: Compile IBAMR (autotools)
id: build-library
run: |
source /etc/profile.d/modules.sh
module load mpi
export CC="ccache $(which mpicc)"
export CXX="ccache $(which mpic++)"
echo "CC=${CC}"
echo "CXX=${CXX}"
cd build
make -j2
ccache --show-stats
- name: Compile IBAMR examples
id: build-examples
run: |
source /etc/profile.d/modules.sh
module load mpi
cd build
make -j2 examples
ccache --show-stats
- name: Compile IBAMR tests
id: build-tests
run: |
source /etc/profile.d/modules.sh
module load mpi
cd build
make -j2 tests
ccache --show-stats
# build IBAMR with CMake when we use custom, not system, installations of dependencies
build_ibamr_archlinux:
runs-on: ubuntu-latest
name: Build IBAMR with a non-system MPI
container:
image: 'docker://wellsd2/ibamr:ibamr-0.14-custom-deps'
env:
CMAKE_CONFIGURATION: archlinux
CTEST_NO_WARNINGS_ALLOWED: true
CMAKE_GENERATOR: Unix Makefiles
CCACHE_MAXSIZE: 250M
CCACHE_DIR: /compilationcache
steps:
- name: Checkout Source
uses: actions/checkout@v4
id: git
- name: Verify that clang-format was run
id: format
run: |
git config --global --add safe.directory '*'
./scripts/formatting/download-clang-format
./scripts/formatting/check-indentation
- name: Create keys
id: keys
run: |
echo "key1=$(( ${{ github.run_number }} - 1))" >> $GITHUB_ENV
echo "key2=$(( ${{ github.run_number }} - 2))" >> $GITHUB_ENV
echo "key3=$(( ${{ github.run_number }} - 3))" >> $GITHUB_ENV
echo "key4=$(( ${{ github.run_number }} - 4))" >> $GITHUB_ENV
echo "key5=$(( ${{ github.run_number }} - 5))" >> $GITHUB_ENV
- name: Populate ccache
uses: actions/cache@v4
env:
cache-name: ccache
id: cache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-build-archlinux-cmake-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-build-archlinux-cmake-${{ env.key1 }}
${{ runner.os }}-build-archlinux-cmake-${{ env.key2 }}
${{ runner.os }}-build-archlinux-cmake-${{ env.key3 }}
${{ runner.os }}-build-archlinux-cmake-${{ env.key4 }}
${{ runner.os }}-build-archlinux-cmake-${{ env.key5 }}
${{ runner.os }}-build-archlinux-cmake-
- name: Configure IBAMR
id: configure
run: |
bash -c "ctest -VV -S .github/cmake/ctest_configure.cmake"
ccache --show-stats
- name: Compile IBAMR
id: build-library
run: |
cd /build/ibamr
make -j2
ccache --show-stats
- name: Install IBAMR
id: install
run: |
cd /build/ibamr
make install
- name: compile a sample project with an uninstalled IBAMR
id: sampleproject1
run: |
mkdir sample-project
cd sample-project
cp ../.github/project-template/CMakeLists.txt ./
cp ../.github/project-template/project.cpp ./
cmake -DIBAMR_ROOT=/build/ibamr .
make
./project
- name: compile a sample project with an installed IBAMR
id: sampleproject2
run: |
mkdir sample-project2
cd sample-project2
cp ../.github/project-template/CMakeLists.txt ./
cp ../.github/project-template/project.cpp ./
cmake -DIBAMR_ROOT=/ibamr .
make
./project