aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.codecov.yml1
-rw-r--r--.github/workflows/coverage.yml31
-rw-r--r--.grcov.yml5
-rw-r--r--CMakeLists.txt18
4 files changed, 45 insertions, 10 deletions
diff --git a/.codecov.yml b/.codecov.yml
index 3dd93e2e..4ba3431b 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -1,4 +1,5 @@
ignore:
- tests/*/*
+ - **/*_test.c
coverage:
range: 50..85
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644
index 00000000..6274bbd0
--- /dev/null
+++ b/.github/workflows/coverage.yml
@@ -0,0 +1,31 @@
+name: coverage
+on: [push]
+jobs:
+
+ build:
+ name: build
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ ubuntu-latest, macos-latest ]
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v1
+
+ - name: Configure
+ run: |
+ mkdir build
+ cd build
+ cmake -D NNG_ENABLE_COVERAGE=ON ..
+
+ - name: build
+ run: cmake --build build
+
+ - name: Test
+ run: cd build && ctest --output-on-failure
+
+ - name: Upload report
+ uses: codecov/codecov-action@v1
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ yml: ./.codecov.yml \ No newline at end of file
diff --git a/.grcov.yml b/.grcov.yml
new file mode 100644
index 00000000..781860c7
--- /dev/null
+++ b/.grcov.yml
@@ -0,0 +1,5 @@
+branch: true
+ignore-not-existing: true
+filter: covered
+output-type: lcov
+output-file: lcov.info \ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fb2b53f..939b1bb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,9 +156,7 @@ mark_as_advanced(NNG_NUM_TASKQ_THREADS)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(NNG_WARN_FLAGS "-Wall -Wextra -fno-omit-frame-pointer")
-elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
- set(NNG_WARN_FLAGS "-Wall -Wextra -fno-omit-frame-pointer")
-elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
+elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
set(NNG_WARN_FLAGS "-Wall -Wextra -fno-omit-frame-pointer")
endif ()
@@ -173,18 +171,18 @@ if (NNG_ENABLE_COVERAGE)
# is older than that, you will need to find something newer. For
# correct reporting, we always turn off all optimizations.
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- set(NNG_COVERAGE_FLAGS "-g -O0 --coverage")
- elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
- set(NNG_COVERAGE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
- elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
- set(NNG_COVERAGE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
+ set(NNG_COVERAGE_C_FLAGS "-g -O0 --coverage")
+ set(CMAKE_SHARED_LINKER_FLAGS --coverage)
+ elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
+ set(NNG_COVERAGE_C_FLAGS "-g -O0 --coverage")
+ set(CMAKE_SHARED_LINKER_FLAGS --coverage)
else ()
message(FATAL_ERROR "Unable to enable coverage for your compiler.")
endif ()
endif ()
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_FLAGS} ${NNG_SANITIZER_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_FLAGS} ${NNG_SANITIZER_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_C_FLAGS} ${NNG_SANITIZER_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_C_FLAGS} ${NNG_SANITIZER_FLAGS}")
TEST_BIG_ENDIAN(NNG_BIG_ENDIAN)
if (NNG_BIG_ENDIAN)