diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7af95c..9d93f34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,35 +2,46 @@ name: CI 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: test: strategy: matrix: os: [ubuntu-latest] + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} runs-on: ${{matrix.os}} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: uvm32 - 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 + uses: actions/configure-pages@v5 + - name: Upload Artifact + 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 + name: github-pages + - 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/README.md b/README.md index 476d1ea..bf2ebe0 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,14 @@ # 🌱 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. 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. -![](https://github.com/ringtailsoftware/uvm32/actions/workflows/build.yml/badge.svg) - ## 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) diff --git a/test/Makefile b/test/Makefile index da0bf05..3d2dae1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -14,13 +14,19 @@ 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} + mkdir -p badge + curl "https://img.shields.io/badge/Code%20Coverage-${PERC}25-success?style=flat" > badge/badge.svg + clean: ${CLEANCMD} true rm -f coverage.xml