-
Notifications
You must be signed in to change notification settings - Fork 11
166 lines (146 loc) · 5.32 KB
/
linux-gnu-cmake.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
name: linux-gnu-cmake
on:
push:
branches:
- main
paths-ignore:
- 'docs/'
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/'
- 'AUTHORS.md'
- 'LICENSE.md'
- 'README.md'
jobs:
linux-tests:
timeout-minutes: 90
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: ${{ matrix.os }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-22.04
fcompiler: gfortran-12
ccompiler: gcc-12
gcov: gcov-12
spack_compiler: gcc@=12.3.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: coverage
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-9
ccompiler: gcc-9
gcov: gcov-9
spack_compiler: gcc@=9.5.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-10
ccompiler: gcc-10
gcov: gcov-10
spack_compiler: gcc@=10.5.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: debug
memcheck: false
- os: ubuntu-22.04
fcompiler: gfortran-11
ccompiler: gcc-11
gcov: gcov-11
spack_compiler: gcc@=11.4.0
spack_os: "ubuntu:22.04"
shell: bash
build_type: debug
memcheck: false
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Show version information
run: |
${{ matrix.fcompiler }} --version
${{ matrix.ccompiler }} --version
- name: Set up Spack
uses: spack/setup-spack@v2
with:
ref: develop-2024-10-06
- name: Install dependencies in spack environment
run: |
spack -e ./share/spack-env/ mirror set --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
spack -e ./share/spack-env/ compiler find
spack -e ./share/spack-env/ external find --not-buildable
spack -e ./share/spack-env/ config add packages:feq-parse:require:["'%${{ matrix.spack_compiler }}'"]
spack -e ./share/spack-env/ config add packages:hdf5:require:["'%${{ matrix.spack_compiler }}'"]
spack -e ./share/spack-env/ config add packages:openmpi:require:["'%${{ matrix.spack_compiler }}'"]
spack -e ./share/spack-env/ concretize -f
spack -e ./share/spack-env/ install --no-check-signature
- name: Build with Cmake
shell: spack-bash {0}
run: |
spack env activate ./share/spack-env/
mkdir build
cd build
FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} \
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DSELF_MPIEXEC_NUMPROCS=2 \
../
make -j $(nproc) VERBOSE=1
- name: Initialize coverage counters
if: ${{ matrix.build_type == 'coverage' }}
run: |
sudo apt-get update -y && sudo apt-get install lcov
lcov --capture \
--initial \
--directory ./build/src/ \
--gcov=${{ matrix.gcov }} \
--output-file /home/runner/work/initial.info
- name: Run ctests
run: |
export WORKSPACE=/home/runner/work/SELF/SELF/
ctest --verbose \
--output-on-failure \
--test-dir ./build/
- name: Create coverage report
if: ${{ matrix.build_type == 'coverage' }}
run: |
lcov --capture \
--directory ./build/src/ \
--gcov=${{ matrix.gcov }} \
--output-file /home/runner/work/ctest-capture.info
lcov --add-tracefile /home/runner/work/initial.info \
--add-tracefile /home/runner/work/ctest-capture.info \
--gcov=${{ matrix.gcov }} \
--output-file /home/runner/work/coverage.info
- name: codecov
if: ${{ matrix.build_type == 'coverage' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: /home/runner/work/coverage.info
flags: github-serial-ctests
- name: Run memory checks with Valgrind (only Linux and GNU compilers)
if: ${{ matrix.memcheck }}
run: |
sudo apt-get install -y valgrind
for f in $(find ./build/test/ -executable -type f)
do
echo $f
valgrind --undef-value-errors=no --error-exitcode=1 -s $f -A
done
- name: Push packages and update index
run: |
spack -e ./share/spack-env/ mirror set --push --oci-username ${{ github.actor }} --oci-password "${{ secrets.GITHUB_TOKEN }}" local-buildcache
spack -e ./share/spack-env/ buildcache push --base-image ${{ matrix.spack_os }} --update-index local-buildcache
if: ${{ !cancelled() }}