Skip to content

ci(cppcheck-all, cppcheck-differential): add cppcheck #6

ci(cppcheck-all, cppcheck-differential): add cppcheck

ci(cppcheck-all, cppcheck-differential): add cppcheck #6

name: cppcheck-differential
on:
pull_request:
jobs:
cppcheck-differential:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake git libpcre3-dev
- name: Install Cppcheck from source
run: |
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.14.1
mkdir build
cd build
cmake ..
make -j $(nproc)
sudo make install
- name: Get changed files
id: changed-files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only FETCH_HEAD ${{ github.sha }} > changed_files.txt
cat changed_files.txt
- name: Run Cppcheck on all files
run: |
cppcheck --enable=all --inconclusive --check-level=exhaustive --xml . 2> cppcheck-report.xml
shell: bash