Skip to content

Commit

Permalink
feat: track engine test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
luishfonseca committed Feb 2, 2024
1 parent 1e8553d commit 58fbe9f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/create-coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
sudo apt-get install xorg-dev libglu1-mesa-dev gcc-11 g++-11 lcov
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_COVERAGE=ON -DBUILD_CORE_TESTS=ON -DUSE_CLANG_TIDY=OFF
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_COVERAGE=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_TESTS=ON -DUSE_CLANG_TIDY=OFF
shell: bash
env:
CC: gcc-11
Expand All @@ -30,5 +30,10 @@ jobs:
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target coverage

- name: Upload
run: bash <(curl -s https://codecov.io/bash) -f ${{github.workspace}}/build/coverage.info

uses: codecov/codecov-action@v4
with:
directory: ${{github.workspace}}/build/
fail_ci_if_error: true
files: ./coverage-core.info,./coverage-engine.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,26 @@ if(ENABLE_COVERAGE)
append_coverage_compiler_flags()

setup_target_for_coverage_lcov(
NAME coverage
NAME coverage-core
EXECUTABLE core/tests/cubos-core-tests
DEPENDENCIES cubos-core-tests

EXCLUDE "core/lib/*" "core/tests/*" "tools/quadrados" "*-components.cpp"
EXCLUDE "core/lib/*" "core/tests/*" "engine/*" "lib/*" "tools/*" "*-components.cpp"

LCOV_ARGS "--no-external"
)

setup_target_for_coverage_lcov(
NAME coverage-engine
EXECUTABLE engine/tests/cubos-engine-tests
DEPENDENCIES cubos-engine-tests

EXCLUDE "engine/lib/*" "engine/tests/*" "core/*" "lib/*" "tools/*" "*-components.cpp"

LCOV_ARGS "--no-external"
)

add_custom_target(coverage DEPENDS coverage-core coverage-engine)
endif()

# Enable CCache
Expand Down

0 comments on commit 58fbe9f

Please sign in to comment.