Skip to content

Commit

Permalink
travis-ci: Add codecov integration
Browse files Browse the repository at this point in the history
  • Loading branch information
vt-alt committed Oct 29, 2019
1 parent 36af4d8 commit d2a56fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ language: c

addons:
apt:
packages: [ cpanminus ]
packages: [ cpanminus lcov ]
homebrew:
packages: [ cpanminus ]

Expand All @@ -19,7 +19,8 @@ env:

matrix:
include:
- os: linux
- env: COV=-DCODE_COVERAGE=ON
os: linux
compiler: gcc
- env: LABEL="linux-ppc64le" CMAKE_VERSION=3.15.1
os: linux-ppc64le
Expand Down Expand Up @@ -49,6 +50,12 @@ script:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then export DYLD_LIBRARY_PATH="${PREFIX}/lib:${DYLD_LIBRARY_PATH:-}"; fi
- mkdir build
- cd build
- cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib -DOPENSSL_ENGINES_DIR=${PREFIX}/engines ${ASAN} ..
- cmake -DOPENSSL_ROOT_DIR=${PREFIX} -DOPENSSL_LIBRARIES=${PREFIX}/lib -DOPENSSL_ENGINES_DIR=${PREFIX}/engines ${ASAN} ${COV} ..
- if [ ! -z ${COVERITY_SCAN_TOKEN+x} -a "${RUN_COVERITY}" = "1" ]; then curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || true; else make; fi
- make test CTEST_OUTPUT_ON_FAILURE=1

after_success:
- lcov --capture --directory . --output-file coverage.info
- lcov --remove coverage.info '/usr/*' --output-file coverage.info
- lcov --list coverage.info
- bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ if (ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g3 -fno-omit-frame-pointer")
endif()

option(CODE_COVERAGE "Enable coverage reporting" OFF)
if (CODE_COVERAGE)
message(STATUS "Code coverage enabled")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
endif(CODE_COVERAGE)

set(CMAKE_C_STANDARD 90)
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME_C)
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME_RT)
Expand Down

0 comments on commit d2a56fd

Please sign in to comment.