From d439f18161c558ad0e140d66bcf1163a2dbda1d3 Mon Sep 17 00:00:00 2001 From: Ariel Mendelzon Date: Tue, 12 Dec 2023 16:39:09 +1300 Subject: [PATCH] Generating firmware coverage badge data, added badges to README --- .github/workflows/coverage.yml | 6 +++++- README.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 67f10a6e..747bb8ef 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -38,7 +38,11 @@ jobs: --no-progress --follow-symlinks --delete --only-show-errors - name: Run firmware coverage script - run: ledger/coverage/gen-coverage + run: | + ledger/coverage/gen-coverage + COVPCT=$(cat ledger/coverage/output/total) + COVCOL=$(utils/coverage-color.sh $COVPCT) + echo "{ \"schemaVersion\": 1, \"label\": \"Firmware coverage\", \"message\": \"$COVPCT%\", \"color\": \"$COVCOL\" }" > ledger/coverage/output/badge.json - name: "Upload firmware coverage report" run: | diff --git a/README.md b/README.md index 30d585b3..f77da9ac 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ ![Tests](https://github.com/rsksmart/rsk-powhsm/actions/workflows/run-tests.yml/badge.svg) ![Python linter](https://github.com/rsksmart/rsk-powhsm/actions/workflows/lint-python.yml/badge.svg) ![C linter](https://github.com/rsksmart/rsk-powhsm/actions/workflows/lint-c.yml/badge.svg) +![Middleware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/middleware_coverage_report/badge.json) +![Firmware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/firmware_coverage_report/badge.json) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)