-
Notifications
You must be signed in to change notification settings - Fork 142
177 lines (141 loc) · 5.51 KB
/
audit.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
name: audit
on:
push:
branches:
- v4
pull_request:
branches:
- v4
jobs:
# run LLVM address sanitiser
sanitisation-test:
name: address sanitisation [${{ matrix.precision }}]
runs-on: macos-latest
# try all precisions without aborting
strategy:
fail-fast: false
matrix:
precision: [1, 2, 4]
# constants (which I cannot split overlines, GRR)
env:
build_dir: "build"
sanitiser_flags: -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize-address-use-after-scope
# perform the job
steps:
- name: Get QuEST
uses: actions/checkout@v4
# compile QuEST using clang address sanitiser, foregoing all parallelisations
- name: Configure CMake to use sanitiser
run: >
cmake -B ${{ env.build_dir }}
-DCMAKE_CXX_COMPILER=clang++
-DENABLE_TESTING=ON
-DENABLE_MULTITHREADING=OFF
-DFLOAT_PRECISION=${{ matrix.precision }}
-DCMAKE_CXX_FLAGS="${{ env.sanitiser_flags }}"
-DCMAKE_EXE_LINKER_FLAGS="${{ env.sanitiser_flags }}"
- name: Compile with sanitiser
run: cmake --build ${{ env.build_dir }}
# run unit tests in random order, excluding the integration tests
# TODO:
# ctest currently doesn't know of our Catch2 tags, so we
# are manually excluding each integration test by name
- name: Run unit tests with active sanitiser
run: ctest -j2 --output-on-failure --schedule-random -E "density evolution"
working-directory: ${{ env.build_dir }}
# run valgrind
memory-leak-test:
name: memory checks [${{ matrix.precision }}]
runs-on: ubuntu-latest
# try all precisions without aborting
strategy:
fail-fast: false
matrix:
precision: [1, 2, 4]
# constants (which I cannot split overlines, GRR)
env:
build_dir: "build"
# perform the job
steps:
- name: Get QuEST
uses: actions/checkout@v4
# compile QuEST like normal albeit without parallelisations
- name: Configure CMake
run: >
cmake -B ${{ env.build_dir }}
-DENABLE_TESTING=ON
-DENABLE_MULTITHREADING=OFF
-DFLOAT_PRECISION=${{ matrix.precision }}
- name: Compile QuEST
run: cmake --build ${{ env.build_dir }}
- name: Install valgrind
run: sudo apt install -y valgrind
# make valgrind fail CI if detecting issue when running unit tests in a randomised order
# TODO:
# ctest currently doesn't know of our Catch2 tags, so we are
# manually excluding each integration test by name
- name: Run unit tests under valgrind
run: >
valgrind --leak-check=full --error-exitcode=1
ctest -j2 --output-on-failure --schedule-random -E "density evolution"
working-directory: ${{ env.build_dir }}
# run lcov
coverage-test:
name: code coverage
# test only serial double-precision QuEST on Ubuntu
runs-on: ubuntu-latest
# constants: CI will fail if coverage less than below percent
# TODO: this is currently so low (1%) because we really need
# to run in MPI + GPU mode for reliable coverage statistics
env:
min_coverage: 1 # %
tracefile: "coverage.info"
# perform the job
steps:
- name: Get QuEST
uses: actions/checkout@v4
# work in a build directory to reduce verbosity below
- run: >
mkdir build;
cd build
# compile QuEST and unit tests in coverage mode. We opt to use
# Release mode (rather than Debug) and permit e.g. inlining for
# performance (else the runner times out), though this could
# corrupt the statistics in the future (it doesn't now, strangely)
- name: Configure CMake
run: >
cmake -B .
-DCMAKE_BUILD_TYPE=Release
-DENABLE_TESTING=ON
-DENABLE_MULTITHREADING=OFF
-DCMAKE_CXX_FLAGS="--coverage"
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
- name: Compile unit tests
run: make
# run the unit tests, saving coverage data to file
- name: Run unit tests
run: ctest -j2 --output-on-failure
# analyse the unit test coverage
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- name: Run LCOV
run: lcov --directory . --capture --output-file ${{ env.tracefile }} --ignore-errors source
# remove standard-library and testing and code from coverage data
- name: Filter LCOV results
run: lcov --remove ${{ env.tracefile }} '/usr/*' '*/tests/*' '*/_deps/*' --output-file ${{ env.tracefile }}
# TODO: temporarily remove MPI and GPU files from coverage stats, since unused
- name: Remove MPI and GPU coverage
run: lcov --remove ${{ env.tracefile }} '*/comm/*' '*/gpu/*' --output-file ${{ env.tracefile }}
# touched files are correct but percentages are strangely reported wrong in preview,
# even though the subsequent reporting below is correct - weird!
- name: Preview LCOV results (percentages are wrong)
run: lcov --list ${{ env.tracefile }}
# report coverage of remaining files in the triggering PR
- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@v4
with:
artifact-name: code-coverage-report
update-comment: true
coverage-files: ./${{ env.tracefile }}
minimum-coverage: ${{ env.min_coverage }}
github-token: ${{ secrets.GITHUB_TOKEN }}