Add CI workflow to create a coverage badge via github pages

This commit is contained in:
Toby Jaffey 2025-12-14 03:08:59 +00:00
parent cfc1286874
commit 079cf2c9bd
4 changed files with 44 additions and 20 deletions

View file

@ -2,35 +2,46 @@ name: CI
on: [push, pull_request] on: [push, pull_request]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs: jobs:
test: test:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
path: uvm32 path: uvm32
- name: Build - name: Build
run: make dockerbuild_cached && make docker run: make dockerbuild_cached && make docker
working-directory: uvm32 working-directory: uvm32
- name: Code Coverage Report - name: CI test
uses: irongut/CodeCoverageSummary@v1.3.0 run: make dockerci
working-directory: uvm32
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with: with:
filename: uvm32/test/coverage.xml path: uvm32/test/badge
badge: true name: github-pages
fail_below_min: false - name: Deploy to GitHub Pages
format: markdown id: deployment
hide_branch_rate: false uses: actions/deploy-pages@v4
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

View file

@ -10,6 +10,9 @@ clean:
(cd hosts && make clean) (cd hosts && make clean)
(cd apps && make clean) (cd apps && make clean)
ci:
(cd test && make ci)
test: test:
make -C test make -C test
@ -28,4 +31,7 @@ dockershell:
docker: docker:
docker run -v `pwd`:/data -w /data --rm uvm32 make docker run -v `pwd`:/data -w /data --rm uvm32 make
dockerci:
docker run -v `pwd`:/data -w /data --rm uvm32 make ci

View file

@ -1,13 +1,14 @@
# 🌱 uvm32 # 🌱 uvm32
![](https://github.com/ringtailsoftware/uvm32/actions/workflows/build.yml/badge.svg)
![](https://ringtailsoftware.github.io/uvm32/badge.svg)
uvm32 is a minimalist, dependency-free virtual machine sandbox designed for microcontrollers and other resource-constrained devices. Single C file, no dynamic memory allocations, asynchronous design, pure C99. uvm32 is a minimalist, dependency-free virtual machine sandbox designed for microcontrollers and other resource-constrained devices. Single C file, no dynamic memory allocations, asynchronous design, pure C99.
On an [STM32L0](https://www.st.com/en/microcontrollers-microprocessors/stm32l0-series.html) (ARM Cortex-M0+) the required footprint is under 4KB flash/1KB RAM. On an [STM32L0](https://www.st.com/en/microcontrollers-microprocessors/stm32l0-series.html) (ARM Cortex-M0+) the required footprint is under 4KB flash/1KB RAM.
uvm32 is a RISC-V emulator, wrapped in a management interface and provided with tools to build efficient code to run in it. uvm32 is a RISC-V emulator, wrapped in a management interface and provided with tools to build efficient code to run in it.
![](https://github.com/ringtailsoftware/uvm32/actions/workflows/build.yml/badge.svg)
## What is it for? ## What is it for?
* As a no-frills alternative to embedded script engines ([Lua](https://www.lua.org/), [Duktape](https://duktape.org/), [MicroPython](https://micropython.org/), etc) * As a no-frills alternative to embedded script engines ([Lua](https://www.lua.org/), [Duktape](https://duktape.org/), [MicroPython](https://micropython.org/), etc)

View file

@ -14,13 +14,19 @@ CLEANCMD = $(foreach TEST,${TESTS},make -C ${TEST} clean &&)
ifeq (,$(shell which gcovr)) ifeq (,$(shell which gcovr))
GCOVRCMD=echo Install gcovr for code coverage reports GCOVRCMD=echo Install gcovr for code coverage reports
else 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 endif
all: all:
${RUNCMD} true ${RUNCMD} true
@${GCOVRCMD} @${GCOVRCMD}
ci:
@${GCOVRCMD}
mkdir -p badge
curl "https://img.shields.io/badge/Code%20Coverage-${PERC}25-success?style=flat" > badge/badge.svg
clean: clean:
${CLEANCMD} true ${CLEANCMD} true
rm -f coverage.xml rm -f coverage.xml