From e6f54c9f480ad86a5c2bc2c6c3bba05931d1e42b Mon Sep 17 00:00:00 2001 From: italo sampaio Date: Wed, 13 Dec 2023 14:10:10 -0300 Subject: [PATCH] Added static analysis to CI Added a new action that runs static analysis on the firmware code and adds a badge to README.md. --- .github/workflows/static-analysis.yml | 31 +++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/static-analysis.yml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..84a17c43 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,31 @@ +name: "Static analysis" + +on: [push] + +jobs: + static-analysis: + name: Run ledger static analysis + runs-on: ubuntu-20.04 + + steps: + - name: Checkout this repo + uses: actions/checkout@v3 + + - name: Build the middleware docker image + run: docker/mware/build + + - name: Run static analysis + run: | + ledger/static-analysis/gen-static-analysis + + - name: Generate Markdown report + if: always() + run: | + python ledger/static-analysis/gen-report.py \ + -d ledger/static-analysis/output \ + -o ledger/static-analysis/output/report.md + + - name: Write to job summary + if: always() + run: | + cat ledger/static-analysis/output/report.md > $GITHUB_STEP_SUMMARY diff --git a/README.md b/README.md index 11933a13..d3207d4e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![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/powhsm_4.1.x/middleware_coverage_report/badge.json)](https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/middleware_coverage_report/index.html) [![Firmware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/firmware_coverage_report/badge.json)](https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/firmware_coverage_report/index.html) - +![Static analysis](https://github.com/rsksmart/rsk-powhsm/actions/workflows/static-analysis.yml/badge.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE) ## About