Add Static Analysis action to run on Pull Request

Unit test source files are not currently checked.  Hopefully, these can
be added so that all source files in a pull request are verified.

Signed-off-by: Sean Robinson <sean.robinson@scottsdalecc.edu>
This commit is contained in:
Sean Robinson 2021-11-10 13:54:29 -07:00
parent 9a9c3042aa
commit 8d8282bac3
2 changed files with 46 additions and 0 deletions

42
.github/workflows/static_analysis.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Static Analysis
on: pull_request
jobs:
static_analysis:
name: ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
toolchain:
- ubuntu-latest
include:
- toolchain: ubuntu-latest
os: ubuntu-latest
compiler: clang
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Analyze
uses: JacobDomagala/StaticAnalysis@master
with:
clang_tidy_args: >-
--config-file=$GITHUB_WORKSPACE/.clang-tidy
--extra-arg=-I$GITHUB_WORKSPACE/include --extra-arg=-std=c++17
cppcheck_args: >-
--enable=all --inconclusive --inline-suppr
-i$GITHUB_WORKSPACE/test/main.cpp
-i$GITHUB_WORKSPACE/test/test_*.cpp
--suppress=missingInclude
--suppress='*:$GITHUB_WORKSPACE/test/doctest.hpp'
init_script: tools/static_analysis_setup.sh

4
tools/static_analysis_setup.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
# Change to the "test" subdir before "build" subdir is made.
cd test