Skip to content

Commit

Permalink
Add code-coverage github action
Browse files Browse the repository at this point in the history
Add GitHub action for code-coverage

Changes made in build.yml
Added on workflow in build.yml

Add GitHub action for code-coverage

Code-coverage github action

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for Code-coverage

Add Github action for code-coverage

Add Github action for code-coverage

Add Github action for code-coverage

Add Github action for code-coverage

Add Github action for code-coverage

Add Github action for code-coverage
  • Loading branch information
SuhashiniNaik committed Nov 8, 2024
1 parent 998bb2b commit 3919dcc
Show file tree
Hide file tree
Showing 4 changed files with 817 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Code Coverage Report

on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.22.x'
- name: Test
# Execute tests defined by the CMake configuration.
run: |
cmake -B cmake-build-unit-tests -S executables/unitTest -DBUILD_UNIT_TESTS=ON
cmake --build cmake-build-unit-tests -j4
ctest --test-dir cmake-build-unit-tests -j4
#Code coverage
- name: Install lcov
run: sudo apt install lcov

- name: Capture code coverage
run: |
echo "Capturing code coverage..."
lcov --capture --directory . \
--output-file cmake-build-unit-tests/coverage_unfiltered.info
- name: Filter out 3rd party and mock files
run: |
echo "Filtering out 3rd party and mock files from coverage data..."
lcov --remove cmake-build-unit-tests/coverage_unfiltered.info \
'*libs/3rdparty/googletest/*' \
'*/mock/*' \
'*/gmock/*' \
'*/usr/include/*' \
'*/gtest/*' \
--output-file cmake-build-unit-tests/coverage.info
- name: Generate HTML coverage report
run: |
echo "Generating HTML coverage report..."
genhtml cmake-build-unit-tests/coverage.info \
--output-directory cmake-build-unit-tests/coverage
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: cmake-build-unit-tests
force_orphan: true
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project(
DESCRIPTION
"BSW workspace with reference application for multiple platforms"
LANGUAGES CXX C ASM)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/admin/cmake")

option(BUILD_UNIT_TESTS "Build unit tests" OFF)

Expand All @@ -29,6 +30,8 @@ set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_RELEASE})
if (BUILD_UNIT_TESTS)
add_compile_definitions(UNIT_TEST=1)
include(GoogleTest)
include(CodeCoverage)
append_coverage_compiler_flags()
include(CTest)
enable_testing()
endif ()
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ allowing developers to get up and running quickly.
The [documentation](https://eclipse-openbsw.github.io/openbsw)
describes Eclipse OpenBSW in detail and provides simple setup guides to build and use it.

## Code coverage

Code coverage report [here](https://esrlabs.github.io/openbsw/coverage/index.html)

## Contributing

It is expected that this respository will be used as a starting point for many custom developments.
Expand Down
Loading

0 comments on commit 3919dcc

Please sign in to comment.