Fix #9772 #1299
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cppcheck | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
analysis: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Make build-dir # Cppcheck work folder | |
run: > | |
mkdir build-dir | |
# - name: Install latest cppcheck for distro # cppcheck 2.7 is the latest for ubuntu-22.04 https://packages.ubuntu.com/search?keywords=cppcheck | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get --yes install cppcheck | |
# cppcheck --version | |
- name: Build cppcheck 2.11 # https://stackoverflow.com/a/72307265 | |
run: | | |
cd /tmp | |
git clone https://github.com/danmar/cppcheck.git | |
cd cppcheck | |
git checkout 2.11 | |
sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install | |
cd /tmp | |
sudo rm -rf /tmp/cppcheck | |
sudo ldconfig | |
cppcheck --version | |
- uses: actions/cache@v3 | |
id: cache-build-dir # Check if the cache hit-or-not | |
with: | |
path: ./build-dir/ # Path of folder to cache, Cppcheck work folder | |
key: build-dir-${{ hashFiles('**/*.*') }} | |
restore-keys: | | |
build-dir- | |
- name: Run cppcheck analysis | |
run: cppcheck -j 4 --project=VoxPopuli_vs2013.sln --max-ctu-depth=1 --max-configs=1 --cppcheck-build-dir=build-dir --enable=all --std=c++03 --verbose --xml 2> cppcheck.xml | |
- name: Upload cppcheck xml # Place cppcheck.xml in local source directory and open in cppcheck-gui | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cppcheck | |
path: ./cppcheck.xml |