apply resharper suggestions #1081
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |