Skip to content

Commit

Permalink
ci: cppcheck caching
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstewart committed Oct 27, 2023
1 parent 89c018e commit cbc1f7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci_linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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/[email protected]
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'
Expand Down
11 changes: 10 additions & 1 deletion codebuild/bin/run_cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit cbc1f7a

Please sign in to comment.