Skip to content

Commit

Permalink
Add cppcheck github workflow
Browse files Browse the repository at this point in the history
This workflow will require a project token added to GITHUB_TOKEN name
in the project settings:

https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces#adding-secrets-for-a-repository

This will allow the cppcheck report to be attached to the run of the
action.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
  • Loading branch information
bhundven committed Mar 11, 2024
1 parent b1ad819 commit a114e1e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: cppcheck-action-test
on:
pull_request:

jobs:
build:
name: cppcheck-test
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v4

- name: install-deps
run: sudo apt install libyaml-cpp-dev libatasmart-dev cmake libsensors4-dev cppcheck
- name: build
run: |
mkdir build
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE:STRING=Debug -DUSE_ATASMART:BOOL=ON
cmake --build build
- name: cppcheck
uses: deep5050/cppcheck-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable: all
other_options: --addon=threadsafety.py --project=build/compile_commands.json -ibuild

- name: publish report
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: 'master'
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore the build directory
build/

# Ignore cppcheck artifacts
*.ctu-info

# Ignore ctags file
tags

0 comments on commit a114e1e

Please sign in to comment.