speeduino/.github/workflows/misra.yml

63 lines
1.9 KiB
YAML

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@v4
- name: Install cppcheck, dos2unix
run: |
sudo apt-get install cppcheck
sudo apt-get install dos2unix
- name: Run MISRA scan
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE/misra/
mkdir .results
chmod +x check_misra.sh
dos2unix 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
ls $GITHUB_WORKSPACE/misra/.results/
- 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.6.0
with:
auth: ${{ secrets.MISRA_GIST }}
gistID: d8a449a3f6d3307dab457431512502f9
filename: misra_results.json
label: MISRA Violations
color: red
message: ${{ env.VIOLATIONS }}
- name: Archive MISRA scan artifacts
uses: actions/upload-artifact@v3
with:
name: MISRA results
path: |
misra/.results/results.txt
misra/.results/error_count.txt