2022-09-06 23:04:51 -07:00
|
|
|
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
|
2022-11-03 18:03:15 -07:00
|
|
|
- uses: actions/checkout@v3
|
2022-09-06 23:04:51 -07:00
|
|
|
|
2023-01-04 07:28:21 -08:00
|
|
|
- name: Install cppcheck, dos2unix
|
2022-09-06 23:04:51 -07:00
|
|
|
run: |
|
|
|
|
sudo apt-get install cppcheck
|
2023-01-04 07:28:21 -08:00
|
|
|
sudo apt-get install dos2unix
|
2022-09-06 23:04:51 -07:00
|
|
|
|
|
|
|
- name: Run MISRA scan
|
|
|
|
continue-on-error: true
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE/misra/
|
|
|
|
mkdir .results
|
|
|
|
chmod +x check_misra.sh
|
2022-12-31 17:25:59 -08:00
|
|
|
dos2unix check_misra.sh
|
2022-09-06 23:04:51 -07:00
|
|
|
./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
|
2022-09-07 20:24:59 -07:00
|
|
|
ls $GITHUB_WORKSPACE/misra/.results/
|
2022-09-06 23:04:51 -07:00
|
|
|
|
|
|
|
- name: Save output to Gist
|
|
|
|
if: github.event_name != 'pull_request' && github.repository_owner == 'noisymime'
|
|
|
|
env:
|
|
|
|
MISRA_GIST: ${{ secrets.MISRA_GIST }}
|
|
|
|
VIOLATIONS: ${{ env.VIOLATIONS }}
|
2022-10-19 19:56:39 -07:00
|
|
|
uses: schneegans/dynamic-badges-action@v1.6.0
|
2022-09-06 23:04:51 -07:00
|
|
|
with:
|
|
|
|
auth: ${{ secrets.MISRA_GIST }}
|
|
|
|
gistID: d8a449a3f6d3307dab457431512502f9
|
|
|
|
filename: misra_results.json
|
|
|
|
label: MISRA Violations
|
|
|
|
color: red
|
|
|
|
message: ${{ env.VIOLATIONS }}
|
2022-09-07 20:15:32 -07:00
|
|
|
|
|
|
|
- name: Archive MISRA scan artifacts
|
2022-09-07 20:17:00 -07:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: MISRA results
|
|
|
|
path: |
|
2022-09-07 20:29:02 -07:00
|
|
|
misra/.results/results.txt
|
|
|
|
misra/.results/error_count.txt
|