File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
2+ # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
3+ name : cppcheck
4+
5+ on : [push, pull_request]
6+
7+ permissions :
8+ contents : read
9+
10+ jobs :
11+ selfcheck :
12+
13+ runs-on : ubuntu-24.04
14+
15+ defaults :
16+ run :
17+ shell : bash -euo pipefail {0}
18+
19+ env :
20+ CPPCHECK_VERSION : ' 2.22.0'
21+ CPPCHECK_INSTALL_DIR : ${{ github.workspace }}/cppcheck-install
22+
23+ steps :
24+ - uses : actions/checkout@v6
25+ with :
26+ persist-credentials : false
27+
28+ - name : Cache cppcheck
29+ uses : actions/cache@v4
30+ id : cache-cppcheck
31+ with :
32+ path : ${{ env.CPPCHECK_INSTALL_DIR }}
33+ key : ${{ runner.os }}-cppcheck-${{ env.CPPCHECK_VERSION }}
34+
35+ - name : Build cppcheck
36+ if : steps.cache-cppcheck.outputs.cache-hit != 'true'
37+ run : |
38+ git clone --depth 1 --branch "$CPPCHECK_VERSION" https://github.com/danmar/cppcheck.git cppcheck-src
39+ cmake -S cppcheck-src -B cppcheck-src/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$CPPCHECK_INSTALL_DIR"
40+ cmake --build cppcheck-src/build -j "$(nproc)"
41+ cmake --install cppcheck-src/build
42+
43+ - name : Self check
44+ run : |
45+ "$CPPCHECK_INSTALL_DIR/bin/cppcheck" --version
46+ "$CPPCHECK_INSTALL_DIR/bin/cppcheck" \
47+ --enable=style,information \
48+ --inconclusive \
49+ --inline-suppr \
50+ --check-level=exhaustive \
51+ --error-exitcode=1 \
52+ --suppress=missingIncludeSystem \
53+ --suppress=checkersReport \
54+ --template='{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]' \
55+ simplecpp.cpp
You can’t perform that action at this time.
0 commit comments