Skip to content

Commit

Permalink
Merge pull request #741 from astrogeco/add-cppcheck-workflow
Browse files Browse the repository at this point in the history
Fix #740, Re-add automated static code analysis
  • Loading branch information
astrogeco authored Jan 6, 2021
2 parents b804ab9 + afaf617 commit 07f11b8
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Static Analysis

# Run this workflow every time a new commit pushed to your repository
on: [push, pull_request]

jobs:

static-analysis:
name: Run cppcheck
runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
cppcheck: [all, osal]

steps:

- name: Install cppcheck
run: sudo apt-get install cppcheck -y

# Checks out a copy of the cfs bundle
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

- name: Run bundle cppcheck
if: ${{matrix.cppcheck =='all'}}
run: cppcheck --force --inline-suppr --quiet . 2> ${{matrix.cppcheck}}_cppcheck_err.txt

# Run strict static analysis for embedded portions of osal
- name: osal strict cppcheck
if: ${{matrix.cppcheck =='osal'}}
run: |
cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ./src/bsp ./src/os 2> ./${{matrix.cppcheck}}_cppcheck_err.txt
- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{matrix.cppcheck}}-cppcheck-err
path: ./*cppcheck_err.txt

- name: Check for errors
run: |
if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]];
then
cat ${{matrix.cppcheck}}_cppcheck_err.txt
exit -1
fi

0 comments on commit 07f11b8

Please sign in to comment.