speeduino/.github/workflows/misra.yml

52 lines
1.6 KiB
YAML
Raw Normal View History

name: Perform MISRA scan
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
- GH_misra
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install cppcheck
run: |
sudo apt-get install cppcheck
- name: Run MISRA scan
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE/misra/
mkdir .results
chmod +x check_misra.sh
./check_misra.sh -c /usr/bin -o ./.results -q
echo "Scan complete"
NumViolations=`cat .results/error_count.txt`
echo $NumViolations
echo "VIOLATIONS=$NumViolations" >> $GITHUB_ENV
- name: Save output to Gist
if: github.event_name != 'pull_request' && github.repository_owner == 'noisymime'
env:
MISRA_GIST: ${{ secrets.MISRA_GIST }}
VIOLATIONS: ${{ env.VIOLATIONS }}
uses: schneegans/dynamic-badges-action@v1.4.0
with:
auth: ${{ secrets.MISRA_GIST }}
gistID: d8a449a3f6d3307dab457431512502f9
filename: misra_results.json
label: MISRA Violations
color: red
message: ${{ env.VIOLATIONS }}