Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump codecov/codecov-action from 3 to 4 #7

Merged
merged 17 commits into from
Jun 3, 2024
16 changes: 12 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
llvm-version: "5"
description: "LLVM 5"
cppstd: "11 14 17"
gcov_executable: "llvm-cov gcov"

- os: ubuntu-20.04
# oldest GCC that the setup-gcc action is able to install
Expand All @@ -32,6 +33,7 @@ jobs:
- os: ubuntu-latest
# default GCC, which has gcov
cppstd: "11 14 17 20 23"
gcov_executable: "gcov"

- os: macos-latest
# uses Apple Clang
Expand Down Expand Up @@ -59,6 +61,8 @@ jobs:

- name: Build and Test
run: |
pip install gcovr

for cppstd in ${{ matrix.cppstd }}; do
echo ""
echo ""
Expand All @@ -68,13 +72,17 @@ jobs:
cmake --build $BUILD --config Debug
cd $BUILD/tests
ctest -C Debug --output-on-failure --verbose
if [ -n '${{ matrix.gcov_executable }}' ]; then
gcovr --delete --root ../../ --print-summary --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' --merge-mode-functions=separate --gcov-ignore-parse-errors=negative_hits.warn_once_per_file
fi
cd ../..
done
shell: bash

- name: Upload Coverage to Codecov
if: contains(matrix.os, 'ubuntu')
uses: codecov/codecov-action@v3
if: matrix.gcov_executable != ''
uses: codecov/codecov-action@v4
with:
gcov: true
gcov_include: include/*
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ parsers:
branch_detection:
conditional: no
loop: no
cobertura:
partials_as_hits: true
ignore:
- "tests"
- "benchmark"
5 changes: 4 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ endif()
option(TASK_THREAD_POOL_TEST_COVERAGE "Code-coverage" OFF)
if(TASK_THREAD_POOL_TEST_COVERAGE)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options("--coverage")
add_compile_options("-O0" "--coverage")
add_link_options("-lgcov" "--coverage")
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options("-O0" "--coverage")
add_link_options("--coverage")
endif()
endif()

Expand Down