srctree

Johan parent 710163ad 21cfe86f d5f585cc
Merge pull request #291 from johnor/github-actions-gcov

Run coverage job in github actions
.github/workflows/ci-linux.yaml added: 29, removed: 19, total 10
@@ -21,6 +21,14 @@ jobs:
version: "9"
configuration: Debug
 
- name: ubuntu-18.04-gcc-9-coverage
os: ubuntu-18.04
compiler: gcc
version: "9"
configuration: Debug
coverage: true
cmake-args: -DENABLE_COVERAGE=ON
 
- name: ubuntu-18.04-clang-8
os: ubuntu-18.04
compiler: clang
@@ -73,3 +81,9 @@ jobs:
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
run: |
(cd build && ctest -C ${{ matrix.configuration }} )
 
- name: Coverage
if: matrix.coverage
run: |
python3 -m pip install gcovr
(cd build && gcovr --gcov-executable gcov-9 -p --root .. --fail-under-line=94 --exclude 'CMakeFiles/' --exclude '_deps/' --exclude '(.+/)?test/' --exclude '.+/(application|nestest)/')
 
.travis.yml added: 29, removed: 19, total 10
@@ -58,21 +58,6 @@ matrix:
- find application core nes -name *.h -o -name *.cpp | xargs clang-format -style=file -i
- git diff --exit-code
 
- name: "gcc 9 coverage"
addons: &gcc9
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages:
- *common-apt-packages
- g++-9
before_install: pip install gcovr --user
script:
- CXX=g++-9 CXXFLAGS="--coverage" LDFLAGS="--coverage" cmake ..
- make
- ctest --output-on-failure
- gcovr --gcov-executable gcov-9 -p --root .. --fail-under-line=94 --exclude 'CMakeFiles/' --exclude '_deps/' --exclude '(.+/)?test/' --exclude '.+/(application|nestest)/'
 
install:
- python3 -m pip install pip==19.3.1 --upgrade
- python3 -m pip install cmake==3.16.3 ninja==1.9.0.post1 --upgrade --user
 
CMakeLists.txt added: 29, removed: 19, total 10
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.14)
project(n_e_s)
 
include(cmake/sanitizers.cmake)
include(cmake/coverage.cmake)
 
enable_testing()
 
 
filename was Deleted added: 29, removed: 19, total 10
@@ -0,0 +1,10 @@
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
option(ENABLE_COVERAGE "Enable coverage" OFF)
 
if (ENABLE_COVERAGE)
message(STATUS "Enabling code coverage")
add_compile_options(--coverage)
link_libraries(--coverage)
endif()
endif()