wolfssh/.github/workflows/cppcheck.yml

51 lines
1.2 KiB
YAML

name: Cppcheck Test
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
jobs:
run_cppcheck:
name: Cppcheck
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Install cppcheck
if: always()
uses: ./.github/actions/install-apt-deps
with:
packages: cppcheck
ghcr-debs-tag: ubuntu-24.04-tests
- name: Run CppCheck
id: cpp_check_run
if: always()
# bash gets -o pipefail, so tee keeps cppcheck's exit code
shell: bash
run: >
cppcheck
-UWSCPFILEHDR -UXSNPRINTF
-DLIBWOLFSSH_VERSION_STRING='""'
--enable='warning,portability'
--std=c99
--force
--check-level=exhaustive
--error-exitcode=2
--library=std.cfg
--inline-suppr
-j4
-q
.
3>&1 1>&2 2>&3 | tee cppcheck.txt
- name: Upload cppcheck results as artifact
if: failure() && steps.cpp_check_run.outcome == 'failure'
uses: actions/upload-artifact@v7
with:
name: wolfssh-${{ github.sha }}-cppcheck_results.txt
path: cppcheck.txt