Skip to content

Commit

Permalink
Merge pull request #454 from skliper/fix453-static_analysis
Browse files Browse the repository at this point in the history
Fix #453, Cleanup shared static analysis workflow
  • Loading branch information
astrogeco authored Apr 18, 2022
2 parents b4f655a + 8cbb1e1 commit f481f23
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:

strategy:
fail-fast: false
matrix:
cppcheck: [non-strict, strict]

steps:
- name: Install cppcheck
Expand All @@ -45,26 +43,33 @@ jobs:
with:
submodules: true

- name: Run bundle cppcheck
run: cppcheck --force --inline-suppr . 2> ${{matrix.cppcheck}}_cppcheck_err.txt
- name: Run general cppcheck
run: cppcheck --force --inline-suppr . 2> general_cppcheck_err.txt

- name: Check for general errors
run: |
if [[ -s general_cppcheck_err.txt ]];
then
cat general_cppcheck_err.txt
exit -1
fi
# Run strict static analysis for embedded portions of cfe, osal, and psp
- name: Strict cppcheck
if: ${{ inputs.strict-dir-list !='' }}
run: cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive .${{ inputs.strict-dir-list }} 2> ../${{matrix.cppcheck}}_cppcheck_err.txt
run: cppcheck --force --inline-suppr --std=c99 --language=c --enable=warning,performance,portability,style --suppress=variableScope --inconclusive ${{ inputs.strict-dir-list }} 2> strict_cppcheck_err.txt

- name: Check for strict errors
if: ${{ inputs.strict-dir-list !='' }}
run: |
if [[ -s strict_cppcheck_err.txt ]];
then
cat strict_cppcheck_err.txt
exit -1
fi
- name: Archive Static Analysis Artifacts
if: ${{ inputs.strict-dir-list !='' || matrix.cppcheck == 'non-strict' }}
uses: actions/upload-artifact@v2
with:
name: ${{matrix.cppcheck}}-cppcheck-err
name: cppcheck-errors
path: ./*cppcheck_err.txt

- name: Check for errors
if: ${{ inputs.strict-dir-list !='' || matrix.cppcheck == 'non-strict' }}
run: |
if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]];
then
cat ${{matrix.cppcheck}}_cppcheck_err.txt
exit -1
fi

0 comments on commit f481f23

Please sign in to comment.