forked from novatel/novatel_edie
-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (205 loc) · 8.68 KB
/
cpp.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
name: C++
on:
push:
paths-ignore:
- '**.md'
- '.gitignore'
- 'resources/**'
pull_request:
paths-ignore:
- '**.md'
- '.gitignore'
- 'resources/**'
workflow_dispatch:
jobs:
# =========================================================
# Build Job
# =========================================================
build:
name: CMake - ${{ matrix.platform[0] }} - ${{ matrix.platform[2] }} - ${{ matrix.platform[3] }}
runs-on: ${{ matrix.platform[1] }}
strategy:
matrix:
platform:
- [windows, windows-latest, msvc, Debug, msvc, AMD64]
- [windows, windows-latest, msvc, Release, msvc, AMD64]
- [windows, windows-latest, gnu, Debug, gnu, AMD64]
- [windows, windows-latest, gnu, Release, gnu, AMD64]
- [windows, windows-latest, clang-cl, Debug, clang, AMD64]
- [windows, windows-latest, clang-cl, Release, clang, AMD64]
- [linux, ubuntu-latest, gnu, Debug, gnu, x86_64]
- [linux, ubuntu-latest, gnu, Release, gnu, x86_64]
- [linux, ubuntu-latest, clang, Debug, clang, x86_64]
- [linux, ubuntu-latest, clang, Release, clang, x86_64]
env:
OPERATING_SYSTEM: ${{ matrix.platform[0] }}
DISTRIBUTION: ${{ matrix.platform[1] }}
COMPILER: ${{ matrix.platform[2] }}
BUILD_TYPE: ${{ matrix.platform[3] }}
COMPILER_ID: ${{ matrix.platform[4] }}
ARCH: ${{ matrix.platform[5]}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Clang
if: env.COMPILER == 'clang'
uses: KyleMayes/install-llvm-action@v1
with:
version: "17.0"
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Configure
shell: bash
run: |
if [ "${{ env.COMPILER }}" == "msvc" ]; then
cmake -S . -B out/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G "Visual Studio 17 2022" -DWARNINGS_AS_ERRORS=ON
elif [ "${{ env.COMPILER }}" == "clang-cl" ]; then
cmake -S . -B out/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G "Visual Studio 17 2022" -T ClangCL #TODO: -DWARNINGS_AS_ERRORS=ON
elif [ "${{ env.COMPILER }}" == "clang" ]; then
cmake -S . -B out/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DWARNINGS_AS_ERRORS=ON
elif [ "${{ env.COMPILER }}" == "gnu" ]; then
cmake -S . -B out/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DCMAKE_CXX_COMPILER=g++ -DWARNINGS_AS_ERRORS=ON
fi
- name: Build
run: cmake --build out/build --parallel --config ${{ env.BUILD_TYPE }}
- name: Inspect build outputs
if: env.OPERATING_SYSTEM == 'linux'
run: |
ls -lh out/build/bin/*
(cd out/build/bin/* && for f in *; do echo $f; objdump -p $f | grep -P 'RUNPATH|RPATH' || true; done)
- name: Unit Tests
run: ctest --test-dir out/build --build-config ${{ env.BUILD_TYPE }} --output-on-failure
- name: Regression Tests
shell: bash
run: |
echo "Starting regression tests for $OPERATING_SYSTEM $BUILD_TYPE"
bash regression/run_tests.sh ./out/build/bin/$OPERATING_SYSTEM-$ARCH-$COMPILER_ID-$BUILD_TYPE/converter_components
echo "Regression tests for $OPERATING_SYSTEM $BUILD_TYPE done!"
- name: Upload Build Artifacts
uses: actions/[email protected]
with:
name: ${{ env.OPERATING_SYSTEM }}-${{ env.ARCH }}-${{ env.COMPILER }}-${{ env.BUILD_TYPE }}-bin
path: out/build/bin/
- name: Upload Regression Artifacts on Failure
if: failure()
uses: actions/[email protected]
with:
name: ${{ env.OPERATING_SYSTEM }}-${{ env.ARCH }}-${{ env.COMPILER }}-${{ env.BUILD_TYPE }}-regression
path: regression/
# =========================================================
# Clang Format Job
# =========================================================
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check code formatting
run: find include src examples \( -name '*.cpp' -o -name '*.hpp' \) -exec clang-format -Werror --style=file -n {} + || (echo "Clang-format failed! See the README if you don't know how to fix this." && exit 1)
# =========================================================
# Editor Config Job
# =========================================================
editorconfig:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main
with:
version: 3.1.0
- name: Check CMakeLists.txt formatting
run: find . \( -name 'CMakeLists.txt' \) -exec editorconfig-checker {} \+ || { echo "EditorConfig check failed! See the README if you don't know how to fix this."; exit 1; }
- name: Check C++ formatting
run: find include src examples \( -name '*.cpp' -o -name '*.hpp' \) -exec editorconfig-checker {} \+ || { echo "EditorConfig check failed! See the README if you don't know how to fix this."; exit 1; }
# =========================================================
# Clang Tidy Job
# =========================================================
clang-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "17.0"
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Static code analysis
run: |
cmake -S . -B out/build -DCMAKE_CXX_CLANG_TIDY=clang-tidy -DCMAKE_BUILD_TYPE=Debug -G Ninja -DCMAKE_CC=clang -DCMAKE_CXX=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_TARGET=x86_64-pc-linux-gnu -DCMAKE_C_COMPILER_TARGET=x86_64-pc-linux-gnu -DWARNINGS_AS_ERRORS=ON
cmake --build out/build --parallel --config Debug
# =========================================================
# Code Coverage Job
# =========================================================
code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Install GNU Coverage
run: |
sudo apt-get update
sudo apt-get install -y gcovr
- name: Configure
run: cmake -S . -B out/build -DCMAKE_BUILD_TYPE=Debug -G Ninja -DCOVERAGE=ON -DWARNINGS_AS_ERRORS=ON
- name: Build
run: cmake --build out/build --parallel --config debug
- name: Run Tests
run: cd out/build && ctest && cd ..
- name: Generate HTML code coverage reports
run: |
mkdir out/build/code-coverage
gcovr -r ./src/ ./out/build/ --exclude='.*/test/.*' --exclude='.*/version.h' --html --html-details -o ./out/build/code-coverage/index.html
- name: Coverage visualization in pipeline summary
run: gcovr -r ./src/ ./out/build/ --exclude='.*/test/.*' --exclude='.*/version.h' --exclude-unreachable-branches --print-summary -o ./out/build/coverage.xml
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: code-coverage
path: |
out/build/code-coverage
out/build/coverage.xml
# =========================================================
# Documentation Job
# =========================================================
documentation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen=1.9.1-2ubuntu2
pip3 install 'exhale==0.3.7'
pip3 install 'sphinx==7.3.7'
pip3 install 'sphinx_rtd_theme==2.0.0'
pip3 install 'json2html==1.3.0'
- name: Generate documentation for EDIE
run: |
sphinx-build docs docs/build
python3 scripts/database_to_html.py database/messages_public.json
- name: Archive documentation artifacts
uses: actions/[email protected]
with:
name: documentation
path: |
docs/build
database/messages_public.html