Skip to content

Commit

Permalink
Merge branch 'main' into cr-124447
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhashiniNaik authored Jan 16, 2025
2 parents d357d41 + a43a155 commit ead5d55
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 60 deletions.
91 changes: 48 additions & 43 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Code Coverage Report
name: Code Coverage

on: [workflow_call, push, pull_request]
on:
workflow_call:
push:
branches:
- main
pull_request:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand All @@ -15,50 +20,50 @@ jobs:
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 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake --build cmake-build-unit-tests -j4
ctest --test-dir cmake-build-unit-tests -j4
- name: Install lcov
run: sudo apt install lcov

# no-external command excludes the system libraries in the root directory
- name: Capture code coverage
- name: Pull and Run Docker with GCC 11.4.0 and LCOV
run: |
echo "Capturing code coverage..."
lcov --no-external --capture --directory . \
--output-file cmake-build-unit-tests/coverage_unfiltered.info
docker pull ubuntu:22.04
docker run --rm -v $(pwd):/workspace -w /workspace ubuntu:22.04 bash -c "
apt-get update &&
apt-get install -y gcc-11 g++-11 lcov wget cmake zip &&
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 &&
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 &&
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-11 100 &&
gcc --version &&
gcov --version &&
lcov --version &&
- 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/*' \
'*/gtest/*' \
'*/test/*' \
--output-file cmake-build-unit-tests/coverage.info
# Clean old coverage files
rm -rf cmake-build-unit-tests/*.gcda cmake-build-unit-tests/*.gcno &&
- 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: Zip the coverage report
run: |
mv cmake-build-unit-tests/coverage code_coverage
zip -r code_coverage.zip code_coverage
# Configure and build the tests
rm -rf cmake-build-unit-tests &&
cmake -B cmake-build-unit-tests -S executables/unitTest -DBUILD_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} &&
cmake --build cmake-build-unit-tests -j4 &&
ctest --test-dir cmake-build-unit-tests -j4 &&
# Capture code coverage
lcov --no-external --capture --directory . \
--output-file cmake-build-unit-tests/coverage_unfiltered.info &&
# Filter out 3rd party and mock files
lcov --remove cmake-build-unit-tests/coverage_unfiltered.info \
'*libs/3rdparty/googletest/*' \
'*/mock/*' \
'*/gmock/*' \
'*/gtest/*' \
'*/test/*' \
--output-file cmake-build-unit-tests/coverage.info &&
# Generate HTML coverage report
genhtml cmake-build-unit-tests/coverage.info \
--output-directory cmake-build-unit-tests/coverage &&
# Zip the coverage report
mv cmake-build-unit-tests/coverage code_coverage &&
zip -r code_coverage.zip code_coverage
"
- name: Upload code coverage artifact
uses: actions/upload-artifact@v4
Expand Down
106 changes: 89 additions & 17 deletions doc/github_pages/index.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Eclipse OpenBSW Documentation</title>
<link
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
rel="stylesheet"
/>
<style>
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
text-align: center;
background-color: #343a40;
color: #ffffff;
margin: 0;
}
.cover-container {
max-width: 42em;
}
h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 2rem;
}
h2 {
margin-top: 2rem;
margin-bottom: 2rem;
}
p {
font-size: 1.25rem;
margin-bottom: 2rem;
}
.inline-text {
white-space: nowrap;
margin-left: -100px;
}
.inline-text2 {
white-space: nowrap;
margin-left: -80px;
}
.btn-custom {
font-size: 1.2rem;
margin: 0.5rem;
}
a {
color: #ffffff;
text-decoration: underline;
}
footer {
margin-top: 2rem;
font-size: 0.875rem;
color: #6c757d;
}
</style>
</head>
<body>
<h1>Eclipse OpenBSW Documentation</h1>
<h2><a href="sphinx_docs/doc/index.html">Welcome to Eclipse OpenBSW</a></h2>
<h3><a href="doxygen_docs/index.html">Doxygen-generated API docs</a></h3>
<h3>Coverage reports</h3>
<ul>
<li><a href="code_coverage/index.html">Code coverage report</a></li>
</ul>

<h1>Other Publications</h1>
<p>
<a href="https://www.youtube.com/watch?v=9zlya-cdrgo">Eclipse OpenBSW - A fresh view on Automotive Microcontroller Software - OCX 2024</a>
- Conference Talk
</p>
<p>
<a href="https://medium.com/@ESRLabs/openbsw-a-code-first-software-platform-for-automotive-microcontrollers-609d3406cf0d">OpenBSW: A Code-first Software Platform for Automotive Microcontrollers</a>
- Blog Post on Medium
</p>

<div class="cover-container">
<header>
<h1>Eclipse OpenBSW Documentation</h1>
</header>
<main>
<a href="sphinx_docs/doc/index.html" class="btn btn-primary btn-block btn-custom">
Welcome to Eclipse OpenBSW
</a>
<a href="doxygen_docs/index.html" class="btn btn-info btn-block btn-custom">
Doxygen-generated API docs
</a>
<a href="code_coverage/index.html" class="btn btn-success btn-block btn-custom">
Code coverage report
</a>
<h2>Other Publications</h2>
<p class="inline-text">
<a href="https://www.youtube.com/watch?v=9zlya-cdrgo">
Eclipse OpenBSW - A fresh view on Automotive Microcontroller Software - OCX 2024
</a>
<span>- Conference Talk </span>
</p>
<p class="inline-text2" >
<a href="https://medium.com/@ESRLabs/openbsw-a-code-first-software-platform-for-automotive-microcontrollers-609d3406cf0d">
OpenBSW: A Code-first Software Platform for Automotive Microcontrollers
</a>
- Blog Post on Medium
</p>
</main>
<footer>
OpenBSW | ESR Labs - Part of Accenture Industry X
</footer>
</div>
</body>
</html>

0 comments on commit ead5d55

Please sign in to comment.