2022-01-18 22:02:25 +01:00
|
|
|
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
|
|
|
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
|
|
|
|
name: selfcheck
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2022-08-26 23:25:07 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-01-18 22:02:25 +01:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2022-05-31 19:55:57 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-01-18 22:02:25 +01:00
|
|
|
|
2022-02-01 17:26:52 +01:00
|
|
|
env:
|
|
|
|
QT_VERSION: 5.15.2
|
|
|
|
|
2022-01-18 22:02:25 +01:00
|
|
|
steps:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-18 22:02:25 +01:00
|
|
|
|
2022-09-27 18:49:18 +02:00
|
|
|
- name: Install missing software
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install libboost-container-dev
|
|
|
|
|
2022-08-27 15:06:16 +02:00
|
|
|
- name: ccache
|
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
|
|
with:
|
2022-09-03 21:21:24 +02:00
|
|
|
key: ${{ github.workflow }}-${{ runner.os }}
|
2022-08-27 15:06:16 +02:00
|
|
|
|
2022-09-28 19:32:22 +02:00
|
|
|
- name: Install missing software
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install clang-14 valgrind
|
|
|
|
|
2022-02-01 17:26:52 +01:00
|
|
|
- name: Install Qt ${{ env.QT_VERSION }}
|
2023-01-18 17:04:21 +01:00
|
|
|
uses: jurplel/install-qt-action@v3
|
2022-01-18 22:02:25 +01:00
|
|
|
with:
|
2022-02-01 17:26:52 +01:00
|
|
|
version: ${{ env.QT_VERSION }}
|
2022-01-18 22:02:25 +01:00
|
|
|
modules: 'qtcharts'
|
2023-01-18 17:04:21 +01:00
|
|
|
cache: true
|
2022-01-18 22:02:25 +01:00
|
|
|
|
|
|
|
# TODO: cache this - perform same build as for the other self check
|
|
|
|
- name: Self check (build)
|
|
|
|
run: |
|
2022-08-27 15:06:16 +02:00
|
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
2022-09-28 19:32:22 +02:00
|
|
|
# valgrind cannot handle DWARF 5 yet so force version 4
|
|
|
|
# work around performance regression with -inline-deferral
|
|
|
|
make -j$(nproc) -s CXXFLAGS="-O2 -w -DHAVE_BOOST -gdwarf-4 -mllvm -inline-deferral" MATCHCOMPILER=yes
|
|
|
|
env:
|
|
|
|
CC: clang-14
|
|
|
|
CXX: clang++-14
|
2022-01-18 22:02:25 +01:00
|
|
|
|
|
|
|
- name: CMake
|
|
|
|
run: |
|
2022-09-24 22:14:04 +02:00
|
|
|
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
|
2022-01-18 22:02:25 +01:00
|
|
|
|
|
|
|
- name: Generate dependencies
|
|
|
|
run: |
|
|
|
|
# make sure the precompiled headers exist
|
2023-01-26 22:13:07 +01:00
|
|
|
make -C cmake.output lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx
|
2022-01-18 22:02:25 +01:00
|
|
|
make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx
|
|
|
|
# make sure auto-generated GUI files exist
|
|
|
|
make -C cmake.output autogen
|
|
|
|
make -C cmake.output gui-build-deps
|
|
|
|
|
|
|
|
# TODO: find a way to report unmatched suppressions without need to add information checks
|
|
|
|
- name: Self check (unusedFunction)
|
|
|
|
if: false # TODO: fails with preprocessorErrorDirective - see #10667
|
|
|
|
run: |
|
2022-08-23 20:30:45 +02:00
|
|
|
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
2022-01-18 22:02:25 +01:00
|
|
|
env:
|
|
|
|
DISABLE_VALUEFLOW: 1
|
2022-10-06 20:54:24 +02:00
|
|
|
UNUSEDFUNCTION_ONLY: 1
|
2022-01-18 22:02:25 +01:00
|
|
|
|
2022-03-16 15:28:44 +01:00
|
|
|
# the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps
|
2022-01-18 22:02:25 +01:00
|
|
|
- name: CMake (no test)
|
|
|
|
run: |
|
2022-09-27 18:49:18 +02:00
|
|
|
cmake -S . -B cmake.output.notest -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
|
2022-01-18 22:02:25 +01:00
|
|
|
|
|
|
|
- name: Generate dependencies (no test)
|
|
|
|
run: |
|
|
|
|
# make sure the precompiled headers exist
|
2023-01-26 22:13:07 +01:00
|
|
|
make -C cmake.output.notest lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx
|
2022-01-18 22:02:25 +01:00
|
|
|
# make sure auto-generated GUI files exist
|
|
|
|
make -C cmake.output.notest autogen
|
|
|
|
make -C cmake.output.notest gui-build-deps
|
|
|
|
|
|
|
|
# TODO: find a way to report unmatched suppressions without need to add information checks
|
|
|
|
- name: Self check (unusedFunction / no test)
|
|
|
|
run: |
|
2022-08-23 20:30:45 +02:00
|
|
|
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
2022-01-18 22:02:25 +01:00
|
|
|
env:
|
2022-04-11 07:30:55 +02:00
|
|
|
DISABLE_VALUEFLOW: 1
|
2022-10-06 20:54:24 +02:00
|
|
|
UNUSEDFUNCTION_ONLY: 1
|
2022-09-28 19:32:22 +02:00
|
|
|
|
|
|
|
- name: Fetch corpus
|
|
|
|
run: |
|
|
|
|
wget https://github.com/danmar/cppcheck/archive/refs/tags/2.8.tar.gz
|
|
|
|
tar xvf 2.8.tar.gz
|
|
|
|
|
|
|
|
- name: CMake (corpus / no test)
|
|
|
|
run: |
|
|
|
|
cmake -S cppcheck-2.8 -B cmake.output.corpus -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On
|
|
|
|
|
|
|
|
- name: Generate dependencies (corpus)
|
|
|
|
run: |
|
|
|
|
# make sure the precompiled headers exist
|
2023-01-26 22:13:07 +01:00
|
|
|
make -C cmake.output.notest lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx
|
2022-09-28 19:32:22 +02:00
|
|
|
# make sure auto-generated GUI files exist
|
|
|
|
make -C cmake.output.corpus autogen
|
|
|
|
make -C cmake.output.corpus gui-build-deps
|
|
|
|
|
|
|
|
# TODO: find a way to report unmatched suppressions without need to add information checks
|
|
|
|
- name: Self check (unusedFunction / corpus / no test / callgrind)
|
|
|
|
run: |
|
|
|
|
# TODO: fix -rp so the suppressions actually work
|
|
|
|
valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false)
|
|
|
|
cat callgrind.log
|
|
|
|
callgrind_annotate --auto=no > callgrind.annotated.log
|
|
|
|
head -50 callgrind.annotated.log
|
|
|
|
env:
|
|
|
|
DISABLE_VALUEFLOW: 1
|
|
|
|
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
2022-09-28 19:32:22 +02:00
|
|
|
with:
|
|
|
|
name: Callgrind Output
|
|
|
|
path: ./callgrind.*
|