diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 1d7a2b8..7b829a7 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -11,13 +11,13 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Configure and build + - name: Configure, build, and run Google Test run: | - make build + make test - - name: Run Google Test + - name: Run coverage run: | - make test + make coverage - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v3 diff --git a/CMakeLists.txt b/CMakeLists.txt index ea906a9..38076dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Define explicitly to use of the standard C++17 declared in the previous line set(CMAKE_CXX_EXTENSIONS OFF) # Disabling vendor-specific extensions -option(ENABLE_COVERAGE "Enable a Code Coverage build." ON) +option(ENABLE_COVERAGE "Enable a Code Coverage build." OFF) ### CMAKE MODULES set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/) diff --git a/Makefile b/Makefile index d057df1..5b48c85 100644 --- a/Makefile +++ b/Makefile @@ -2,19 +2,27 @@ all: build @echo "" @echo "Done!" -config: - @echo "-------------------- Configure CMake ---------------------" +build: + @echo "-------------------- Configure and Build CMake -----------" cmake -S . -B build + cmake --build build -- -j4 @echo "" -build: config - @echo "-------------------- Build CMake--------------------------" +test: build + @echo "-------------------- Run CTest ---------------------------" + cd build && pwd && ctest --verbose + @echo "" + +coverage: + @echo "-------------------- Build Coverage--------------------------" + cmake -DENABLE_COVERAGE=ON -S . -B build cmake --build build --config Debug --target coverage -j4 @echo "" -test: - @echo "-------------------- Run CTest ---------------------------" - cd build && pwd && ctest --verbose +report: + @echo "-------------------- Coverage Report ---------------------" + lcov --capture --directory build/coverage --output-file coverage.info + genhtml coverage.info --output-directory test/ @echo "" dependency: