Skip to content

Commit

Permalink
Add workflow badges in README.md
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
SuhashiniNaik committed Jan 20, 2025
1 parent a43a155 commit 63194b0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,33 @@ jobs:
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
zip -r code_coverage.zip code_coverage &&
#Badges
LinePercentage=\$(lcov --summary cmake-build-unit-tests/coverage.info | grep 'lines' | awk '{print \$2}') &&
echo \"Line Percentage: \$LinePercentage\" # Debug print &&
wget \"https://img.shields.io/badge/coverage-\${LinePercentage}25-brightgreen.svg\" -O line_coverage_badge.svg &&
FunctionPercentage=\$(lcov --summary cmake-build-unit-tests/coverage.info | grep 'functions' | awk '{print \$2}') &&
echo \"Function Percentage: \$FunctionPercentage\" # Debug print &&
wget \"https://img.shields.io/badge/coverage-\${FunctionPercentage}25-brightgreen.svg\" -O function_coverage_badge.svg &&
mkdir coverage_badges &&
mv line_coverage_badge.svg coverage_badges/ &&
mv function_coverage_badge.svg coverage_badges/ &&
zip -r coverage_badges.zip coverage_badges
"
- name: Upload code coverage artifact
uses: actions/upload-artifact@v4
with:
name: code_coverage
path: code_coverage.zip
path: code_coverage.zip

- name: Upload Coverage Badge
uses: actions/upload-artifact@v4
with:
name: coverage_badges
path: coverage_badges.zip
12 changes: 12 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ jobs:
run: |
unzip code_coverage.zip
rm code_coverage.zip
- name: Download Coverage badge artifact
uses: actions/download-artifact@v4
with:
name: coverage_badges
path: ./doc/github_pages

- name: Unzip Coverage badge artifact
working-directory: ./doc/github_pages
run: |
unzip coverage_badges.zip
rm coverage_badges.zip
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Eclipse OpenBSW


## Build Status 🚀

| Platform | Status |
|----------------|------------------------------------------------------------------------|
| POSIX Build | ![POSIX](https://github.com/eclipse-openbsw/openbsw/actions/workflows/build.yml/badge.svg?branch=main&event=push&matrix.platform=posix) |
| S32K148 | ![S32K](https://github.com/eclipse-openbsw/openbsw/actions/workflows/build.yml/badge.svg?branch=main&event=push&matrix.platform=s32k148) |

## Code Coverage

| Code Coverage | Status |
|--------------------------|------------------------------------------------------------------------|
| Line Coverage | ![Line Coverage](https://raw.githubusercontent.com/esrlabs/openbsw/gh-pages/coverage_badges/line_coverage_badge.svg) |
| Function Coverage | ![Function Coverage](https://raw.githubusercontent.com/esrlabs/openbsw/gh-pages/coverage_badges/function_coverage_badge.svg) |



## Overview

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

0 comments on commit 63194b0

Please sign in to comment.