Skip to content

Commit

Permalink
change code-cov llvm-cov -> lcov
Browse files Browse the repository at this point in the history
  • Loading branch information
injae committed Dec 31, 2023
1 parent 6e7dd80 commit 8e1509d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/code-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,44 @@ 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"
strategy:
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/[email protected]

- 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
19 changes: 7 additions & 12 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8e1509d

Please sign in to comment.