-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kagatikar Saiprasad
authored and
Kagatikar Saiprasad
committed
Jan 25, 2021
1 parent
bcb9898
commit 04bcbef
Showing
4 changed files
with
75 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Code_Coverage | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.config.name }} | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { | ||
name: "Ubuntu Latest - GCC", artifact: "linux-gcc.tar.xz", | ||
os: ubuntu-latest, | ||
cc: "gcc-9", cxx: "g++-9" | ||
} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Install Linux dependencies | ||
if: runner.os == 'Linux' | ||
run: sudo apt-get install libgtest-dev cmake lcov; | ||
|
||
- name: Build gtest | ||
run: cd /usr/src/gtest; sudo cmake CMakeLists.txt; sudo make; sudo cp *.a /usr/lib; | ||
|
||
- name: Build | ||
run : mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON .. ; make; | ||
|
||
- name : Run tests | ||
run : cd bin; ./Generic_Logger_test; | ||
|
||
- name : Capture coverage stats | ||
run : | | ||
cd bin; lcov --directory ../build/ --capture --output-file coverage.info | ||
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' --output-file coverage.info | ||
lcov --list coverage.info | ||
export CODECOV_TOKEN="33cd74a9-f59c-4eca-aeed-c70aa55866e5" | ||
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,40 @@ | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.10) | ||
project(Generic_Logger) | ||
|
||
add_library(generic_logger src/logger.cpp) | ||
include_directories(include) | ||
|
||
# Tests | ||
find_package(GTest REQUIRED) | ||
if (GTest_FOUND) | ||
message("Found GTest") | ||
add_executable(Generic_Logger_test test/test_logger.cpp) | ||
target_link_libraries(Generic_Logger_test GTest::GTest GTest::Main generic_logger) | ||
endif() | ||
|
||
# Coverage | ||
if(CMAKE_BUILD_TYPE STREQUAL "coverage" OR CODE_COVERAGE) | ||
if(CMAKE_COMPILER_IS_GNUCXX) | ||
message("Building with lcov Code Coverage Tools") | ||
|
||
find_program(LCOV_PATH lcov) | ||
find_program(GENHTML_PATH genhtml) | ||
|
||
# Warning/Error messages | ||
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug")) | ||
message(WARNING "Code coverage results with an optimized (non-Debug) build may be misleading") | ||
endif() | ||
|
||
if(NOT LCOV_PATH) | ||
message(FATAL_ERROR "lcov not found! Aborting...") | ||
endif() | ||
|
||
if(NOT GENHTML_PATH) | ||
message(FATAL_ERROR "genhtml not found! Aborting...") | ||
endif() | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -fprofile-arcs -ftest-coverage") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage") | ||
else() | ||
message(FATAL_ERROR "Code coverage requires GCC. Aborting.") | ||
endif() | ||
endif() | ||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin/) | ||
add_library(generic_logger src/logger.cpp) | ||
include_directories(include) |
This file was deleted.
Oops, something went wrong.