From b2b7827e60bb935b7bfa5dd8a1d106fe6e521a31 Mon Sep 17 00:00:00 2001 From: Toby Jaffey Date: Sun, 14 Dec 2025 02:06:10 +0000 Subject: [PATCH] Add dockerci target which builds badge and uploads to github pages --- .github/workflows/build.yml | 30 +++++++++++++----------------- Makefile | 6 ++++++ test/Makefile | 7 ++++++- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7af95c..2ddace8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,21 +16,17 @@ jobs: - name: Build run: make dockerbuild_cached && make docker working-directory: uvm32 - - name: Code Coverage Report - uses: irongut/CodeCoverageSummary@v1.3.0 + - name: CI test + run: make dockerci + working-directory: uvm32 + - name: Setup Pages + if: github.ref == 'refs/heads/main' + uses: actions/configure-pages@v4 + - name: Upload Artifact + if: github.ref == 'refs/heads/main' + uses: actions/upload-pages-artifact@v3 with: - filename: uvm32/test/coverage.xml - badge: true - fail_below_min: false - format: markdown - hide_branch_rate: false - hide_complexity: true - indicators: true - output: both - thresholds: '60 80' - - name: Archive code coverage results - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report - path: code-coverage-results.md - + path: uvm32/test/badge.svg + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/Makefile b/Makefile index 7174030..7c37136 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ clean: (cd hosts && make clean) (cd apps && make clean) +ci: + (cd test && make ci) + test: make -C test @@ -28,4 +31,7 @@ dockershell: docker: docker run -v `pwd`:/data -w /data --rm uvm32 make +dockerci: + docker run -v `pwd`:/data -w /data --rm uvm32 make ci + diff --git a/test/Makefile b/test/Makefile index da0bf05..c5d11a8 100644 --- a/test/Makefile +++ b/test/Makefile @@ -14,13 +14,18 @@ CLEANCMD = $(foreach TEST,${TESTS},make -C ${TEST} clean &&) ifeq (,$(shell which gcovr)) GCOVRCMD=echo Install gcovr for code coverage reports else - GCOVRCMD=gcovr -r ../ --filter ".*uvm32.c" && gcovr -r ../ --filter ".*uvm32.c" --cobertura-pretty --cobertura coverage.xml + GCOVRCMD=gcovr -r ../ --filter ".*uvm32.c" + PERC=$(shell gcovr -r ../ --filter ".*uvm32.c" | grep uvm | awk '{print $$4}') endif all: ${RUNCMD} true @${GCOVRCMD} +ci: + @${GCOVRCMD} + curl "https://img.shields.io/badge/Code%20Coverage-${PERC}25-success?style=flat" > badge.svg + clean: ${CLEANCMD} true rm -f coverage.xml