diff --git a/.github/workflows/ci_linting.yml b/.github/workflows/ci_linting.yml index 9aa512335df..0b1848e767f 100644 --- a/.github/workflows/ci_linting.yml +++ b/.github/workflows/ci_linting.yml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-20.04 env: CPPCHECK_INSTALL_DIR: test-deps/cppcheck + CPPCHECK_CACHE_DIR: test-deps/cppcheck-cache steps: - uses: actions/checkout@v3 @@ -26,7 +27,14 @@ jobs: continue-on-error: true with: path: ${{ env.CPPCHECK_INSTALL_DIR }} - key: cppcheck-2.3-${{ env.CPPCHECK_INSTALL_DIR }} + key: cppcheck-${{ env.CPPCHECK_INSTALL_DIR }} + + - name: Cache build dir + uses: actions/cache@v2.1.4 + continue-on-error: true + with: + path: ${{ env.CPPCHECK_CACHE_DIR }} + key: cppcheck-${{ env.CPPCHECK_CACHE_DIR }} - name: Install if: steps.cache.outputs.cache-hit != 'true' diff --git a/codebuild/bin/run_cppcheck.sh b/codebuild/bin/run_cppcheck.sh index f9bcc0ffdc7..749916004fa 100755 --- a/codebuild/bin/run_cppcheck.sh +++ b/codebuild/bin/run_cppcheck.sh @@ -24,13 +24,22 @@ if [ "$#" -ne "1" ]; then usage fi +if [ -n "$CPPCHECK_CACHE_DIR" ]; then + mkdir -p $CPPCHECK_CACHE_DIR + BUILD_DIR_ARG=" --cppcheck-build-dir=$CPPCHECK_CACHE_DIR" +fi + INSTALL_DIR=$1 CPPCHECK_EXECUTABLE=${INSTALL_DIR}/cppcheck FAILED=0 $CPPCHECK_EXECUTABLE --version -$CPPCHECK_EXECUTABLE --std=c99 --error-exitcode=-1 --quiet --force -j 8 --enable=all --template='[{file}:{line}]: ({severity}:{id}) {message}' --inline-suppr --suppressions-list=codebuild/bin/cppcheck_suppressions.txt -I . -I ./tests api bin crypto error stuffer ./tests/unit tls utils || FAILED=1 +$CPPCHECK_EXECUTABLE --std=c99 --error-exitcode=-1 --quiet --force -j 8 \ + --enable=all --template='[{file}:{line}]: ({severity}:{id}) {message}' \ + ${BUILD_DIR_ARG} \ + --inline-suppr --suppressions-list=codebuild/bin/cppcheck_suppressions.txt \ + -I . -I ./tests api bin crypto error stuffer ./tests/unit tls utils || FAILED=1 if [ $FAILED == 1 ]; then printf "\\033[31;1mFAILED cppcheck\\033[0m\\n"