Skip to content

Commit

Permalink
Codecov added
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanPinezhaninov committed Dec 3, 2023
1 parent 9cc1630 commit 3dc170e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DASYNC_PROMISE_BUILD_TESTS=ON
-DASYNC_PROMISE_CODECOV_TESTS=ON
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
Expand All @@ -76,3 +77,8 @@ jobs:
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ project(async_promise LANGUAGES CXX VERSION 1.0.0)

option(ASYNC_PROMISE_BUILD_EXAMPLE "Build example" OFF)
option(ASYNC_PROMISE_BUILD_TESTS "Build tests" OFF)
option(ASYNC_PROMISE_CODECOV "Add test coverage" OFF)

if(ASYNC_PROMISE_BUILD_EXAMPLE)
add_subdirectory(example)
endif()

if (ASYNC_PROMISE_BUILD_TESTS)
if(ASYNC_PROMISE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

if(ASYNC_PROMISE_CODECOV)
add_compile_options(-fprofile-arcs -ftest-coverage)
add_link_options(-lgcov --coverage)
endif()

find_package(Threads REQUIRED)

set(HEADERS
Expand Down

0 comments on commit 3dc170e

Please sign in to comment.