Tests: Add missing include #81
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, UT, coverage | |
on: [ push ] | |
jobs: | |
build-ut-coverage: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
compiler: | |
- cc: gcc-10 | |
cxx: g++-10 | |
- cc: clang-8 | |
cxx: clang++-8 | |
- cc: clang-10 | |
cxx: clang++-10 | |
- cc: clang-11 | |
cxx: clang++-11 | |
- cc: clang-12 | |
cxx: clang++-12 | |
env: | |
CC: ${{ matrix.compiler.cc }} | |
CXX: ${{ matrix.compiler.cxx }} | |
build_dir: build | |
steps: | |
- name: Fetch dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y lcov | |
sudo apt-get install -y valgrind | |
sudo apt-get install -y ${{ matrix.compiler.cc }} | |
sudo apt-get install -y ${{ matrix.compiler.cxx }} | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create build directory | |
run: mkdir -p ${build_dir} | |
- name: Configure project | |
run: cd ${build_dir} && cmake -DCODE_COVERAGE=ON .. | |
- name: Build project | |
run: cmake --build ${build_dir} -- -j$(nproc) | |
- name: Run unit tests | |
run: cd ${build_dir} && ctest | |
- name: Generate coverage report | |
if: matrix.compiler.cc == 'gcc-10' | |
run: | | |
lcov --directory . --capture --output-file coverage.info | |
lcov --include "*CommandParser.h*" --directory . --capture --output-file coverage.info | |
lcov --list coverage.info | |
- name: Upload coverage report | |
if: matrix.compiler.cc == 'gcc-10' | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.info | |
fail_ci_if_error: true | |
- name: Run valgrind | |
run: | | |
valgrind --tool=memcheck --leak-check=full --leak-resolution=med \ | |
--track-origins=yes --vgdb=no --error-exitcode=1 ${build_dir}/test/command_parser_test |