summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorsupperthomas <[email protected]>2023-04-06 19:43:44 +0800
committerMan, Jianting (Meco) <[email protected]>2023-04-06 23:11:24 -0400
commit4d0db715ed9898589b2c87c978de1edfbc22e062 (patch)
tree884eb323934407aad18b37c61811f88d438c6c68 /.github/workflows
parenta3d8c76e37510f43546bb384c58ed4188e166440 (diff)
[action][github] Add the cppcheck help check the PR warning
Signed-off-by: supperthomas <[email protected]>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/static_code_analysis.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/.github/workflows/static_code_analysis.yml b/.github/workflows/static_code_analysis.yml
new file mode 100644
index 0000000000..37d9a7b2cb
--- /dev/null
+++ b/.github/workflows/static_code_analysis.yml
@@ -0,0 +1,36 @@
+name: Static code analysis
+
+on:
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ scancode_job:
+ runs-on: ubuntu-latest
+ name: Static code analysis
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python
+ uses: actions/setup-python@v3
+ with:
+ python-version: 3.8
+
+ - name: cppcheck
+ shell: bash
+ run: |
+ sudo apt-get update
+ sudo apt-get -qq install cppcheck
+ git remote -v
+ git fetch origin
+ cppcheck --version
+ ls
+ git branch -a
+ changed_files=$(git diff --name-only HEAD origin/master | grep -E '\.(c|cpp|cc|cxx)$' || true)
+ if [ -n "$changed_files" ];then
+ cppcheck --enable=warning,performance,portability --inline-suppr --error-exitcode=1 --force $changed_files
+ err=$?
+ if [ $err -ne 0 ]; then
+ echo "CPPCHECK REPORT, PLEASE CHECK THE WARNING !!!!!!!!!"
+ fi
+ fi