From 6738b57ba2de47d14edbd387c66b1c552c9aeb77 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Thu, 15 Jun 2023 11:23:04 +0200 Subject: [PATCH] CI: use compile command database for cppcheck --- .github/workflows/cppcheck.yml | 27 +++++++++++++++++++++++++-- cppcheck/includes.txt | 11 ----------- cppcheck/run.cmd | 2 +- cppcheck/run.sh | 2 +- 4 files changed, 27 insertions(+), 15 deletions(-) delete mode 100644 cppcheck/includes.txt diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 3df9242..05074cd 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -9,10 +9,15 @@ on: jobs: cppcheck-ubuntu: - timeout-minutes: 30 + timeout-minutes: 50 runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y libuv1-dev libzmq3-dev libcurl4-openssl-dev + - name: Checkout repository uses: actions/checkout@v3 with: @@ -29,14 +34,26 @@ jobs: cd cppcheck-main make -j$(nproc) cppcheck + - name: cmake p2pool + run: | + mkdir build + cd build + cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: Run cppcheck run: | cd cppcheck ./run.sh + - name: Archive full error list + uses: actions/upload-artifact@v3 + with: + name: errors_full-linux + path: cppcheck/errors_full.txt + cppcheck-windows: - timeout-minutes: 20 + timeout-minutes: 50 runs-on: windows-latest steps: @@ -69,3 +86,9 @@ jobs: run: | cd cppcheck ./run.cmd + + - name: Archive full error list + uses: actions/upload-artifact@v3 + with: + name: errors_full-windows + path: cppcheck/errors_full.txt diff --git a/cppcheck/includes.txt b/cppcheck/includes.txt deleted file mode 100644 index 7bb2215..0000000 --- a/cppcheck/includes.txt +++ /dev/null @@ -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 diff --git a/cppcheck/run.cmd b/cppcheck/run.cmd index 01847f2..8d9fea5 100644 --- a/cppcheck/run.cmd +++ b/cppcheck/run.cmd @@ -1,5 +1,5 @@ @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 for /f %%i in ("errors_filtered.txt") do set size=%%~zi if %size% gtr 0 ( diff --git a/cppcheck/run.sh b/cppcheck/run.sh index 2df88ec..a2f0afc 100755 --- a/cppcheck/run.sh +++ b/cppcheck/run.sh @@ -1,5 +1,5 @@ #!/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 if [ -s errors_filtered.txt ]; then cat errors_filtered.txt