From cc0d79e83c4087bb5b683d56becc4e2fdab9f08c Mon Sep 17 00:00:00 2001 From: pit-ray Date: Tue, 13 Feb 2024 03:59:17 +0900 Subject: [PATCH] fix coveralls --- .github/workflows/coveralls.yml | 13 +++++++++++-- tests/CMakeLists.txt | 13 ++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index 4530736..162e505 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -28,6 +28,7 @@ on: env: BUILD_TYPE: Debug + TOKEN: ${{secrets.COVERITY_TOKEN}} jobs: Windows: @@ -44,8 +45,8 @@ jobs: with: arch: x64 - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2.2.3 + - name: Install cpp-coveralls + run: pip install --user cpp-coveralls - name: Configure CMake run: cmake -B build_test tests @@ -55,3 +56,11 @@ jobs: - name: Test run: ctest -C ${{env.BUILD_TYPE}} --test-dir build_test --output-on-failure + + - name: Collect gcov files + run: | + cmake -B build_test tests -DCOVERAGE=1 + tar xvf build_test/gcov.tar.gz + + - name: Submit the gcov into the Coveralls + run: coveralls -i Testing/CoverageInfo/fluent_tray.hpp.gcov -t ${{env.TOKEN}} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bdc196e..7e751de 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.5.0) project(fluent-tray-test VERSION 0.0.1) enable_testing() @@ -96,3 +96,14 @@ set( CMAKE_CTEST_ARGUMENTS "${CMAKE_CTEST_ARGUMENTS} --verbose --no-label-summary --parallel ${PROC_N}" ) + +if(${COVERAGE}) + include(CTestCoverageCollectGCOV) + ctest_coverage_collect_gcov( + TARBALL gcov.tar.gz + TARBALL_COMPRESSION GZIP + SOURCE ${PROJECT_SOURCE_DIR} + BUILD ${CMAKE_BINARY_DIR} + GCOV_COMMAND gcov + GCOV_OPTIONS -bc) +endif()