fix CMakeLists.txt (unit test, benchmark) #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CodeCov | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
ubuntu-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"] | |
compiler-version: ["latest"] | |
container: silkeh/clang:${{ matrix.compiler-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}} . | |
cmake --build ./build --config ${{matrix.build-type}} | |
- name: Run Test Script | |
working-directory: build/${{matrix.build-type}} | |
run: | | |
./unittest | |
llvm-profdata merge -sparse default.profraw -o default.profdata | |
llvm-cov export ./unittest --instr-profile default.profdata -format=lcov >> coverage.info | |
cp coverage.info ../../ | |
- name: Prepare Codecov | |
run: | | |
apt-get install -y lcov | |
lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1 | |
lcov --remove coverage.info '**/tests/*' --output-file coverage.info --rc lcov_branch_coverage=1 | |
lcov --remove coverage.info '**/.cppm/*' --output-file coverage.info --rc lcov_branch_coverage=1 | |
lcov --list coverage.info --rc lcov_branch_coverage=1 | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
files: coverage.info | |
fail_ci_if_error: true | |
verbose: true |