Skip to content

Commit

Permalink
[CMake][CI/CD] use custom coverage build type
Browse files Browse the repository at this point in the history
  • Loading branch information
isuckatcs committed Jun 30, 2024
1 parent 18a9a92 commit 35d9da1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

env:
BUILD_TYPE: Debug
BUILD_TYPE: Coverage

jobs:
build:
Expand All @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-g -O0 --coverage -fprofile-arcs -ftest-coverage" -DCMAKE_C_FLAGS="-g -O0 --coverage -fprofile-arcs -ftest-coverage"
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ include_directories(include "${LLVM_INCLUDE_DIR}")

add_subdirectory(src)
add_subdirectory(test)

set(GCC_COVERAGE_FLAGS "-fno-exceptions -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}")
set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}")

0 comments on commit 35d9da1

Please sign in to comment.