Skip to content

Commit

Permalink
use anybadge
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Heinrich <andreas.heinrich@rwth-aachen.de>
  • Loading branch information
andistorm committed Sep 18, 2024
1 parent 8421b88 commit b52f57c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,24 @@ jobs:
if-no-files-found: error
name: coverage-xml
path: coverage-xml
- name: Parse coverage report
id: parse_coverage_report
shell: python3 {0}
run: |
import xml.etree.ElementTree
import os
tree = xml.etree.ElementTree.parse("${{ github.workspace }}/coverage-xml/gcovr-coverage-xml.xml")
line_coverage = tree.getroot().get("line-rate")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"line_coverage={line_coverage}\n")
f.write(f"line_coverage_percentage={line_coverage * 100}\n")
- name: Generate coverage badge
run: |
# LTODO install in docker image
pip install genbadge[all]
pip install anybadge
mkdir -p ${{ github.workspace }}/coverage-badge/
genbadge coverage -i ${{ github.workspace }}/coverage-xml/gcovr-coverage-xml.xml -o ${{ github.workspace }}/coverage-badge/coverage-badge.svg -n "Total Code Coverage" --local -v
anybadge -o --label Coverage --value ${{ steps.parse_coverage_report.outputs.line_coverage_percentage }} -s "%" --file ${{ github.workspace }}/coverage-badge/coverage-badge.svg 20=red 40=orange 60=yellow 80=yellowgreen 100=green
- name: Deploy coverage badge
# LTODO update version
uses: everest/everest-ci/github-actions/deploy-ci-artifact@feature/add-reusable-ci-workflow
Expand Down

0 comments on commit b52f57c

Please sign in to comment.