Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cppcheck for GitHub action #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Cppcheck for GitHub action
SuhashiniNaik committed Dec 4, 2024
commit cad275440a069a45478362fd58ee77ba8c00a6f0
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