-
Notifications
You must be signed in to change notification settings - Fork 3
267 lines (248 loc) · 9.11 KB
/
ci-tests.yaml
File metadata and controls
267 lines (248 loc) · 9.11 KB
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
name: "CI Tests"
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
codespell-check:
name: "Check codespell conformance"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Run codespell"
uses: codespell-project/actions-codespell@v2
docker-check:
name: "Check Docker image"
runs-on: ubuntu-24.04
strategy:
matrix:
cmake-build-type:
- "Debug"
- "Release"
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: "Build Docker image"
uses: docker/build-push-action@v5
with:
build-args: |
CAPIO_BUILD_TESTS=ON
CAPIO_LOG=${{ matrix.cmake-build-type == 'Debug' && 'ON' || 'OFF' }}
CMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }}
load: true
tags: alphaunito/capio:latest
- name: "Run unit tests with Docker"
run: |
echo "Run CAPIO POSIX Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--name capio-docker \
alphaunito/capio:latest \
capio_posix_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO server Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--name capio-docker \
alphaunito/capio:latest \
capio_server_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO syscall Unit tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--env LD_PRELOAD=libcapio_posix.so \
--name capio-docker \
alphaunito/capio:latest \
jq -n --arg pwd $(pwd) \
'{name: "CAPIO", IO_Graph: [], exclude: [$pwd + "/aNonExistingFile", $pwd, $pwd + "/"]}' \
> test_config.json && \
capio_syscall_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO integration tests"
docker run --rm \
--env CAPIO_DIR=/tmp \
--env CAPIO_LOG_LEVEL=-1 \
--env LD_PRELOAD=libcapio_posix.so \
--name capio-docker \
alphaunito/capio:latest \
capio_integration_tests \
--gtest_break_on_failure \
--gtest_print_time=1
format-check:
name: "Check ${{ matrix.path }} clang-format conformance"
runs-on: ubuntu-24.04
strategy:
matrix:
path:
- "capio/common"
- "capio/posix"
- "capio/server"
- "capio/tests"
steps:
- uses: actions/checkout@v4
- name: "Run clang-format style check"
uses: DoozyX/clang-format-lint-action@v0.20
with:
source: ${{matrix.path}}
extensions: 'h,cpp,c,hpp'
clangFormatVersion: 16
unit-tests:
name: "Build ${{ matrix.build_type }} with ${{ matrix.compiler }}"
runs-on: ubuntu-24.04
strategy:
matrix:
build_type:
- Debug
- Release
compiler:
- gcc:9
- gcc:10
- gcc:11
- gcc:12
- gcc:13
- gcc:14
- gcc:15
- zhongruoyu/llvm-ports:13.0-trixie
- zhongruoyu/llvm-ports:14.0-trixie
- zhongruoyu/llvm-ports:15.0-trixie
- zhongruoyu/llvm-ports:16.0-trixie
- zhongruoyu/llvm-ports:17.0-trixie
- zhongruoyu/llvm-ports:18-trixie
- zhongruoyu/llvm-ports:19.1-bullseye
- zhongruoyu/llvm-ports:20.1-bullseye
- zhongruoyu/llvm-ports:21.1-bullseye
container:
image: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v4
- name: "Install gfortran (OpenMPI dependency)"
if: ${{ startsWith(matrix.compiler, 'gcc:') }}
run: |
apt update
apt install -y gfortran || true
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-* 100
- name: "Install packages"
run: |
apt update
apt install -y \
libcapstone-dev \
openmpi-bin \
libopenmpi-dev \
ninja-build \
cmake \
make \
sudo \
bash \
git \
jq \
pkg-config \
build-essential \
wget \
tar \
python3 \
python3-pip \
python3-venv
- name: "Run CMake"
shell: bash
run: |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCAPIO_LOG=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \
-DENABLE_COVERAGE=${{ matrix.build_type == 'Debug' && 'ON' || 'OFF' }} \
-DCAPIO_BUILD_TESTS=ON \
-G Ninja \
-B ../build \
-S ${GITHUB_WORKSPACE}
cmake --build ../build -j $(nproc)
sudo cmake --install ../build --prefix /usr/local
- name: "Run tests"
id: run-tests
shell: bash
timeout-minutes: 5
env:
CAPIO_DIR: ${{ github.workspace }}
CAPIO_LOG_LEVEL: -1
run: |
jq -n \
--arg pwd $(pwd) \
'{name: "CAPIO", IO_Graph: [], exclude: [$pwd + "/aNonExistingFile", $pwd, $pwd + "/"]}' \
> test_config.json
export CONFIG_PATH=$(realpath test_config.json)
export LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
echo "Run CAPIO POSIX Unit tests"
capio_posix_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO server Unit tests"
capio_server_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO syscall Unit tests"
LD_PRELOAD=libcapio_posix.so \
capio_syscall_unit_tests \
--gtest_break_on_failure \
--gtest_print_time=1
echo "Run CAPIO integration tests"
rm -rf /dev/shm/CAPIO*
LD_PRELOAD=libcapio_posix.so \
capio_integration_tests \
--gtest_break_on_failure \
--gtest_print_time=1
- name: "Show client logs on failure"
if: ${{ always() && steps.run-tests.outcome == 'failure' && matrix.build_type == 'Debug' }}
run: tail -v -n +1 capio_logs/posix/$(hostname)/posix_thread_*.log
- name: "Show server logs on failure"
if: ${{ always() && steps.run-tests.outcome == 'failure' && matrix.build_type == 'Debug' }}
run: tail -v -n +1 capio_logs/server/$(hostname)/server_thread_*.log
- name: "Generate coverage report"
if: ${{ matrix.build_type == 'Debug' }}
run: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade gcovr
gcovr \
--exclude-throw-branches \
--xml coverage.xml \
--gcov-executable gcov \
--exclude capio/tests \
--gcov-ignore-parse-errors=negative_hits.warn \
../build
- name: "Compute Valid Artifact Name"
if: ${{ matrix.build_type == 'Debug' }}
id: calc-name
run: |
CLEAN_NAME=$(echo "${{ matrix.compiler }}" | tr '/:.' '-' | sed 's/--/-/g')
echo "artifact_name=${CLEAN_NAME}-tests" >> $GITHUB_OUTPUT
- name: "Upload coverage report"
if: ${{ matrix.build_type == 'Debug' }}
uses: actions/upload-artifact@v4
with:
name: ${{ steps.calc-name.outputs.artifact_name }}
path: ./coverage.xml
retention-days: 1
if-no-files-found: error
upload-to-codecov:
name: "Codecov report upload"
needs: [ "unit-tests" , "codespell-check" , "format-check" ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Download artifacts"
uses: actions/download-artifact@v4
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}