-
Notifications
You must be signed in to change notification settings - Fork 6
226 lines (188 loc) · 8.64 KB
/
build.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
name: Build
on:
push:
pull_request:
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]
- [windows, windows-latest, msvc, release]
- [windows, windows-latest, gcc, debug]
- [windows, windows-latest, gcc, release]
- [windows, windows-latest, clang, debug]
- [windows, windows-latest, clang, release]
- [linux, ubuntu-latest, gcc, debug]
- [linux, ubuntu-latest, gcc, release]
- [linux, ubuntu-latest, clang, debug]
- [linux, ubuntu-latest, clang, release]
env:
OPERATING_SYSTEM: ${{ matrix.platform[0] }}
DISTRIBUTION: ${{ matrix.platform[1] }}
COMPILER: ${{ matrix.platform[2] }}
BUILD_TYPE: ${{ matrix.platform[3] }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Clang
if: matrix.platform[2] == 'clang'
uses: KyleMayes/install-llvm-action@v1
with:
version: "17.0"
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Configure
shell: bash
run: |
if [ "${{ matrix.platform[2] }}" == "msvc" ]; then
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform[3] }} -G "Visual Studio 17 2022" -DCMAKE_CXX_COMPILER_TARGET=x86_64-pc-${{ matrix.platform[0] }}-msvc -DCMAKE_C_COMPILER_TARGET=x86_64-pc-${{ matrix.platform[0] }}-msvc
elif [ "${{ matrix.platform[2] }}" == "clang" ]; then
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform[3] }} -G Ninja -DCMAKE_CC=clang -DCMAKE_CXX=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_TARGET=x86_64-pc-${{ matrix.platform[0] }}-gnu -DCMAKE_C_COMPILER_TARGET=x86_64-pc-${{ matrix.platform[0] }}-gnu
elif [ "${{ matrix.platform[2] }}" == "gcc" ]; then
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform[3] }} -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_COMPILER_TARGET=x86_64-pc-${{ matrix.platform[0] }}-gnu -DCMAKE_C_COMPILER_TARGET=x86_64-pc-${{ matrix.platform[0] }}-gnu
fi
- name: Build
run: cmake --build build --parallel --config ${{ matrix.platform[3] }}
- name: Test
# TODO: figure out why unit testing doesn't work on windows clang
if: |
!(matrix.platform[0] == 'windows' && matrix.platform[2] == 'clang')
run: ctest --test-dir build --build-config ${{ matrix.platform[3] }} --output-on-failure
- name: Regression
# TODO: figure out why regression testing doesn't work on windows gnu or windows clang
if: |
!(matrix.platform[0] == 'windows' && (matrix.platform[2] == 'gcc' || matrix.platform[2] == 'clang'))
shell: bash
run: |
echo "Starting regression tests for $OPERATING_SYSTEM $BUILD_TYPE"
failures=()
for FORMAT in "ASCII" "ABBREV_ASCII" "BINARY" "FLATTENED_BINARY" "JSON"; do
# TODO: this is dumb, these linux folders probably shouldnt include OS version in their names
if [ "$OPERATING_SYSTEM" == "linux" ]; then
./bin/$BUILD_TYPE-x64-Ubuntu-22.04/examples/Converter_Components/Converter_Components database/messages_public.json regression/BESTUTMBIN.GPS $FORMAT > /dev/null
else
./bin/$BUILD_TYPE-x64-Windows/examples/Converter_Components/Converter_Components database/messages_public.json regression/BESTUTMBIN.GPS $FORMAT > /dev/null
fi
if ! cmp -s regression/BESTUTMBIN.GPS.$FORMAT regression/targets/BESTUTMBIN.GPS.$FORMAT; then
failures+=("OEM-$FORMAT")
fi
if ! cmp -s regression/BESTUTMBIN.GPS.$FORMAT.UNKNOWN regression/targets/BESTUTMBIN.GPS.$FORMAT.UNKNOWN; then
failures+=("OEM-$FORMAT.UNKNOWN")
fi
done
if [ ${#failures[@]} -gt 0 ]; then
echo "One or more regression tests failed! ${failures[@]}"
exit 1
fi
echo "Regression tests for $OPERATING_SYSTEM $BUILD_TYPE done!"
- name: Upload Artifacts
if: failure()
uses: actions/[email protected]
with:
name: ${{ matrix.platform[0] }}-${{ matrix.platform[2] }}-${{ matrix.platform[3] }}-artifacts
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 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)
# =========================================================
# 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 CMake
uses: lukka/get-cmake@latest
- name: Static code analysis
run: |
cmake -S . -B 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
cmake --build build --parallel --config Debug
# =========================================================
# Code Coverage Job
# =========================================================
code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Install GCC Coverage
run: |
sudo apt-get update
sudo apt-get install -y gcovr
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=debug -G "Ninja" -DCOVERAGE=ON
- name: Build
run: cmake --build build --parallel --config debug
- name: Run Tests
run: |
cd build
ctest
cd ..
- name: Generate HTML code coverage reports
run: |
mkdir build/code-coverage
gcovr -r ./src/ ./build/ --exclude='.*/test/.*' --exclude='.*/dynamic_library/.*' --exclude='.*/version.h' --html --html-details -o ./build/code-coverage/index.html
- name: Coverage visualization in pipeline summary
run: gcovr -r ./src/ ./build/ --exclude='.*/test/.*' --exclude='.*/dynamic_library/.*' --exclude='.*/version.h' --exclude-unreachable-branches --print-summary -o ./build/coverage.xml
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: code-coverage
path: |
build/code-coverage
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.6'
pip3 install 'sphinx==5.0.0'
pip3 install 'sphinx_rtd_theme==1.2.2'
pip3 install 'json2html==1.3.0'
- name: Generate documentation for EDIE
run: |
sphinx-build src/decoders/common/doc doc/decoders/common/doc/html
sphinx-build src/decoders/novatel/doc doc/decoders/novatel/doc/html
sphinx-build src/hw_interface/stream_interface/doc doc/hw_interface/stream_interface/doc/html
python3 scripts/database_to_html.py database/messages_public.json
- name: Archive documentation artifacts
uses: actions/[email protected]
with:
name: documentation
path: |
doc
database/messages_public.html