Skip to content

Commit

Permalink
Cppcheck for GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhashiniNaik committed Dec 4, 2024
1 parent ec25295 commit cad2754
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Cppcheck Analysis

on: [push, pull_request]

jobs:
cppcheck:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.22.x'

- name: Install Cppcheck
run: sudo apt-get update && sudo apt-get install -y cppcheck

- name: Generate compiler database
run: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON executables/referenceApp

- name: Run Cppcheck excluding 3rdparty
run: |
mkdir -p cppcheck-reports
EXCLUDE_DIRS=$(find . -type d -name "3rdparty" -printf "-i%p ")
cppcheck --enable=all --project=compile_commands.json --xml $EXCLUDE_DIRS 2> cppcheck-reports/cppcheck-full.xml
- name: Check configuration issues
run: |
EXCLUDE_DIRS=$(find . -type d -name "3rdparty" -printf "-i%p ")
cppcheck --enable=all --project=compile_commands.json --check-config --suppress=missingIncludeSystem --suppress=missingInclude --xml $EXCLUDE_DIRS 2> cppcheck-reports/cppcheck-config.xml
- name: Upload Cppcheck logs
uses: actions/upload-artifact@v4
with:
name: cppcheck-reports
path: cppcheck-reports

0 comments on commit cad2754

Please sign in to comment.