From 8e1509d03ff43f97acb65906e45ca43ef352933e Mon Sep 17 00:00:00 2001 From: injae <8687lee@gmail.com> Date: Mon, 1 Jan 2024 04:25:51 +0900 Subject: [PATCH] change code-cov llvm-cov -> lcov --- .github/workflows/code-cov.yml | 32 ++++++++++++++++++-------------- .github/workflows/linux.yml | 19 +++++++------------ CMakeLists.txt | 1 + 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/code-cov.yml b/.github/workflows/code-cov.yml index d55961b..06c6186 100644 --- a/.github/workflows/code-cov.yml +++ b/.github/workflows/code-cov.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - ubuntu-llvm-code-cov: + ubuntu-gcc-code-cov: runs-on: ubuntu-latest env: CMAKE_FLAGS: "-DSERDEPP_USE_NLOHMANN_JSON=ON -DSERDEPP_USE_TOML11=ON -DSERDEPP_USE_YAML-CPP=ON -DSERDEPP_USE_RAPIDJSON=ON -DSERDEPP_USE_FMT=ON -DSERDEPP_BUILD_TESTING=ON -DSERDEPP_USE_CATCH2=ON" @@ -15,32 +15,36 @@ jobs: matrix: build-type: ["Debug"] clang-version: ["latest"] - container: silkeh/clang:${{ matrix.clang-version }} + container: gcc:${{ matrix.gcc-version }} steps: - name: Get latest CMake uses: lukka/get-cmake@v3.27.7 + - name: Install git on container run: apt update && apt install -y git - name: Clone Repository uses: actions/checkout@v3 with: submodules: true + - name: CMake build run: | cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} - - name: Generate Coverage Report + cmake --build ./build --config ${{matrix.build-type}} + + - name: Run Test Script + working-directory: build + run: ctest -C ${{matrix.build-type}} --output-on-failure + + - name: Prepare Codecov run: | - cd build/${{matrix.build-type}} - ./unittest - llvm-profdata-${{matrix.clang-version}} merge -sparse default.profraw -o default.profdata - llvm-cov-${{matrix.clang-version}} export ./unittest --instr-profile default.profdata -format=lcov >> lcov.info - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + sudo apt-get install -y lcov + lcov --directory . --capture --output-file coverage.info --rc lcov_branch_coverage=1 # capture coverage info + lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 # filter out system + lcov --list coverage.info --rc lcov_branch_coverage=1 # debug info + - name: Codecov + uses: codecov/codecov-action@v3.1.1 with: - directory: ./build/${{matrix.build-type}} - files: lcov.info - flags: unittest + files: coverage.info fail_ci_if_error: true verbose: true diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 539a8ce..4747d6a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -27,12 +27,10 @@ jobs: - name: CMake build run: | cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} + cmake --build ./build --config ${{matrix.build-type}} - name: Run Test Script - run: | - cd build - ctest . + working-directory: build + run: ctest -C ${{matrix.build-type}} --output-on-failure ubuntu-llvm: runs-on: ubuntu-latest @@ -41,8 +39,7 @@ jobs: strategy: matrix: build-type: ["Release", "Debug"] - clang-version: - ["8", "9", "10", "11", "12", "13", "14", "15-bullseye", "latest"] + clang-version: ["8", "9", "10", "11", "12", "13", "latest"] #"14", "15-bullseye", "latest"] container: silkeh/clang:${{ matrix.clang-version }} steps: - name: Get latest CMake @@ -56,9 +53,7 @@ jobs: - name: CMake build run: | cmake -Bbuild -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{env.CMAKE_FLAGS}} . - cd build - cmake --build . --config ${{matrix.build-type}} + cmake --build ./build --config ${{matrix.build-type}} - name: Run Test Script - run: | - cd build - ctest . + working-directory: build + run: ctest -C ${{matrix.build-type}} --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index 8519cd3..3d652d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ cppm_cxx_standard(17) cppm_compiler_option( DEBUG CLANG "-fprofile-instr-generate -fcoverage-mapping" + GCC "-fprofile-arcs -ftest-coverage" ) find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF)