CI: use compile command database for cppcheck

This commit is contained in:
SChernykh 2023-06-15 11:23:04 +02:00
parent 30560e6cf8
commit 6738b57ba2
4 changed files with 27 additions and 15 deletions

View file

@ -9,10 +9,15 @@ on:
jobs: jobs:
cppcheck-ubuntu: cppcheck-ubuntu:
timeout-minutes: 30 timeout-minutes: 50
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libuv1-dev libzmq3-dev libcurl4-openssl-dev
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@ -29,14 +34,26 @@ jobs:
cd cppcheck-main cd cppcheck-main
make -j$(nproc) cppcheck make -j$(nproc) cppcheck
- name: cmake p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run cppcheck - name: Run cppcheck
run: | run: |
cd cppcheck cd cppcheck
./run.sh ./run.sh
- name: Archive full error list
uses: actions/upload-artifact@v3
with:
name: errors_full-linux
path: cppcheck/errors_full.txt
cppcheck-windows: cppcheck-windows:
timeout-minutes: 20 timeout-minutes: 50
runs-on: windows-latest runs-on: windows-latest
steps: steps:
@ -69,3 +86,9 @@ jobs:
run: | run: |
cd cppcheck cd cppcheck
./run.cmd ./run.cmd
- name: Archive full error list
uses: actions/upload-artifact@v3
with:
name: errors_full-windows
path: cppcheck/errors_full.txt

View file

@ -1,11 +0,0 @@
../src/
../external/src/
../external/src/cryptonote/
../external/src/libuv/include/
../external/src/cppzmq/
../external/src/libzmq/include/
../external/src/curl/include
../external/src/RandomX/src/
../external/src/rapidjson/include
../external/src/robin-hood-hashing/src/include
../external/src/miniupnp/miniupnpc/include

View file

@ -1,5 +1,5 @@
@echo off @echo off
"..\cppcheck-main\bin\cppcheck.exe" --project=..\build\p2pool.vcxproj --project-configuration="Release|x64" -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DZMQ_CPP11 -DZMQ_CPP14 --platform=win64 --std=c++14 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 "..\cppcheck-main\bin\cppcheck.exe" --project=..\build\p2pool.vcxproj --project-configuration="Release|x64" -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN --platform=win64 --std=c++14 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive
findstr /V /C:"external\src" errors_full.txt > errors_filtered.txt findstr /V /C:"external\src" errors_full.txt > errors_filtered.txt
for /f %%i in ("errors_filtered.txt") do set size=%%~zi for /f %%i in ("errors_filtered.txt") do set size=%%~zi
if %size% gtr 0 ( if %size% gtr 0 (

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
../cppcheck-main/cppcheck -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN -DMINIUPNP_STATICLIB -DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag -DWITH_RANDOMX -DWITH_UPNP -DZMQ_STATIC -DZMQ_CPP11 -DZMQ_CPP14 --platform=unix64 --std=c++14 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --includes-file=includes.txt --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 ../src ../cppcheck-main/cppcheck --project=../build/compile_commands.json -DSIZE_MAX=UINT64_MAX -DRAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN --platform=unix64 --std=c++14 --enable=all --inconclusive --inline-suppr --template="{file}:{line}:{id}{inconclusive: INCONCLUSIVE} {message}" --suppressions-list=suppressions.txt --output-file=errors_full.txt --max-ctu-depth=3 --check-level=exhaustive
grep -v 'external' errors_full.txt > errors_filtered.txt grep -v 'external' errors_full.txt > errors_filtered.txt
if [ -s errors_filtered.txt ]; then if [ -s errors_filtered.txt ]; then
cat errors_filtered.txt cat errors_filtered.txt