Skip to content

Commit fda81b1

Browse files
SuhashiniNaikmarcmo
authored andcommitted
Add workflow badges in README.md
- Removed coverage.js that was written for converting coverage.info to json - Updated README.md with links to workflow badges - Updated code-coverage.yml with badge extraction
1 parent 84f172e commit fda81b1

3 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/code-coverage.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,33 @@ jobs:
6060
genhtml cmake-build-unit-tests/coverage.info \
6161
--output-directory cmake-build-unit-tests/coverage &&
6262
63-
# Zip the coverage report
6463
mv cmake-build-unit-tests/coverage code_coverage &&
65-
zip -r code_coverage.zip code_coverage
64+
zip -r code_coverage.zip code_coverage &&
65+
66+
#Badges
67+
LinePercentage=\$(lcov --summary cmake-build-unit-tests/coverage.info | grep 'lines' | awk '{print \$2}') &&
68+
echo \"Line Percentage: \$LinePercentage\" # Debug print &&
69+
wget \"https://img.shields.io/badge/coverage-\${LinePercentage}25-brightgreen.svg\" -O line_coverage_badge.svg &&
70+
71+
FunctionPercentage=\$(lcov --summary cmake-build-unit-tests/coverage.info | grep 'functions' | awk '{print \$2}') &&
72+
echo \"Function Percentage: \$FunctionPercentage\" # Debug print &&
73+
wget \"https://img.shields.io/badge/coverage-\${FunctionPercentage}25-brightgreen.svg\" -O function_coverage_badge.svg &&
74+
75+
mkdir coverage_badges &&
76+
77+
mv line_coverage_badge.svg coverage_badges/ &&
78+
mv function_coverage_badge.svg coverage_badges/ &&
79+
zip -r coverage_badges.zip coverage_badges
6680
"
6781
6882
- name: Upload code coverage artifact
6983
uses: actions/upload-artifact@v4
7084
with:
7185
name: code_coverage
72-
path: code_coverage.zip
86+
path: code_coverage.zip
87+
88+
- name: Upload Coverage Badge
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: coverage_badges
92+
path: coverage_badges.zip

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ jobs:
6060
run: |
6161
unzip code_coverage.zip
6262
rm code_coverage.zip
63+
64+
- name: Download Coverage badge artifact
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: coverage_badges
68+
path: ./doc/github_pages
69+
70+
- name: Unzip Coverage badge artifact
71+
working-directory: ./doc/github_pages
72+
run: |
73+
unzip coverage_badges.zip
74+
rm coverage_badges.zip
6375
6476
- name: Deploy to GitHub Pages
6577
uses: peaceiris/actions-gh-pages@v4

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Eclipse OpenBSW
22

3+
4+
## Build Status 🚀
5+
6+
| Platform | Status |
7+
|----------------|------------------------------------------------------------------------|
8+
| POSIX Build | ![POSIX](https://github.com/eclipse-openbsw/openbsw/actions/workflows/build.yml/badge.svg?branch=main&event=push&matrix.platform=posix) |
9+
| S32K148 | ![S32K](https://github.com/eclipse-openbsw/openbsw/actions/workflows/build.yml/badge.svg?branch=main&event=push&matrix.platform=s32k148) |
10+
11+
## Code Coverage
12+
13+
| Code Coverage | Status |
14+
|--------------------------|------------------------------------------------------------------------|
15+
| Line Coverage | ![Line Coverage](https://raw.githubusercontent.com/esrlabs/openbsw/gh-pages/coverage_badges/line_coverage_badge.svg) |
16+
| Function Coverage | ![Function Coverage](https://raw.githubusercontent.com/esrlabs/openbsw/gh-pages/coverage_badges/function_coverage_badge.svg) |
17+
18+
19+
320
## Overview
421

522
Eclipse OpenBSW is an open source SDK to build professional, high quality embedded software products.

0 commit comments

Comments
 (0)