From 15f3c85bf7ace9ec816f73e472b60091a14ece6c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:33:44 +0100 Subject: [PATCH 01/12] Update asan.yml --- .github/workflows/asan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 38e90cb760a..84540452ffd 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -52,7 +52,7 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh + wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 22 From 7521aaddaa50cc5f7b3ec7ca429537fc4e2e604c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:34:10 +0100 Subject: [PATCH 02/12] Update ubsan.yml --- .github/workflows/ubsan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index 5afc5feb1f9..a0da185bab0 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -51,7 +51,7 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh + wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 22 From 6a928e86222a59bcd8338b0eae3cb842c909229f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:34:39 +0100 Subject: [PATCH 03/12] Update tsan.yml --- .github/workflows/tsan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index 72b1764d11d..d1388394c80 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -51,7 +51,7 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh + wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 22 From 63a473f723b4532f8221eb354b1b720f96c38a05 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:35:27 +0100 Subject: [PATCH 04/12] Update clang-tidy.yml --- .github/workflows/clang-tidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index c4f8cc0cf6b..5b9874acdbb 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -41,7 +41,7 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh + wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 22 sudo apt-get install -y clang-tidy-22 From f8d0f107d8035e5140a2afe33b503d0a57285d74 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:52:40 +0100 Subject: [PATCH 05/12] Update .clang-tidy --- .clang-tidy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.clang-tidy b/.clang-tidy index 8c30f2c602b..94cd22278ea 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -39,10 +39,13 @@ Checks: > -misc-non-private-member-variables-in-classes, -misc-throw-by-value-catch-by-reference, -misc-use-anonymous-namespace, + -misc-use-internal-linkage, -modernize-avoid-c-arrays, -modernize-deprecated-ios-base-aliases, -misc-include-cleaner, + -misc-multiple-inheritance, -misc-unused-using-decls, + -modernize-avoid-c-style-cast, -modernize-loop-convert, -modernize-macro-to-enum, -modernize-raw-string-literal, @@ -68,8 +71,10 @@ Checks: > -readability-identifier-length, -readability-identifier-naming, -readability-implicit-bool-conversion, + -readability-inconsistent-ifelse-braces, -readability-isolate-declaration, -readability-magic-numbers, + -readability-math-missing-parentheses, -readability-redundant-parentheses, -readability-suspicious-call-argument, -readability-uppercase-literal-suffix, From 86b6e58268abe9be321647db666c16af2b68b530 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:02:10 +0100 Subject: [PATCH 06/12] Update clang-tidy.yml --- .github/workflows/clang-tidy.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 5b9874acdbb..00a4ee7d332 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -41,10 +41,10 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh + wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 22 - sudo apt-get install -y clang-tidy-22 + sudo ./llvm.sh 21 + sudo apt-get install -y clang-tidy-21 - name: Install Qt ${{ env.QT_VERSION }} uses: jurplel/install-qt-action@v4 @@ -57,14 +57,14 @@ jobs: - name: Verify clang-tidy configuration run: | - clang-tidy-22 --verify-config + clang-tidy-21 --verify-config - name: Prepare CMake run: | cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_COMPILE_WARNING_AS_ERROR=On env: - CC: clang-22 - CXX: clang++-22 + CC: clang-21 + CXX: clang++-21 - name: Prepare CMake dependencies run: | From d07092249e084ab4207d1bea0a23c8cd9fc6e5f9 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 9 Mar 2026 19:35:04 +0100 Subject: [PATCH 07/12] Revert to clang-21 --- .clang-tidy | 8 -------- .github/workflows/asan.yml | 8 ++++---- .github/workflows/tsan.yml | 8 ++++---- .github/workflows/ubsan.yml | 8 ++++---- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 94cd22278ea..91173d82e10 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -23,14 +23,12 @@ Checks: > google-explicit-constructor, -bugprone-assignment-in-if-condition, -bugprone-branch-clone, - -bugprone-command-processor, -bugprone-easily-swappable-parameters, -bugprone-empty-catch, -bugprone-macro-parentheses, -bugprone-narrowing-conversions, -bugprone-signed-char-misuse, -bugprone-switch-missing-default-case, - -bugprone-throwing-static-initialization, -bugprone-unchecked-optional-access, -clang-analyzer-*, -concurrency-mt-unsafe, @@ -43,9 +41,7 @@ Checks: > -modernize-avoid-c-arrays, -modernize-deprecated-ios-base-aliases, -misc-include-cleaner, - -misc-multiple-inheritance, -misc-unused-using-decls, - -modernize-avoid-c-style-cast, -modernize-loop-convert, -modernize-macro-to-enum, -modernize-raw-string-literal, @@ -71,11 +67,9 @@ Checks: > -readability-identifier-length, -readability-identifier-naming, -readability-implicit-bool-conversion, - -readability-inconsistent-ifelse-braces, -readability-isolate-declaration, -readability-magic-numbers, -readability-math-missing-parentheses, - -readability-redundant-parentheses, -readability-suspicious-call-argument, -readability-uppercase-literal-suffix, -readability-use-concise-preprocessor-directives, @@ -90,5 +84,3 @@ CheckOptions: value: '0' - key: modernize-use-trailing-return-type.TransformFunctions value: false - - key: misc-override-with-different-visibility.DisallowedVisibilityChange - value: widening diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 84540452ffd..977d3f05337 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -52,9 +52,9 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh + wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 22 + sudo ./llvm.sh 21 - name: Install Qt ${{ env.QT_VERSION }} uses: jurplel/install-qt-action@v4 @@ -76,8 +76,8 @@ jobs: run: | cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache env: - CC: clang-22 - CXX: clang++-22 + CC: clang-21 + CXX: clang++-21 - name: Build cppcheck run: | diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index d1388394c80..0e78566faae 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -51,9 +51,9 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh + wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 22 + sudo ./llvm.sh 21 - name: Install Qt ${{ env.QT_VERSION }} uses: jurplel/install-qt-action@v4 @@ -75,8 +75,8 @@ jobs: run: | cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache env: - CC: clang-22 - CXX: clang++-22 + CC: clang-21 + CXX: clang++-21 - name: Build cppcheck run: | diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml index a0da185bab0..66c56b6966a 100644 --- a/.github/workflows/ubsan.yml +++ b/.github/workflows/ubsan.yml @@ -51,9 +51,9 @@ jobs: - name: Install clang run: | sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://raw.githubusercontent.com/opencollab/llvm-jenkins.debian.net/refs/heads/master/llvm.sh + wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 22 + sudo ./llvm.sh 21 - name: Install Qt ${{ env.QT_VERSION }} uses: jurplel/install-qt-action@v4 @@ -75,8 +75,8 @@ jobs: run: | cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache env: - CC: clang-22 - CXX: clang++-22 + CC: clang-21 + CXX: clang++-21 - name: Build cppcheck run: | From a203e5add0ad03dd49c73dbf6e22dcacb31bd64e Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 9 Mar 2026 19:43:58 +0100 Subject: [PATCH 08/12] No redirect --- .github/workflows/clang-tidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 00a4ee7d332..416d3086104 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -79,7 +79,7 @@ jobs: - name: Clang-Tidy if: ${{ github.event.schedule == '' && github.event_name != 'workflow_dispatch' }} run: | - cmake --build cmake.output --target run-clang-tidy 2> /dev/null + cmake --build cmake.output --target run-clang-tidy - name: Clang Static Analyzer if: ${{ github.event.schedule != '' || github.event_name == 'workflow_dispatch' }} From 7bb369b86fd887a2c0360648cb67f61295d41c78 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 9 Mar 2026 19:44:23 +0100 Subject: [PATCH 09/12] delete --- .github/workflows/CI-cygwin.yml | 62 -- .github/workflows/CI-mingw.yml | 75 -- .github/workflows/CI-unixish-docker.yml | 127 ---- .github/workflows/CI-unixish.yml | 734 -------------------- .github/workflows/CI-windows.yml | 338 --------- .github/workflows/asan.yml | 145 ---- .github/workflows/buildman.yml | 65 -- .github/workflows/cifuzz.yml | 34 - .github/workflows/codeql-analysis.yml | 52 -- .github/workflows/coverage.yml | 71 -- .github/workflows/coverity.yml | 41 -- .github/workflows/cppcheck-premium.yml | 72 -- .github/workflows/format.yml | 55 -- .github/workflows/iwyu.yml | 271 -------- .github/workflows/release-windows-mingw.yml | 69 -- .github/workflows/release-windows.yml | 209 ------ .github/workflows/scriptcheck.yml | 222 ------ .github/workflows/selfcheck.yml | 204 ------ .github/workflows/tsan.yml | 146 ---- .github/workflows/ubsan.yml | 140 ---- .github/workflows/valgrind.yml | 65 -- 21 files changed, 3197 deletions(-) delete mode 100644 .github/workflows/CI-cygwin.yml delete mode 100644 .github/workflows/CI-mingw.yml delete mode 100644 .github/workflows/CI-unixish-docker.yml delete mode 100644 .github/workflows/CI-unixish.yml delete mode 100644 .github/workflows/CI-windows.yml delete mode 100644 .github/workflows/asan.yml delete mode 100644 .github/workflows/buildman.yml delete mode 100644 .github/workflows/cifuzz.yml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/coverity.yml delete mode 100644 .github/workflows/cppcheck-premium.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/iwyu.yml delete mode 100644 .github/workflows/release-windows-mingw.yml delete mode 100644 .github/workflows/release-windows.yml delete mode 100644 .github/workflows/scriptcheck.yml delete mode 100644 .github/workflows/selfcheck.yml delete mode 100644 .github/workflows/tsan.yml delete mode 100644 .github/workflows/ubsan.yml delete mode 100644 .github/workflows/valgrind.yml diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml deleted file mode 100644 index 0eee9446869..00000000000 --- a/.github/workflows/CI-cygwin.yml +++ /dev/null @@ -1,62 +0,0 @@ -# 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: CI-cygwin - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -defaults: - run: - shell: cmd - -jobs: - # TODO: add CMake build - build_cygwin: - strategy: - matrix: - # only use the latest windows-* as the installed toolchain is identical - os: [windows-2025] - platform: [x86_64] - include: - - platform: 'x86_64' - packages: | - gcc-g++ - python3 - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up Cygwin - uses: cygwin/cygwin-install-action@master - with: - site: https://mirrors.cicku.me/cygwin/ - platform: ${{ matrix.platform }} - packages: ${{ matrix.packages }} - - # Cygwin will always link the binaries even if they already exist. The linking is also extremely slow. So just run the "check" target which includes all the binaries. - - name: Build all and run test - run: | - C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make VERBOSE=1 -j%NUMBER_OF_PROCESSORS% CXXOPTS="-Werror" test - - - name: Extra test for misra - run: | - cd %GITHUB_WORKSPACE%\addons\test - ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 - python3 ..\misra.py -verify misra\misra-test.c.dump - ..\..\cppcheck.exe --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c - diff --git a/.github/workflows/CI-mingw.yml b/.github/workflows/CI-mingw.yml deleted file mode 100644 index 1b0cf3e5672..00000000000 --- a/.github/workflows/CI-mingw.yml +++ /dev/null @@ -1,75 +0,0 @@ -# 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: CI-mingw - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -defaults: - run: - shell: msys2 {0} - -jobs: - # TODO: add CMake build - build_mingw: - strategy: - matrix: - # only use the latest windows-* as the installed toolchain is identical - os: [windows-2025] - fail-fast: false - - runs-on: ${{ matrix.os }} - - timeout-minutes: 19 # max + 3*std of the last 7K runs - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up MSYS2 - uses: msys2/setup-msys2@v2 - with: - release: false # use pre-installed - # TODO: install mingw-w64-x86_64-make and use mingw32.make instead - currently fails with "Windows Subsystem for Linux has no installed distributions." - install: >- - mingw-w64-x86_64-lld - mingw-w64-x86_64-ccache - make - mingw-w64-x86_64-gcc - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Build cppcheck - run: | - export PATH="/mingw64/lib/ccache/bin:$PATH" - # set RDYNAMIC to work around broken MinGW detection - # use lld for faster linking - make VERBOSE=1 RDYNAMIC=-lshlwapi LDOPTS=-fuse-ld=lld -j$(nproc) CXXOPTS="-Werror" cppcheck - - - name: Build test - run: | - export PATH="/mingw64/lib/ccache/bin:$PATH" - # set RDYNAMIC to work around broken MinGW detection - # use lld for faster linking - make VERBOSE=1 RDYNAMIC=-lshlwapi LDOPTS=-fuse-ld=lld -j$(nproc) CXXOPTS="-Werror" testrunner - - - name: Run test - run: | - export PATH="/mingw64/lib/ccache/bin:$PATH" - # set RDYNAMIC to work around broken MinGW detection - # use lld for faster linking - make VERBOSE=1 RDYNAMIC=-lshlwapi LDOPTS=-fuse-ld=lld -j$(nproc) CXXOPTS="-Werror" test diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml deleted file mode 100644 index 083bb7b7651..00000000000 --- a/.github/workflows/CI-unixish-docker.yml +++ /dev/null @@ -1,127 +0,0 @@ -# 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: CI-unixish-docker - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build_cmake: - - strategy: - matrix: - image: ["ubuntu:24.04", "ubuntu:25.10"] - fail-fast: false # Prefer quick result - - runs-on: ubuntu-22.04 - - # TODO: is this actually applied to the guest? - env: - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - container: - image: ${{ matrix.image }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install missing software on ubuntu - if: contains(matrix.image, 'ubuntu') - run: | - apt-get update - apt-get install -y cmake g++ make libxml2-utils libpcre3-dev - - - name: Install missing software (gui) on latest ubuntu - run: | - apt-get install -y qt6-base-dev qt6-charts-dev qt6-tools-dev - - # needs to be called after the package installation since - # - it doesn't call "apt-get update" - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ matrix.image }} - - - name: Run CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - - - name: CMake build (with GUI) - run: | - cmake --build cmake.output -- -j$(nproc) - - - name: Run CMake test - run: | - cmake --build cmake.output --target check -- -j$(nproc) - - build_make: - - strategy: - matrix: - image: ["ubuntu:24.04", "ubuntu:25.10"] - fail-fast: false # Prefer quick result - - runs-on: ubuntu-22.04 - - container: - image: ${{ matrix.image }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install missing software on ubuntu - if: contains(matrix.image, 'ubuntu') - run: | - apt-get update - apt-get install -y g++ make python3 libxml2-utils libpcre3-dev - - # needs to be called after the package installation since - # - it doesn't call "apt-get update" - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ matrix.image }} - - - name: Build cppcheck - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" - - - name: Build test - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" testrunner - - - name: Run test - run: | - make -j$(nproc) HAVE_RULES=yes test - - # requires python3 - - name: Run extra tests - run: | - test/scripts/generate_and_run_more_tests.sh - - # requires which - - name: Validate - run: | - make -j$(nproc) checkCWEEntries validateXML - - - name: Test addons - run: | - ./cppcheck --addon=threadsafety addons/test/threadsafety - ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml deleted file mode 100644 index 8f355644bc2..00000000000 --- a/.github/workflows/CI-unixish.yml +++ /dev/null @@ -1,734 +0,0 @@ -# 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: CI-unixish - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build_cmake_tinyxml2: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - env: - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt-get install libxml2-utils libtinyxml2-dev - # qt6-tools-dev-tools for lprodump - # qt6-l10n-tools for lupdate - sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - # pcre was removed from runner images in November 2022 - brew install coreutils qt@6 tinyxml2 pcre - - - name: CMake build on ubuntu (with GUI / system tinyxml2) - if: contains(matrix.os, 'ubuntu') - run: | - cmake -S . -B cmake.output.tinyxml2 -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - cmake --build cmake.output.tinyxml2 -- -j$(nproc) - - - name: CMake build on macos (with GUI / system tinyxml2) - if: contains(matrix.os, 'macos') - run: | - cmake -S . -B cmake.output.tinyxml2 -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 - cmake --build cmake.output.tinyxml2 -- -j$(nproc) - - - name: Run CMake test (system tinyxml2) - run: | - cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc) - - build_cmake: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - env: - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - # TODO: move latest compiler to separate step - # TODO: bail out on warnings with latest GCC - - name: Set up GCC - uses: egor-tensin/setup-gcc@v1 - if: false # matrix.os == 'ubuntu-22.04' - with: - version: 13 - platform: x64 - - - name: Select compiler - if: false # matrix.os == 'ubuntu-22.04' - run: | - echo "CXX=g++-13" >> $GITHUB_ENV - - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - # qt6-tools-dev-tools for lprodump - # qt6-l10n-tools for lupdate - sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - # pcre was removed from runner images in November 2022 - brew install coreutils qt@6 pcre - - - name: Run CMake on ubuntu (with GUI) - if: contains(matrix.os, 'ubuntu') - run: | - cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install - - - name: Run CMake on macos (with GUI) - if: contains(matrix.os, 'macos') - run: | - cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 - - - name: Run CMake build - run: | - cmake --build cmake.output -- -j$(nproc) - - - name: Run CMake test - run: | - cmake --build cmake.output --target check -- -j$(nproc) - - - name: Run CTest - run: | - pushd cmake.output - ctest --output-on-failure -j$(nproc) - - - name: Run CMake install - run: | - cmake --build cmake.output --target install - - - name: Run CMake on ubuntu (no CLI) - if: matrix.os == 'ubuntu-22.04' - run: | - cmake -S . -B cmake.output_nocli -Werror=dev -DBUILD_TESTING=Off -DBUILD_CLI=Off - - - name: Run CMake on ubuntu (no CLI / with tests) - if: matrix.os == 'ubuntu-22.04' - run: | - # the test and CLI code are too intertwined so for now we need to reject that - if cmake -S . -B cmake.output_nocli_tests -Werror=dev -DBUILD_TESTING=On -DBUILD_CLI=Off; then - exit 1 - else - exit 0 - fi - - - name: Run CMake on ubuntu (no CLI / with GUI) - if: matrix.os == 'ubuntu-22.04' - run: | - cmake -S . -B cmake.output_nocli_gui -Werror=dev -DBUILD_TESTING=Off -DBUILD_CLI=Off -DBUILD_GUI=On - - - name: Run CMake on ubuntu (no GUI) - if: matrix.os == 'ubuntu-22.04' - run: | - cmake -S . -B cmake.output_nogui -Werror=dev -DBUILD_TESTING=Off -DBUILD_GUI=Off - - - name: Run CMake on ubuntu (no GUI / with triage) - if: matrix.os == 'ubuntu-22.04' - run: | - # cannot build triage without GUI - if cmake -S . -B cmake.output_nogui_triage -Werror=dev -DBUILD_TESTING=Off -DBUILD_GUI=Off -DBUILD_TRIAGE=On; then - exit 1 - else - exit 0 - fi - - - name: Run CMake on ubuntu (no CLI / no GUI) - if: matrix.os == 'ubuntu-22.04' - run: | - cmake -S . -B cmake.output_nocli_nogui -Werror=dev -DBUILD_TESTING=Off -DBUILD_GUI=Off - - build_cmake_cxxstd: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - cxxstd: [14, 17, 20] - # FIXME: macos-15 fails to compile with C++20 - # - # /Users/runner/work/cppcheck/cppcheck/cmake.output/gui/test/projectfile/moc_testprojectfile.cpp:84:1: error: 'constinit' specifier is incompatible with C++ standards before C++20 [-Werror,-Wc++20-compat] - # 84 | Q_CONSTINIT const QMetaObject TestProjectFile::staticMetaObject = { { - # | ^ - # /opt/homebrew/opt/qt/lib/QtCore.framework/Headers/qcompilerdetection.h:1409:23: note: expanded from macro 'Q_CONSTINIT' - exclude: - - os: macos-15 - cxxstd: 20 - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - env: - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.cxxstd }} - - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - # qt6-tools-dev-tools for lprodump - # qt6-l10n-tools for lupdate - sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - # pcre was removed from runner images in November 2022 - brew install coreutils qt@6 pcre - - - name: Run CMake on ubuntu (with GUI) - if: contains(matrix.os, 'ubuntu') - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd }} -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - - - name: Run CMake on macos (with GUI) - if: contains(matrix.os, 'macos') - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd }} -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 - - - name: Run CMake build - run: | - cmake --build cmake.output -- -j$(nproc) - - build_uchar: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - brew install coreutils - - - name: Build with Unsigned char - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror -funsigned-char" testrunner - - - name: Test with Unsigned char - run: | - ./testrunner - - build_mathlib: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - brew install coreutils - - - name: Build with TEST_MATHLIB_VALUE - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror" CPPOPTS=-DTEST_MATHLIB_VALUE all - - - name: Test with TEST_MATHLIB_VALUE - run: | - make -j$(nproc) test - - check_nonneg: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - # coreutils contains "g++" (default is "c++") and "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - brew install coreutils - - - name: Check syntax with NONNEG - run: | - make check-nonneg CXXOPTS="-Werror" - - build_cmake_boost: - - strategy: - matrix: - os: [macos-15] # non-macos platforms are already built with Boost in other contexts - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - env: - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Run CMake on macOS (force Boost) - run: | - # make sure we fail when Boost is requested and not available. - # will fail because no package configuration is available. - if cmake -S . -B cmake.output.boost-force-noavail -Werror=dev -DBUILD_TESTING=Off -DUSE_BOOST=On; then - exit 1 - else - exit 0 - fi - - # coreutils contains "nproc" - - name: Install missing software on macOS - run: | - brew install coreutils boost - - - name: Run CMake on macOS (force Boost) - run: | - cmake -S . -B cmake.output.boost-force -Werror=dev -DBUILD_TESTING=Off -DUSE_BOOST=On - - - name: Run CMake on macOS (no Boost) - run: | - # make sure Boost is not used when disabled even though it is available - cmake -S . -B cmake.output.boost-no -Werror=dev -DBUILD_TESTING=Off -DUSE_BOOST=Off - if grep -q '\-DHAVE_BOOST' ./cmake.output.boost-no/compile_commands.json; then - exit 1 - else - exit 0 - fi - - - name: Run CMake on macOS (with Boost) - run: | - cmake -S . -B cmake.output.boost -Werror=dev -DBUILD_TESTING=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - grep -q '\-DHAVE_BOOST' ./cmake.output.boost/compile_commands.json - - - name: Build with CMake on macOS (with Boost) - run: | - cmake --build cmake.output.boost -- -j$(nproc) - - build_cmake_minimum: # TODO: move to docker workflow? - - runs-on: ubuntu-22.04 # use the oldest available runner - - env: - CMAKE_VERSION: 3.22 - CMAKE_VERSION_FULL: 3.22.6 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - # qt6-tools-dev-tools for lprodump - # qt6-l10n-tools for lupdate - sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev - - - name: Install CMake - run: | - wget https://cmake.org/files/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64.tar.gz - tar xf cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64.tar.gz - - - name: Run CMake (without GUI) - run: | - export PATH=cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64/bin:$PATH - cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On - - - name: Run CMake (with GUI) - run: | - export PATH=cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64/bin:$PATH - cmake -S . -B cmake.output.gui -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On - - build: - - strategy: - matrix: - os: [ubuntu-22.04, macos-15] - include: - - xdist_n: auto - # FIXME: test_color_tty fails with xdist - see #13278 - - os: macos-15 - xdist_n: '1' - fail-fast: false # Prefer quick result - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Install missing software on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - - # packages for strict cfg checks - - name: Install missing software on ubuntu 22.04 (cfg) - if: matrix.os == 'ubuntu-22.04' - run: | - sudo apt-get install libcairo2-dev libcurl4-openssl-dev liblua5.3-dev libssl-dev libsqlite3-dev libcppunit-dev libsigc++-2.0-dev libgtk-3-dev libboost-all-dev libselinux-dev libwxgtk3.0-gtk3-dev xmlstarlet qtbase5-dev - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - # pcre was removed from runner images in November 2022 - brew install coreutils pcre gnu-sed - - - name: Install missing Python packages on ubuntu - if: contains(matrix.os, 'ubuntu') - run: | - python3 -m pip install pip --upgrade - python3 -m pip install pytest - python3 -m pip install pytest-timeout - python3 -m pip install pytest-xdist - python3 -m pip install psutil - - # we need to use -break-system-packages --user because the common approaches do not work. - # using pip works but it appears to install the packages into a different Python installation so they are not found later on. - # using python3 -m pip without the additional flags fails since the packages are being managed by a different tool (brew) and that lacks some of the packages. - # using pipx also does not work. - - name: Install missing Python packages on macos - if: contains(matrix.os, 'macos') - run: | - python3 -m pip install --break-system-packages --user pip --upgrade - python3 -m pip install --break-system-packages --user pytest - python3 -m pip install --break-system-packages --user pytest-timeout - python3 -m pip install --break-system-packages --user pytest-xdist - python3 -m pip install --break-system-packages --user psutil - - - name: Build cppcheck - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror" HAVE_RULES=yes - - - name: Build test - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror" HAVE_RULES=yes testrunner - - - name: Run test - run: | - make -j$(nproc) HAVE_RULES=yes test - - # requires "gnu-sed" installed on macos - - name: Run extra tests - run: | - test/scripts/generate_and_run_more_tests.sh - - - name: Run test/cli - run: | - python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli - - # TODO: use the step below instead - # do not use pushd in this step since we go below the working directory - - name: Run test/cli (symlink) - run: | - cd .. - ln -s cppcheck 'cpp check' - cd 'cpp check/test/cli' - python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} - - # FIXME: proj2_test.py fails because of the relative path cleanups in ImportProject::setRelativePaths() - # It fails because the application path used as base path has its symlink resolved by getcwd(). - - name: Run test/cli (symlink) - if: false - run: | - ln -s . 'cpp check' - python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} 'cpp check/test/cli' - - - name: Run test/cli (-j2) - run: | - python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli - env: - TEST_CPPCHECK_INJECT_J: 2 - - - name: Run test/cli (--clang) - if: false - run: | - python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli - env: - TEST_CPPCHECK_INJECT_CLANG: clang - - - name: Run test/cli (--cppcheck-build-dir) - run: | - python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli - env: - TEST_CPPCHECK_INJECT_BUILDDIR: injected - - - name: Run cfg tests - if: matrix.os != 'ubuntu-22.04' - run: | - make -j$(nproc) checkcfg - - - name: Run cfg tests (strict) - if: matrix.os == 'ubuntu-22.04' - run: | - make -j$(nproc) checkcfg - env: - STRICT: 1 - - - name: Run --dump test - run: | - ./cppcheck test/testpreprocessor.cpp --dump - xmllint --noout test/testpreprocessor.cpp.dump - - - name: Validate - run: | - make -j$(nproc) checkCWEEntries validateXML - - - name: Test install - run: | - # this is only to test the "install" target - since we did not build with FILESDIR it would not work as intended - make DESTDIR=cppcheck-make-install FILESDIR=/share/Cppcheck install - rm -rf cppcheck-make-install - - - name: Test Signalhandler - run: | - cmake -S . -B build.cmake.signal -Werror=dev -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On - cmake --build build.cmake.signal --target test-signalhandler -- -j$(nproc) - # TODO: how to run this without copying the file? - cp build.cmake.signal/bin/test-s* . - python3 -m pytest -Werror --strict-markers -vv test/signal/test-signalhandler.py - rm test-signalhandler - - # no unix backtrace support on MacOs - - name: Test Stacktrace - if: contains(matrix.os, 'ubuntu') - run: | - cmake -S . -B build.cmake.stack -Werror=dev -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On - cmake --build build.cmake.stack --target test-stacktrace -- -j$(nproc) - # TODO: how to run this without copying the file? - cp build.cmake.stack/bin/test-s* . - python3 -m pytest -Werror --strict-markers -vv test/signal/test-stacktrace.py - rm test-stacktrace - - # TODO: move to scriptcheck.yml so these are tested with all Python versions? - - name: Test addons - run: | - set -x - ./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety addons/test/threadsafety - ./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety --std=c++03 addons/test/threadsafety - ./cppcheck --error-exitcode=1 --inline-suppr --addon=misra addons/test/misra/crash*.c - ./cppcheck --error-exitcode=1 --inline-suppr --addon=misra --enable=information addons/test/misra/config*.c - - ./cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c - pushd addons/test - # We'll force C89 standard to enable an additional verification for - # rules 5.4 and 5.5 which have standard-dependent options. - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 - python3 ../misra.py -verify misra/misra-test.c.dump - # Test slight MISRA differences in C11 standard - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test-c11.c --std=c11 --platform=unix64 - python3 ../misra.py -verify misra/misra-test-c11.c.dump - # TODO: do we need to verify something here? - ../../cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h - ../../cppcheck --dump misra/misra-test.cpp - python3 ../misra.py -verify misra/misra-test.cpp.dump - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump - ../../cppcheck --addon=misra --enable=style --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c - ../../cppcheck --dump misc-test.cpp - python3 ../misc.py -verify misc-test.cpp.dump - ../../cppcheck --dump naming_test.c - python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump - ../../cppcheck --dump naming_test.cpp - python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump - - # TODO: run with "-n auto" when misra_test.py can be run in parallel - - name: test addons (Python) - if: matrix.os != 'ubuntu-22.04' - run: | - python3 -m pytest -Werror --strict-markers -vv -n 1 addons/test - env: - PYTHONPATH: ./addons - - # TODO: run with "-n auto" when misra_test.py can be run in parallel - # we cannot specify -Werror since xml/etree/ElementTree.py in Python 3.10 contains an unclosed file - - name: test addons (Python) - if: matrix.os == 'ubuntu-22.04' - run: | - python3 -m pytest --strict-markers -vv -n 1 addons/test - env: - PYTHONPATH: ./addons - - - name: Build democlient - if: matrix.os == 'ubuntu-22.04' - run: | - warnings="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar" - g++ $warnings -c -Ilib -Iexternals/tinyxml2 democlient/democlient.cpp - - - name: Test disabled executors - if: matrix.os == 'ubuntu-22.04' - run: | - g++ -Ilib -c cli/threadexecutor.cpp -DDISALLOW_THREAD_EXECUTOR - test -z "$(nm threadexecutor.o)" - g++ -Ilib -c cli/processexecutor.cpp -DDISALLOW_PROCESS_EXECUTOR - test -z "$(nm processexecutor.o)" - # TODO: test NO_* defines - - - name: Show all ignored files - if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched - run: | - git ls-files --others --ignored --exclude-standard - - - name: Check for changed and unversioned files - run: | - # TODO: how to do this with a single command? - git status --ignored=no - git status --ignored=no | grep -q 'working tree clean' - - selfcheck: - needs: build # wait for all tests to be successful first - - runs-on: ubuntu-22.04 # run on the latest image only - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - # qt6-tools-dev-tools for lprodump - # qt6-l10n-tools for lupdate - sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev - sudo apt-get install libboost-container-dev - - - name: Self check (build) - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - # compile with verification and ast matchers - make -j$(nproc) CXXOPTS="-Werror -g -O2" CPPOPTS="-DCHECK_INTERNAL -DHAVE_BOOST" MATCHCOMPILER=yes VERIFY=1 - - - name: CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On - - - name: Generate dependencies - run: | - # make sure auto-generated GUI files exist - make -C cmake.output autogen - make -C cmake.output gui-build-deps triage-build-ui-deps - - - name: Self check - run: | - ./selfcheck.sh diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml deleted file mode 100644 index c993c57753a..00000000000 --- a/.github/workflows/CI-windows.yml +++ /dev/null @@ -1,338 +0,0 @@ -# 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: CI-windows - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -defaults: - run: - shell: cmd - -jobs: - - build_qt: - strategy: - matrix: - os: [windows-2022, windows-2025] - qt_ver: [6.10.0] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x64 - - - name: Install Qt ${{ matrix.qt_ver }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ matrix.qt_ver }} - modules: 'qtcharts' - setup-python: 'false' - cache: true - aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available - - - name: Run CMake - run: | - rem TODO: enable rules? - rem specify Release build so matchcompiler is used - cmake -S . -B build -Werror=dev -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - - - name: Build GUI release - run: | - cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel! - - - name: Deploy GUI - run: | - windeployqt build\bin\Release || exit /b !errorlevel! - del build\bin\Release\cppcheck-gui.ilk || exit /b !errorlevel! - del build\bin\Release\cppcheck-gui.pdb || exit /b !errorlevel! - - # TODO: run GUI tests - - - name: Run CMake install - run: | - cmake --build build --target install - - build_cmake_cxxstd: - strategy: - matrix: - os: [windows-2022, windows-2025] - cxxstd: [14, 17, 20] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x64 - - - name: Run CMake - run: | - cmake -S . -B build.cxxstd -Werror=dev -G "Visual Studio 17 2022" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd }} -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - - - name: Build - run: | - cmake --build build.cxxstd --config Debug || exit /b !errorlevel! - - build_cmake_minimum: - - runs-on: windows-2022 # use the oldest available runner - - env: - CMAKE_VERSION: 3.22 - CMAKE_VERSION_FULL: 3.22.6 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install CMake - run: | - curl -fsSL https://cmake.org/files/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64.zip -o cmake.zip || exit /b !errorlevel! - 7z x cmake.zip || exit /b !errorlevel! - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x64 - - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - version: 6.10.0 - modules: 'qtcharts' - setup-python: 'false' - cache: true - aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available - - - name: Run CMake (without GUI) - run: | - :: TODO: enable DHAVE_RULES? - cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64\bin\cmake.exe -S . -B cmake.output -G "Visual Studio 17 2022" -A x64 -DHAVE_RULES=Off -DBUILD_TESTING=On - - - name: Run CMake (with GUI) - run: | - :: TODO: enable DHAVE_RULES? - cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64\bin\cmake.exe -S . -B cmake.output.gui -G "Visual Studio 17 2022" -A x64 -DHAVE_RULES=Off -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On - - build: - strategy: - matrix: - os: [windows-2022, windows-2025] - config: [debug, release] - fail-fast: false - - runs-on: ${{ matrix.os }} - - env: - # see https://www.pcre.org/original/changelog.txt - PCRE_VERSION: 8.45 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up Python - if: matrix.config == 'release' - uses: actions/setup-python@v5 - with: - python-version: '3.14' - check-latest: true - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x64 - - - name: Cache PCRE - id: cache-pcre - uses: actions/cache@v4 - with: - path: | - externals\pcre.h - externals\pcre.lib - externals\pcre64.lib - key: pcre-${{ env.PCRE_VERSION }}-x64-bin-win - - - name: Download PCRE - if: steps.cache-pcre.outputs.cache-hit != 'true' - run: | - curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - - - name: Install PCRE - if: steps.cache-pcre.outputs.cache-hit != 'true' - run: | - @echo on - 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - cd pcre-%PCRE_VERSION% || exit /b !errorlevel! - git apply --ignore-space-change ..\externals\pcre.patch || exit /b !errorlevel! - cmake . -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPCRE_BUILD_PCRECPP=Off -DPCRE_BUILD_TESTS=Off -DPCRE_BUILD_PCREGREP=Off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - nmake || exit /b !errorlevel! - copy pcre.h ..\externals || exit /b !errorlevel! - copy pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! - env: - CL: /MP - - - name: Install missing Python packages - if: matrix.config == 'release' - run: | - python -m pip install pip --upgrade || exit /b !errorlevel! - python -m pip install pytest || exit /b !errorlevel! - python -m pip install pytest-custom_exit_code || exit /b !errorlevel! - python -m pip install pytest-timeout || exit /b !errorlevel! - python -m pip install pytest-xdist || exit /b !errorlevel! - python -m pip install psutil || exit /b !errorlevel! - - - name: Build CLI debug configuration using MSBuild - if: matrix.config == 'debug' - run: | - :: cmake --build build --target check --config Debug || exit /b !errorlevel! - msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel! - env: - _CL_: /WX - - - name: Run Debug test - if: matrix.config == 'debug' - run: .\bin\debug\testrunner.exe || exit /b !errorlevel! - - - name: Build CLI release configuration using MSBuild - if: matrix.config == 'release' - run: | - :: cmake --build build --target check --config Release || exit /b !errorlevel! - msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel! - env: - _CL_: /WX - - - name: Run Release test - if: matrix.config == 'release' - run: .\bin\testrunner.exe || exit /b !errorlevel! - - - name: Prepare test/cli - if: matrix.config == 'release' - run: | - :: since FILESDIR is not set copy the binary to the root so the addons are found - :: copy .\build\bin\Release\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! - copy .\bin\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! - copy .\bin\cppcheck-core.dll .\cppcheck-core.dll || exit /b !errorlevel! - - - name: Run test/cli - if: matrix.config == 'release' - run: | - python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! - - - name: Run test/cli (-j2) - if: matrix.config == 'release' - run: | - python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! - env: - TEST_CPPCHECK_INJECT_J: 2 - - # TODO: install clang - - name: Run test/cli (--clang) - if: false # matrix.config == 'release' - run: | - python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! - env: - TEST_CPPCHECK_INJECT_CLANG: clang - - - name: Run test/cli (--cppcheck-build-dir) - if: matrix.config == 'release' - run: | - python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! - env: - TEST_CPPCHECK_INJECT_BUILDDIR: injected - - # TODO: test with Release configuration? - - name: Test SEH wrapper - if: matrix.config == 'release' - run: | - cmake -S . -B build.cmake.seh -Werror=dev -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - cmake --build build.cmake.seh --target test-sehwrapper || exit /b !errorlevel! - :: TODO: how to run this without copying the file? - copy build.cmake.seh\bin\Debug\test-sehwrapper.exe . || exit /b !errorlevel! - python3 -m pytest -Werror --strict-markers -vv test/seh/test-sehwrapper.py || exit /b !errorlevel! - del test-sehwrapper.exe || exit /b !errorlevel! - - - name: Test addons - if: matrix.config == 'release' - run: | - echo on - .\cppcheck --addon=threadsafety addons\test\threadsafety || exit /b !errorlevel! - .\cppcheck --addon=threadsafety --std=c++03 addons\test\threadsafety || exit /b !errorlevel! - .\cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c || exit /b !errorlevel! - cd addons\test - rem We'll force C89 standard to enable an additional verification for - rem rules 5.4 and 5.5 which have standard-dependent options. - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 || exit /b !errorlevel! - python3 ..\misra.py -verify misra\misra-test.c.dump || exit /b !errorlevel! - rem Test slight MISRA differences in C11 standard - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test-c11.c --std=c11 --platform=unix64 || exit /b !errorlevel! - python3 ..\misra.py -verify misra\misra-test-c11.c.dump || exit /b !errorlevel! - rem TODO: do we need to verify something here? - ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra\misra-test.h || exit /b !errorlevel! - ..\..\cppcheck --dump misra\misra-test.cpp || exit /b !errorlevel! - python3 ..\misra.py -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_ascii.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_utf8.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_windows1250.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! - ..\..\cppcheck --addon=misra --enable=style --platform=avr8 --error-exitcode=1 misra\misra-test-avr8.c || exit /b !errorlevel! - ..\..\cppcheck --dump misc-test.cpp || exit /b !errorlevel! - python3 ..\misc.py -verify misc-test.cpp.dump || exit /b !errorlevel! - ..\..\cppcheck --dump naming_test.c || exit /b !errorlevel! - rem TODO: fix this - does not fail on Linux - rem python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump || exit /b !errorlevel! - ..\..\cppcheck --dump naming_test.cpp || exit /b !errorlevel! - python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump || exit /b !errorlevel! - - # TODO: run with "-n auto" when misra_test.py can be run in parallel - - name: test addons (Python) - if: matrix.config == 'release' - run: | - python -m pytest -Werror --strict-markers -vv -n 1 addons/test || exit /b !errorlevel! - env: - PYTHONPATH: ./addons - - - name: Check Windows test syntax - if: matrix.config == 'debug' - run: | - cd test\cfg - cl.exe windows.cpp -DUNICODE=1 -D_UNICODE=1 /Zs || exit /b !errorlevel! - cl.exe mfc.cpp /EHsc /Zs || exit /b !errorlevel! - - - name: Show all ignored files - if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched - run: | - git ls-files --others --ignored --exclude-standard || exit /b !errorlevel! - - - name: Check for changed and unversioned files - run: | - :: TODO: how to do this with a single command? - git status --ignored=no - :: TODO: make this work - :: git status --ignored=no | grep -q 'working tree clean' diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml deleted file mode 100644 index 977d3f05337..00000000000 --- a/.github/workflows/asan.yml +++ /dev/null @@ -1,145 +0,0 @@ -# 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: address sanitizer - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - env: - QT_VERSION: 6.10.0 - ASAN_OPTIONS: detect_stack_use_after_return=1 - LSAN_OPTIONS: suppressions=lsan-suppr.txt:print_suppressions=0 - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.14' - check-latest: true - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils - sudo apt-get install -y libcups2-dev # required for Qt6PrintSupport in CMake since Qt 6.7.3 - - - name: Install clang - run: | - sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 21 - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: 'false' - cache: true - - - name: Install missing Python packages - run: | - python3 -m pip install pip --upgrade - python3 -m pip install pytest - python3 -m pip install pytest-timeout - python3 -m pip install pytest-xdist - python3 -m pip install psutil - - - name: CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - env: - CC: clang-21 - CXX: clang++-21 - - - name: Build cppcheck - run: | - cmake --build cmake.output --target cppcheck -- -j $(nproc) - - - name: Build test - run: | - cmake --build cmake.output --target testrunner -- -j $(nproc) - - - name: Build GUI tests - run: | - cmake --build cmake.output --target gui-tests -- -j $(nproc) - - - name: Run tests - run: ./cmake.output/bin/testrunner - - - name: Run cfg tests - run: | - cmake --build cmake.output --target checkcfg -- -j $(nproc) - - - name: Run CTest - run: | - cp lsan-suppr.txt cmake.output/bin - ctest --test-dir cmake.output --output-on-failure -j$(nproc) - - - name: Run test/cli - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - - - name: Run test/cli (-j2) - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_J: 2 - - - name: Run test/cli (--clang) - if: false - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_CLANG: clang - - - name: Run test/cli (--cppcheck-build-dir) - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_BUILDDIR: injected - - - name: Generate dependencies - if: false - run: | - # make sure auto-generated GUI files exist - make -C cmake.output autogen - make -C cmake.output gui-build-deps triage-build-ui-deps - - # TODO: this is currently way too slow (~60 minutes) to enable it - # TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError - - name: Self check - if: false - run: | - ./selfcheck_san.sh ./cmake.output diff --git a/.github/workflows/buildman.yml b/.github/workflows/buildman.yml deleted file mode 100644 index b0b399dd851..00000000000 --- a/.github/workflows/buildman.yml +++ /dev/null @@ -1,65 +0,0 @@ -# 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: Build manual - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - convert_via_pandoc: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - run: | - mkdir output - - - uses: docker://pandoc/latex:3.6.3 - with: - args: --output=output/manual.html man/manual.md - - - uses: docker://pandoc/latex:3.6.3 - with: - args: --output=output/manual.pdf man/manual.md - - - uses: docker://pandoc/latex:3.6.3 - with: - args: --output=output/manual-premium.pdf man/manual-premium.md - - - uses: actions/upload-artifact@v4 - with: - name: output - path: output - - manpage: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install -y xsltproc docbook-xsl - - - name: build manpage - run: | - make man - - - uses: actions/upload-artifact@v4 - with: - name: cppcheck.1 - path: cppcheck.1 diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml deleted file mode 100644 index 7b462c688f0..00000000000 --- a/.github/workflows/cifuzz.yml +++ /dev/null @@ -1,34 +0,0 @@ -# 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: CIFuzz - -on: [pull_request] - -permissions: - contents: read - -jobs: - Fuzzing: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'danmar' }} - steps: - - name: Build Fuzzers - id: build - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'cppcheck' - dry-run: false - language: c++ - - name: Run Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'cppcheck' - fuzz-seconds: 300 - dry-run: false - language: c++ - - name: Upload Crash - uses: actions/upload-artifact@v4 - if: failure() && steps.build.outcome == 'success' - with: - name: artifacts - path: ./out/artifacts diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 12e758d2c9e..00000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,52 +0,0 @@ -# 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: "CodeQL" - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-22.04 - permissions: - security-events: write - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['cpp', 'python'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - persist-credentials: false - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - - - name: Build cppcheck - if: matrix.language == 'cpp' - run: | - make -j$(nproc) CXXOPTS="-Werror" HAVE_RULES=yes CPPCHK_GLIBCXX_DEBUG= cppcheck - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 13f56172a80..00000000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,71 +0,0 @@ -# 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: Coverage - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ runner.os }} - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install libxml2-utils lcov - - - name: Install missing Python packages on ubuntu - run: | - python -m pip install pip --upgrade - python -m pip install lcov_cobertura - - - name: Compile instrumented - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror -g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes CPPCHK_GLIBCXX_DEBUG= all - - - name: Run instrumented tests - run: | - ./testrunner - test/cfg/runtests.sh - - - name: Generate coverage report - run: | - gcov lib/*.cpp -o lib/ - lcov --directory ./ --capture --output-file lcov_tmp.info -b ./ - lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info - genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp - - - uses: actions/upload-artifact@v4 - with: - name: Coverage results - path: coverage_report - - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - # file: ./coverage.xml # optional - flags: unittests # optional - name: ${{ github.repository }} # optional - fail_ci_if_error: true # optional (default = false): diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml deleted file mode 100644 index 3c07b61d7c7..00000000000 --- a/.github/workflows/coverity.yml +++ /dev/null @@ -1,41 +0,0 @@ -# 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: Coverity - -on: - schedule: - - cron: "0 0 * * *" - -permissions: - contents: read - -jobs: - scan: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'danmar' }} - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev libboost-container-dev - - name: Download Coverity build tool - run: | - wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=cppcheck" -O coverity_tool.tar.gz - mkdir coverity_tool - tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool - - name: Build with Coverity build tool - run: | - export PATH=`pwd`/coverity_tool/bin:$PATH - cov-build --dir cov-int make CPPCHK_GLIBCXX_DEBUG= - - name: Submit build result to Coverity Scan - run: | - tar czvf cov.tar.gz cov-int - curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \ - --form email=daniel.marjamaki@gmail.com \ - --form file=@cov.tar.gz \ - --form version="Commit $GITHUB_SHA" \ - --form description="Development" \ - https://scan.coverity.com/builds?project=cppcheck diff --git a/.github/workflows/cppcheck-premium.yml b/.github/workflows/cppcheck-premium.yml deleted file mode 100644 index 5cb63ca4d5e..00000000000 --- a/.github/workflows/cppcheck-premium.yml +++ /dev/null @@ -1,72 +0,0 @@ -# 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: cppcheck-premium - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - workflow_dispatch: - inputs: - premium_version: - description: 'Cppcheck Premium version' - -permissions: - contents: read - security-events: write - -jobs: - - build: - runs-on: ubuntu-24.04 # run on the latest image only - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Download cppcheckpremium release - run: | - premium_version=${{ inputs.premium_version }} - if [ -z $premium_version ]; then - premium_version=25.8.3 - #wget https://files.cppchecksolutions.com/devdrop/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz - wget https://files.cppchecksolutions.com/$premium_version/ubuntu-24.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz - else - wget https://files.cppchecksolutions.com/$premium_version/ubuntu-24.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz - fi - tar xzf cppcheckpremium.tar.gz - mv cppcheckpremium-$premium_version cppcheckpremium - - - name: Generate a license file - run: | - echo cppcheck > cppcheck.lic - echo 261231 >> cppcheck.lic - echo 80000 >> cppcheck.lic - echo 4b64673f03fb6230 >> cppcheck.lic - echo path:lib >> cppcheck.lic - - - name: Check - run: | - cppcheckpremium/premiumaddon --check-loc-license cppcheck.lic > cppcheck-premium-loc - cppcheckpremium/cppcheck --premium=safety-off -j$(nproc) -D__GNUC__ -D__CPPCHECK__ --suppressions-list=cppcheckpremium-suppressions --platform=unix64 --enable=style --premium=misra-c++-2023 --premium=cert-c++-2016 --inline-suppr lib --error-exitcode=0 --output-format=sarif 2> results.sarif - - - name: Cat results - run: | - #sed -i 's|"security-severity":.*||' results.sarif - cat results.sarif - - - uses: actions/upload-artifact@v4 - with: - name: results - path: results.sarif - - - name: Upload report - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: results.sarif - category: cppcheckpremium diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index fd491c0ec0e..00000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,55 +0,0 @@ -# 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: format - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - env: - UNCRUSTIFY_VERSION: 0.80.1 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Cache uncrustify - uses: actions/cache@v4 - id: cache-uncrustify - with: - path: | - ~/uncrustify - key: ${{ runner.os }}-uncrustify-${{ env.UNCRUSTIFY_VERSION }} - - - name: build uncrustify - if: steps.cache-uncrustify.outputs.cache-hit != 'true' - run: | - set -x - wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-${{ env.UNCRUSTIFY_VERSION }}.tar.gz - tar xzvf uncrustify-${{ env.UNCRUSTIFY_VERSION }}.tar.gz - cd uncrustify-uncrustify-${{ env.UNCRUSTIFY_VERSION }} - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - cmake --build build -- -j$(nproc) -s - mkdir ~/uncrustify - cp build/uncrustify ~/uncrustify/ - - - name: Uncrustify check - run: | - UNCRUSTIFY=~/uncrustify/uncrustify ./runformat - git diff - git diff | diff - /dev/null &> /dev/null diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml deleted file mode 100644 index fa9be0cbba8..00000000000 --- a/.github/workflows/iwyu.yml +++ /dev/null @@ -1,271 +0,0 @@ -# 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: include-what-you-use - -on: - schedule: - - cron: '0 0 * * 0' - workflow_dispatch: - -permissions: - contents: read - -jobs: - iwyu: - - strategy: - matrix: - # "opensuse/tumbleweed:latest" / "fedora:latest" / "debian:unstable" / "archlinux:latest" - include: - - os: ubuntu-22.04 - image: "fedora:latest" - stdlib: libstdc++ - clang_inc: '-isystem/usr/lib/clang/20/include' - # TODO: disable because it currently fails with "error: tried including but didn't find libc++'s header." - #- os: ubuntu-22.04 - # image: "fedora:latest" - # stdlib: libc++ - # clang_inc: '-isystem/usr/lib/clang/20/include' - - os: macos-26 - image: "" - stdlib: libc++ # no libstdc++ on macOS - mapping_file_opt: '-Xiwyu --mapping_file=$(realpath ./macos.imp)' - fail-fast: false - - runs-on: ${{ matrix.os }} - if: ${{ github.repository_owner == 'danmar' }} - - container: - image: ${{ matrix.image }} - - env: - QT_VERSION: 6.10.0 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install missing software on debian/ubuntu - if: contains(matrix.image, 'debian') - run: | - apt-get update - apt-get install -y cmake clang make libpcre3-dev - apt-get install -y libgl-dev # fixes missing dependency for Qt in CMake - apt-get install -y iwyu - - - name: Install missing software on archlinux - if: contains(matrix.image, 'archlinux') - run: | - set -x - pacman -Sy - pacman -S cmake make clang pcre --noconfirm - pacman -S libglvnd --noconfirm # fixes missing dependency for Qt in CMake - pacman-key --init - pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com - pacman-key --lsign-key 3056513887B78AEB - pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm - echo "[chaotic-aur]" >> /etc/pacman.conf - echo "Include = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf - pacman -Sy - pacman -S include-what-you-use --noconfirm - ln -s iwyu-tool /usr/sbin/iwyu_tool - - - name: Install missing software on Fedora - if: contains(matrix.image, 'fedora') - run: | - dnf install -y cmake clang pcre-devel - dnf install -y libglvnd-devel # fixes missing dependency for Qt in CMake - dnf install -y p7zip-plugins # required as fallback for py7zr in Qt installation - dnf install -y python3-pip # fixes missing pip module in jurplel/install-qt-action - dnf install -y python3-devel # fixes building of wheels for jurplel/install-qt-action - dnf install -y cairo-devel gtk3-devel libcurl-devel lua-devel openssl-devel python3-devel sqlite-devel boost-devel cppunit-devel libsigc++20-devel # for strict cfg checks - dnf install -y iwyu - ln -s iwyu_tool.py /usr/bin/iwyu_tool - - - name: Install missing software on Fedora (libc++) - if: contains(matrix.image, 'fedora') && matrix.stdlib == 'libc++' - run: | - dnf install -y libcxx-devel - - - name: Install missing software on OpenSUSE - if: contains(matrix.image, 'opensuse') - run: | - zypper install -y cmake clang pcre-devel - zypper install -y include-what-you-use-tools - ln -s iwyu_tool.py /usr/bin/iwyu_tool - - # coreutils contains "nproc" - - name: Install missing software on macOS - if: contains(matrix.os, 'macos') - run: | - brew install include-what-you-use pcre coreutils - # on Apple Silicon files are symlinked under /opt/homebrew/bin - ln -s /opt/homebrew/bin/iwyu_tool.py /usr/local/bin/iwyu_tool - - # Fails on OpenSUSE: - # Warning: Failed to restore: Tar failed with error: Unable to locate executable file: tar. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable. - # Also the shell is broken afterwards: - # OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown - # - # On macos-26 we need to perform the Python setup because the default installation is managed externally managed - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: ${{ contains(matrix.os, 'macos') }} - install-deps: false - cache: true - - - name: Generate macOS mappings - if: contains(matrix.os, 'macos') - run: | - set -x - - wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-apple-libc.py - python3 iwyu-mapgen-apple-libc.py $(xcrun --show-sdk-path)/usr/include > macos.imp - - - name: Prepare CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.stdlib == 'libc++' }} - env: - CC: clang - CXX: clang++ - - # Fails on Debian: - # /__w/cppcheck/Qt/6.7.0/gcc_64/libexec/rcc: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory - - name: Prepare CMake dependencies - run: | - # make sure the auto-generated GUI sources exist - make -C cmake.output autogen - # make sure the precompiled headers exist - #make -C cmake.output/cli cmake_pch.hxx.pch - #make -C cmake.output/gui cmake_pch.hxx.pch - #make -C cmake.output/lib cmake_pch.hxx.pch - #make -C cmake.output/test cmake_pch.hxx.pch - # make sure the auto-generated GUI dependencies exist - make -C cmake.output gui-build-deps - make -C cmake.output triage-build-ui-deps - - - name: iwyu_tool - run: | - # TODO: remove -stdlib= - it should have been taken from the compilation database - iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -stdlib=${{ matrix.stdlib }} ${{ matrix.mapping_file_opt }} ${{ matrix.clang_inc }} > iwyu.log - - # TODO: run with all configurations - - name: test/cfg - if: matrix.stdlib == 'libstdc++' - run: | - # TODO: redirect to log - ./test/cfg/runtests.sh - env: - IWYU: include-what-you-use - IWYU_CLANG_INC: ${{ matrix.clang_inc }} - - - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: Compilation Database (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }}) - path: ./cmake.output/compile_commands.json - - - uses: actions/upload-artifact@v4 - if: ${{ contains(matrix.os, 'macos') && (success() || failure()) }} - with: - name: macOS Mappings - path: | - ./iwyu-mapgen-apple-libc.py - ./macos.imp - - - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: Logs (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }}) - path: ./*.log - - clang-include-cleaner: - - strategy: - matrix: - stdlib: [libstdc++, libc++] - include: - - stdlib: libstdc++ - use_libcxx: Off - - stdlib: libc++ - use_libcxx: On - fail-fast: false - - runs-on: ubuntu-22.04 - if: ${{ github.repository_owner == 'danmar' }} - - env: - QT_VERSION: 6.10.0 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install -y cmake make libpcre3-dev - sudo apt-get install -y libgl-dev # missing dependency for using Qt in CMake - - - name: Install clang - run: | - sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 22 - sudo apt-get install -y clang-tools-22 - - - name: Install libc++ - if: matrix.stdlib == 'libc++' - run: | - sudo apt-get install -y libc++-22-dev - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: 'false' - install-deps: false - cache: true - - - name: Prepare CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }} - env: - CC: clang-22 - CXX: clang++-22 - - - name: Prepare CMake dependencies - run: | - # make sure the auto-generated GUI sources exist - make -C cmake.output autogen - # make sure the precompiled headers exist - #make -C cmake.output/cli cmake_pch.hxx.pch - #make -C cmake.output/gui cmake_pch.hxx.pch - #make -C cmake.output/lib cmake_pch.hxx.pch - #make -C cmake.output/test cmake_pch.hxx.pch - # make sure the auto-generated GUI dependencies exist - make -C cmake.output gui-build-deps - - - name: clang-include-cleaner - run: | - # TODO: run multi-threaded - find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-22 --print=changes --extra-arg=-w --extra-arg=-stdlib=${{ matrix.stdlib }} -p cmake.output > clang-include-cleaner.log 2>&1 - - - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: Compilation Database (clang-include-cleaner - ${{ matrix.stdlib }}) - path: ./cmake.output/compile_commands.json - - - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: Logs (clang-include-cleaner - ${{ matrix.stdlib }}) - path: ./*.log diff --git a/.github/workflows/release-windows-mingw.yml b/.github/workflows/release-windows-mingw.yml deleted file mode 100644 index 3b9b836347f..00000000000 --- a/.github/workflows/release-windows-mingw.yml +++ /dev/null @@ -1,69 +0,0 @@ -# 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: release-windows-mingw - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -defaults: - run: - shell: msys2 {0} - -jobs: - # TODO: add CMake build - build_mingw: - strategy: - matrix: - # only use the latest windows-* as the installed toolchain is identical - os: [windows-2025] - fail-fast: false - - runs-on: ${{ matrix.os }} - - timeout-minutes: 19 # max + 3*std of the last 7K runs - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up MSYS2 - uses: msys2/setup-msys2@v2 - with: - release: false # use pre-installed - # TODO: install mingw-w64-x86_64-make and use mingw32.make instead - currently fails with "Windows Subsystem for Linux has no installed distributions." - install: >- - mingw-w64-x86_64-lld - make - mingw-w64-x86_64-gcc - python - - - name: Build cppcheck - run: | - export PATH="/mingw64/lib/ccache/bin:$PATH" - # set RDYNAMIC to work around broken MinGW detection - make VERBOSE=1 RDYNAMIC=-lshlwapi -j$(nproc) CXXFLAGS=-O2 MATCHCOMPILER=yes cppcheck - - - name: Package - run: | - mkdir cppcheck-mingw - cp cppcheck.exe cppcheck-mingw/ - cp -R cfg platforms cppcheck-mingw/ - cp /mingw64/bin/libgcc_s_seh-1.dll cppcheck-mingw/ - cp /mingw64/bin/libstdc*.dll cppcheck-mingw/ - cp /mingw64/bin/libwinpthread-1.dll cppcheck-mingw/ - - - uses: actions/upload-artifact@v4 - with: - name: cppcheck-mingw - path: cppcheck-mingw diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml deleted file mode 100644 index 20868c1c607..00000000000 --- a/.github/workflows/release-windows.yml +++ /dev/null @@ -1,209 +0,0 @@ -# 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: release-windows - -on: - push: - tags: - - '2.*' - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -permissions: - contents: read - -defaults: - run: - shell: cmd - -jobs: - - build: - - runs-on: windows-2025 - if: ${{ github.repository_owner == 'danmar' }} - - env: - # see https://www.pcre.org/original/changelog.txt - PCRE_VERSION: 8.45 - QT_VERSION: 6.10.0 - BOOST_MINOR_VERSION: 89 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up Visual Studio environment - uses: ilammy/msvc-dev-cmd@v1 - - - name: Download PCRE - run: | - curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - - - name: Install PCRE - run: | - @echo on - 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! - cd pcre-%PCRE_VERSION% || exit /b !errorlevel! - git apply --ignore-space-change ..\externals\pcre.patch || exit /b !errorlevel! - cmake . -G "Visual Studio 17 2022" -A x64 -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - msbuild -m PCRE.sln -p:Configuration=Release -p:Platform=x64 || exit /b !errorlevel! - copy pcre.h ..\externals || exit /b !errorlevel! - copy Release\pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! - - - name: Download Boost - run: | - curl -fsSL https://archives.boost.io/release/1.%BOOST_MINOR_VERSION%.0/source/boost_1_%BOOST_MINOR_VERSION%_0.7z -o boost.zip || exit /b !errorlevel! - - - name: Install Boost - run: | - @echo on - 7z x boost.zip boost_1_%BOOST_MINOR_VERSION%_0/boost || exit /b !errorlevel! - ren boost_1_%BOOST_MINOR_VERSION%_0 boost || exit /b !errorlevel! - - # available modules: https://github.com/miurahr/aqtinstall/blob/master/docs/getting_started.rst#installing-modules - # available tools: https://github.com/miurahr/aqtinstall/blob/master/docs/getting_started.rst#installing-tools - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: 'false' - tools: 'tools_opensslv3_x64' - aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available - - # TODO: build with multiple threads - - name: Build x64 release GUI - run: | - :: TODO: enable rules? - :: specify Release build so matchcompiler is used - cmake -S . -B build -Werror=dev -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On -DUSE_BOOST=ON -DBOOST_INCLUDEDIR=%GITHUB_WORKSPACE%\boost -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel! - - # TODO: package PDBs - - name: Deploy app - run: | - windeployqt build\bin\Release || exit /b !errorlevel! - del build\bin\Release\cppcheck-gui.ilk || exit /b !errorlevel! - del build\bin\Release\cppcheck-gui.pdb || exit /b !errorlevel! - - - uses: actions/upload-artifact@v4 - with: - name: deploy - path: build\bin\Release - - - name: Matchcompiler - run: python tools\matchcompiler.py --write-dir lib || exit /b !errorlevel! - - # TODO: build with multiple threads - - name: Build CLI x64 release configuration using MSBuild - run: msbuild -m cppcheck.sln -t:cli -p:Configuration=Release-PCRE -p:Platform=x64 -p:HaveBoost=HAVE_BOOST -p:BoostInclude=%GITHUB_WORKSPACE%\boost || exit /b !errorlevel! - env: - _CL_: /WX - - - uses: actions/upload-artifact@v4 - with: - name: bin - path: bin - - - name: Install missing Python packages - run: | - pip install -U pyinstaller || exit /b !errorlevel! - - # TODO: include in installer? - - name: Compile misra.py executable - run: | - cd addons || exit /b !errorlevel! - pyinstaller --hidden-import xml --hidden-import xml.etree --hidden-import xml.etree.ElementTree misra.py || exit /b !errorlevel! - del *.spec || exit /b !errorlevel! - - # TODO: include in installer? - - name: Compile cppcheck-htmlreport executable - run: | - cd htmlreport || exit /b !errorlevel! - pyinstaller cppcheck-htmlreport || exit /b !errorlevel! - del *.spec || exit /b !errorlevel! - - # TODO: test the compiled Python files - - - name: Collect files - run: | - @echo on - move build\bin\Release win_installer\files || exit /b !errorlevel! - copy AUTHORS win_installer\files\authors.txt || exit /b !errorlevel! - copy win_installer\GPLv3.txt win_installer\files\ || exit /b !errorlevel! - copy externals\picojson\LICENSE win_installer\files\picojson-license.txt || exit /b !errorlevel! - copy externals\simplecpp\LICENSE win_installer\files\simplecpp-license.txt || exit /b !errorlevel! - copy externals\tinyxml2\LICENSE win_installer\files\tinyxml2-license.txt || exit /b !errorlevel! - copy addons\dist\misra\*.* win_installer\files\addons || exit /b !errorlevel! - copy bin\cppcheck.exe win_installer\files || exit /b !errorlevel! - copy bin\cppcheck-core.dll win_installer\files || exit /b !errorlevel! - :: mkdir win_installer\files\help || exit /b !errorlevel! - xcopy /s gui\help win_installer\files\help || exit /b !errorlevel! - copy gui\help\online-help.qhc win_installer\files\ || exit /b !errorlevel! - copy gui\help\online-help.qch win_installer\files\ || exit /b !errorlevel! - del win_installer\files\cfg\*.rng || exit /b !errorlevel! - del win_installer\files\platforms\*.rng || exit /b !errorlevel! - del win_installer\files\translations\*.qm || exit /b !errorlevel! - move build\gui\*.qm win_installer\files\translations || exit /b !errorlevel! - copy htmlreport\dist\cppcheck-htmlreport\*.* win_installer\files || exit /b !errorlevel! - :: copy libcrypto-3-x64.dll and libssl-3-x64.dll - copy %RUNNER_WORKSPACE%\Qt\Tools\OpenSSLv3\Win_x64\bin\lib*.dll win_installer\files || exit /b !errorlevel! - - - uses: actions/upload-artifact@v4 - with: - name: collect - path: win_installer\files - - - name: Build Installer - run: | - cd win_installer || exit /b !errorlevel! - :: Read ProductVersion - for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a - :: Remove double quotes - set PRODUCTVER=%PRODUCTVER:"=% - @echo ProductVersion="%PRODUCTVER%" || exit /b !errorlevel! - msbuild -m cppcheck.wixproj -p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} || exit /b !errorlevel! - - - uses: actions/upload-artifact@v4 - with: - name: installer - path: win_installer/Build/ - - - name: Clean up deploy - run: | - @echo on - :: del win_installer\files\addons\*.dll || exit /b !errorlevel! - del win_installer\files\addons\*.doxyfile || exit /b !errorlevel! - del win_installer\files\addons\*.md || exit /b !errorlevel! - :: del win_installer\files\addons\*.pyd || exit /b !errorlevel! - :: del win_installer\files\addons\base_library.zip || exit /b !errorlevel! - rmdir /s /q win_installer\files\addons\test || exit /b !errorlevel! - rmdir /s /q win_installer\files\addons\doc || exit /b !errorlevel! - :: rmdir /s /q win_installer\files\bearer || exit /b !errorlevel! - rmdir /s /q win_installer\files\generic || exit /b !errorlevel! - rmdir /s /q win_installer\files\help || exit /b !errorlevel! - rmdir /s /q win_installer\files\iconengines || exit /b !errorlevel! - rmdir /s /q win_installer\files\imageformats || exit /b !errorlevel! - rmdir /s /q win_installer\files\networkinformation || exit /b !errorlevel! - :: rmdir /s /q win_installer\files\printsupport || exit /b !errorlevel! - rmdir /s /q win_installer\files\sqldrivers || exit /b !errorlevel! - rmdir /s /q win_installer\files\tls || exit /b !errorlevel! - ren win_installer\files\translations lang || exit /b !errorlevel! - del win_installer\files\d3dcompiler_47.dll || exit /b !errorlevel! - del win_installer\files\dxcompiler.dll || exit /b !errorlevel! - del win_installer\files\dxil.dll || exit /b !errorlevel! - del win_installer\files\dmake.exe || exit /b !errorlevel! - del win_installer\files\dmake.pdb || exit /b !errorlevel! - :: del win_installer\files\libEGL.dll || exit /b !errorlevel! - :: del win_installer\files\libGLESv2.dll || exit /b !errorlevel! - del win_installer\files\opengl32sw.dll || exit /b !errorlevel! - del win_installer\files\Qt6Svg.dll || exit /b !errorlevel! - del win_installer\files\vc_redist.x64.exe || exit /b !errorlevel! - - - uses: actions/upload-artifact@v4 - with: - name: portable - path: win_installer\files diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml deleted file mode 100644 index 844b1d5c2f3..00000000000 --- a/.github/workflows/scriptcheck.yml +++ /dev/null @@ -1,222 +0,0 @@ -# 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: scriptcheck - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ runner.os }} - - - name: Cache Cppcheck - uses: actions/cache@v4 - with: - path: cppcheck - key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} - - - name: build cppcheck - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror" - strip -s ./cppcheck - - scriptcheck: - - needs: build - runs-on: ubuntu-22.04 - strategy: - matrix: - python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', '3.13', '3.14'] - include: - - python-version: '3.14' - python-latest: true - - fail-fast: false - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - # TODO: bailout on error - - name: Restore Cppcheck - uses: actions/cache@v4 - with: - path: cppcheck - key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - check-latest: true - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install tidy libxml2-utils - - - name: Install missing software on ubuntu (Python 3) - run: | - # shellcheck cannot be installed via pip - # ERROR: Could not find a version that satisfies the requirement shellcheck (from versions: none) - # ERROR: No matching distribution found for shellcheck - sudo apt-get install shellcheck - python -m pip install pip --upgrade - python -m pip install natsort - python -m pip install pexpect - python -m pip install 'pylint<4.1.0' - python -m pip install unittest2 - python -m pip install pytest - python -m pip install pytest-xdist - python -m pip install pygments - python -m pip install requests - python -m pip install psutil - python -m pip install setuptools - - - name: run Shellcheck - if: matrix.python-latest - run: | - find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 - - - name: run pylint - if: matrix.python-latest - run: | - shopt -s globstar - pylint --jobs $(nproc) --py-version 3.7 addons/**/*.py htmlreport/cppcheck-htmlreport htmlreport/**/*.py test/**/*.py tools/**/*.py - - - name: check .json files - if: matrix.python-latest - run: | - find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null - - - name: Validate - if: matrix.python-latest - run: | - make -j$(nproc) validateCFG validatePlatforms validateRules - - - name: check python syntax - run: | - shopt -s globstar - python -m py_compile addons/**/*.py - python -m py_compile htmlreport/cppcheck-htmlreport - python -m py_compile htmlreport/**/*.py - python -m py_compile test/**/*.py - python -m py_compile tools/**/*.py - - - name: compile addons - run: | - python -m compileall ./addons - - - name: test matchcompiler - run: | - python test/tools/test_matchcompiler.py - env: - PYTHONPATH: ./tools - - # TODO: run with "-n auto" when misra_test.py can be run in parallel - # we cannot specify -Werror since xml/etree/ElementTree.py in Python 3.9/3.10 contains an unclosed file - - name: test addons - if: matrix.python-version == '3.9' || matrix.python-version == '3.10' - run: | - python -m pytest --strict-markers -vv -n 1 addons/test - env: - PYTHONPATH: ./addons - - # TODO: run with "-n auto" when misra_test.py can be run in parallel - - name: test addons - if: matrix.python-version != '3.9' && matrix.python-version != '3.10' - run: | - python -m pytest -Werror --strict-markers -vv -n 1 addons/test - env: - PYTHONPATH: ./addons - - - name: test htmlreport (standalone) - run: | - test/tools/htmlreport/test_htmlreport.py - test/tools/htmlreport/check.sh - - - name: test htmlreport (pip) - run: | - python -m venv venv - source venv/bin/activate - python -m pip install -U pip - pip install ./htmlreport/ - which cppcheck-htmlreport - PIP_PACKAGE_TEST=1 test/tools/htmlreport/test_htmlreport.py - # TODO: does not test the pip binary - test/tools/htmlreport/check.sh - - - name: test reduce - run: | - python -m pytest -Werror --strict-markers -vv test/tools/reduce_test.py - env: - PYTHONPATH: ./tools - - - name: test donate_cpu_lib - run: | - python -m pytest -Werror --strict-markers -vv test/tools/donate_cpu_lib_test.py - env: - PYTHONPATH: ./tools - - - name: test donate_cpu_server - run: | - python -m pytest -Werror --strict-markers -vv test/tools/donate_cpu_server_test.py - # TODO: why is this file generated? also should be in a temporary folder if possible - rm -f test/tools/donate-cpu-server.log - env: - PYTHONPATH: ./tools - - - name: Show all ignored files - if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched - run: | - git ls-files --others --ignored --exclude-standard - - - name: Check for changed and unversioned files - run: | - # TODO: how to do this with a single command? - git status --ignored=no - git status --ignored=no | grep -q 'working tree clean' - - dmake: - strategy: - matrix: - os: [ubuntu-22.04, macos-15, windows-2025] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: run dmake - run: | - make -j3 CXXOPTS="-Werror" run-dmake - - - name: check diff - run: | - git diff --exit-code diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml deleted file mode 100644 index ec52b15f939..00000000000 --- a/.github/workflows/selfcheck.yml +++ /dev/null @@ -1,204 +0,0 @@ -# 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: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - env: - QT_VERSION: 6.10.0 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ runner.os }} - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install clang-14 - sudo apt-get install libboost-container-dev - sudo apt-get install valgrind - sudo apt-get install -y libgl-dev # fixes missing dependency for Qt in CMake - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: 'false' - install-deps: false - cache: true - - # TODO: cache this - perform same build as for the other self check - - name: Self check (build) - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - # valgrind cannot handle DWARF 5 yet so force version 4 - # work around performance regression with -inline-deferral - make -j$(nproc) CXXOPTS="-Werror -O2 -gdwarf-4" CPPOPTS="-DHAVE_BOOST -mllvm -inline-deferral" MATCHCOMPILER=yes CPPCHK_GLIBCXX_DEBUG= - env: - CC: clang-14 - CXX: clang++-14 - - # unusedFunction - start - - name: CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off - - - name: Generate dependencies - run: | - # make sure auto-generated GUI files exist - make -C cmake.output autogen - # make sure the precompiled headers exist - make -C cmake.output lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx - make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx - # make sure the auto-generated GUI dependencies exist - make -C cmake.output gui-build-deps - - - name: Self check (unusedFunction) - if: false # TODO: fails with preprocessorErrorDirective - see #10667 - run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr - env: - DISABLE_VALUEFLOW: 1 - UNUSEDFUNCTION_ONLY: 1 - # unusedFunction - end - - # the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps - - # unusedFunction notest - start - - name: CMake (no test) - run: | - cmake -S . -B cmake.output.notest -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_GUI=ON -DBUILD_TRIAGE=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off - - - name: Generate dependencies (no test) - run: | - # make sure auto-generated GUI files exist - make -C cmake.output.notest autogen - # make sure the precompiled headers exist - make -C cmake.output.notest lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx - # make sure the auto-generated GUI dependencies exist - make -C cmake.output.notest gui-build-deps - - - name: Self check (unusedFunction / no test) - run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr - env: - DISABLE_VALUEFLOW: 1 - UNUSEDFUNCTION_ONLY: 1 - # unusedFunction notest - end - - # unusedFunction notest nogui - start - - name: CMake (no test / no gui) - run: | - cmake -S . -B cmake.output.notest_nogui -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off - - - name: Generate dependencies (no test / no gui) - run: | - # make sure the precompiled headers exist - make -C cmake.output.notest_nogui lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx - - - name: Self check (unusedFunction / no test / no gui) - run: | - supprs="--suppress=unusedFunction:lib/errorlogger.h:197 --suppress=unusedFunction:lib/importproject.cpp:1531 --suppress=unusedFunction:lib/importproject.cpp:1555" - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr $supprs - env: - DISABLE_VALUEFLOW: 1 - UNUSEDFUNCTION_ONLY: 1 - # unusedFunction notest nogui - end - - # unusedFunction notest nocli - start - - name: CMake (no test / no cli) - run: | - cmake -S . -B cmake.output.notest_nocli -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_CLI=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off - - - name: Generate dependencies (no test / no cli) - run: | - # make sure auto-generated GUI files exist - make -C cmake.output.notest_nocli autogen - # make sure the precompiled headers exist - make -C cmake.output.notest_nocli lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx - # make sure the auto-generated GUI dependencies exist - make -C cmake.output.notest_nocli gui-build-deps - - - name: Self check (unusedFunction / no test / no cli) - if: false # TODO: the findings are currently too intrusive - run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nocli/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr - env: - DISABLE_VALUEFLOW: 1 - UNUSEDFUNCTION_ONLY: 1 - # unusedFunction notest nocli - end - - # unusedFunction notest nocli nogui - start - - name: CMake (no test / no cli / no gui) - run: | - cmake -S . -B cmake.output.notest_nocli_nogui -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_CLI=Off -DBUILD_GUI=Off -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off - - - name: Generate dependencies (no test / no cli / no gui) - run: | - # make sure the precompiled headers exist - make -C cmake.output.notest_nocli_nogui lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx - - - name: Self check (unusedFunction / no test / no cli / no gui) - if: false # TODO: the findings are currently too intrusive - run: | - ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nocli_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr - env: - DISABLE_VALUEFLOW: 1 - UNUSEDFUNCTION_ONLY: 1 - # unusedFunction notest nocli nogui - end - - - 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 -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 - - - name: Generate dependencies (corpus) - run: | - # make sure auto-generated GUI files exist - make -C cmake.output.corpus autogen - # make sure the precompiled headers exist - make -C cmake.output.corpus lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx - # make sure the auto-generated GUI dependencies exist - make -C cmake.output.corpus gui-build-deps - - - 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=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --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 - - - uses: actions/upload-artifact@v4 - with: - name: Callgrind Output - path: ./callgrind.* diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml deleted file mode 100644 index 0e78566faae..00000000000 --- a/.github/workflows/tsan.yml +++ /dev/null @@ -1,146 +0,0 @@ -# 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: thread sanitizer - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - env: - QT_VERSION: 6.10.0 - TSAN_OPTIONS: halt_on_error=1 - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.14' - check-latest: true - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils - sudo apt-get install -y libcups2-dev # required for Qt6PrintSupport in CMake since Qt 6.7.3 - - - name: Install clang - run: | - sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 21 - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: 'false' - cache: true - - - name: Install missing Python packages - run: | - python3 -m pip install pip --upgrade - python3 -m pip install pytest - python3 -m pip install pytest-timeout - python3 -m pip install pytest-xdist - python3 -m pip install psutil - - - name: CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - env: - CC: clang-21 - CXX: clang++-21 - - - name: Build cppcheck - run: | - cmake --build cmake.output --target cppcheck -- -j $(nproc) - - - name: Build test - run: | - cmake --build cmake.output --target testrunner -- -j $(nproc) - - - name: Build GUI tests - run: | - cmake --build cmake.output --target gui-tests -- -j $(nproc) - - - name: Run tests - run: ./cmake.output/bin/testrunner - - - name: Run cfg tests - run: | - cmake --build cmake.output --target checkcfg -- -j $(nproc) - - - name: Run CTest - if: false # TODO: test-filelist fails with data race in pthread_cond_destroy - run: | - ctest --test-dir cmake.output --output-on-failure -j$(nproc) - - - name: Run test/cli - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_EXECUTOR: thread - - - name: Run test/cli (-j2) - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_J: 2 - - - name: Run test/cli (--clang) - if: false - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_CLANG: clang - - - name: Run test/cli (--cppcheck-build-dir) - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_BUILDDIR: injected - - - name: Generate dependencies - if: false - run: | - # make sure auto-generated GUI files exist - make -C cmake.output autogen - make -C cmake.output gui-build-deps triage-build-ui-deps - - # TODO: disabled for now as it takes around 40 minutes to finish - # set --error-exitcode=0 so we only fail on sanitizer issues - since it uses threads for execution it will exit the whole process on the first issue - - name: Self check - if: false - run: | - ./selfcheck_san.sh ./cmake.output "--executor=thread --error-exitcode=0" diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml deleted file mode 100644 index 66c56b6966a..00000000000 --- a/.github/workflows/ubsan.yml +++ /dev/null @@ -1,140 +0,0 @@ -# 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: undefined behaviour sanitizers - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - env: - QT_VERSION: 6.10.0 - UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1 - # TODO: figure out why there are cache misses with PCH enabled - CCACHE_SLOPPINESS: pch_defines,time_macros - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.14' - check-latest: true - - - name: Install missing software on ubuntu - run: | - sudo apt-get update - sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils - sudo apt-get install -y libcups2-dev # required for Qt6PrintSupport in CMake since Qt 6.7.3 - - - name: Install clang - run: | - sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 21 - - - name: Install Qt ${{ env.QT_VERSION }} - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - modules: 'qtcharts' - setup-python: 'false' - cache: true - - - name: Install missing Python packages - run: | - python3 -m pip install pip --upgrade - python3 -m pip install pytest - python3 -m pip install pytest-timeout - python3 -m pip install pytest-xdist - python3 -m pip install psutil - - - name: CMake - run: | - cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - env: - CC: clang-21 - CXX: clang++-21 - - - name: Build cppcheck - run: | - cmake --build cmake.output --target cppcheck -- -j $(nproc) - - - name: Build test - run: | - cmake --build cmake.output --target testrunner -- -j $(nproc) - - - name: Build GUI tests - run: | - cmake --build cmake.output --target gui-tests -- -j $(nproc) - - - name: Run tests - run: ./cmake.output/bin/testrunner - - - name: Run cfg tests - run: | - cmake --build cmake.output --target checkcfg -- -j $(nproc) - - - name: Run CTest - run: | - ctest --test-dir cmake.output --output-on-failure -j$(nproc) - - - name: Run test/cli - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - - - name: Run test/cli (-j2) - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_J: 2 - - - name: Run test/cli (--clang) - if: false - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_CLANG: clang - - - name: Run test/cli (--cppcheck-build-dir) - run: | - pwd=$(pwd) - TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli - env: - TEST_CPPCHECK_INJECT_BUILDDIR: injected - - - name: Generate dependencies - run: | - # make sure auto-generated GUI files exist - make -C cmake.output autogen - make -C cmake.output gui-build-deps triage-build-ui-deps - - # TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError - - name: Self check - run: | - ./selfcheck_san.sh ./cmake.output diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml deleted file mode 100644 index 9a6026aa25b..00000000000 --- a/.github/workflows/valgrind.yml +++ /dev/null @@ -1,65 +0,0 @@ -# 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: valgrind - -on: - push: - branches: - - 'main' - - 'releases/**' - - '2.*' - tags: - - '2.*' - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.workflow }}-${{ runner.os }} - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install libxml2-utils - sudo apt-get install valgrind - sudo apt-get install libboost-container-dev - sudo apt-get install debuginfod - - - name: Build cppcheck - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror -O1 -g" CPPOPTS="-DHAVE_BOOST" HAVE_RULES=yes MATCHCOMPILER=yes CPPCHK_GLIBCXX_DEBUG= - - - name: Build test - run: | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" - make -j$(nproc) CXXOPTS="-Werror -O1 -g" CPPOPTS="-DHAVE_BOOST" HAVE_RULES=yes MATCHCOMPILER=yes CPPCHK_GLIBCXX_DEBUG= testrunner - - - name: Run valgrind - run: | - ec=0 - valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --suppressions=valgrind/testrunner.supp --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./testrunner TestGarbage TestOther TestSimplifyTemplate 9>memcheck.log || ec=1 - cat memcheck.log - exit $ec - # TODO: debuginfod.ubuntu.com is currently not responding to any requests causing it to run into a 40(!) minute timeout - #env: - # DEBUGINFOD_URLS: https://debuginfod.ubuntu.com - - - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: Logs - path: ./*.log From 582d8e782ad820a04503c9804bfb1baacb4e9484 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 9 Mar 2026 19:49:48 +0100 Subject: [PATCH 10/12] Undo --- cmake/clang_tidy.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/clang_tidy.cmake b/cmake/clang_tidy.cmake index fe0efbbe32f..486c560f1f5 100644 --- a/cmake/clang_tidy.cmake +++ b/cmake/clang_tidy.cmake @@ -25,9 +25,6 @@ if(RUN_CLANG_TIDY_NAMES) endif() message(STATUS "NPROC=${NPROC}") - # TODO: introduced in run-clang-tidy-22 - set(CLANG_TIDY_CONFIG "-enable-check-profile") - # most of these are disabled because they are too noisy in our code # clang-analyzer-core.CallAndMessage # clang-analyzer-core.NonNullParamChecker From 98baa31ca35cdfb6af25f991ecbc3d8a89daf80f Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 9 Mar 2026 20:05:35 +0100 Subject: [PATCH 11/12] Undo --- .github/workflows/clang-tidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 416d3086104..00a4ee7d332 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -79,7 +79,7 @@ jobs: - name: Clang-Tidy if: ${{ github.event.schedule == '' && github.event_name != 'workflow_dispatch' }} run: | - cmake --build cmake.output --target run-clang-tidy + cmake --build cmake.output --target run-clang-tidy 2> /dev/null - name: Clang Static Analyzer if: ${{ github.event.schedule != '' || github.event_name == 'workflow_dispatch' }} From b2852fbbe361e4a1071218b1bb596db85ca618e0 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Mon, 9 Mar 2026 20:06:55 +0100 Subject: [PATCH 12/12] Revert "delete" This reverts commit 7bb369b86fd887a2c0360648cb67f61295d41c78. --- .github/workflows/CI-cygwin.yml | 62 ++ .github/workflows/CI-mingw.yml | 75 ++ .github/workflows/CI-unixish-docker.yml | 127 ++++ .github/workflows/CI-unixish.yml | 734 ++++++++++++++++++++ .github/workflows/CI-windows.yml | 338 +++++++++ .github/workflows/asan.yml | 145 ++++ .github/workflows/buildman.yml | 65 ++ .github/workflows/cifuzz.yml | 34 + .github/workflows/codeql-analysis.yml | 52 ++ .github/workflows/coverage.yml | 71 ++ .github/workflows/coverity.yml | 41 ++ .github/workflows/cppcheck-premium.yml | 72 ++ .github/workflows/format.yml | 55 ++ .github/workflows/iwyu.yml | 271 ++++++++ .github/workflows/release-windows-mingw.yml | 69 ++ .github/workflows/release-windows.yml | 209 ++++++ .github/workflows/scriptcheck.yml | 222 ++++++ .github/workflows/selfcheck.yml | 204 ++++++ .github/workflows/tsan.yml | 146 ++++ .github/workflows/ubsan.yml | 140 ++++ .github/workflows/valgrind.yml | 65 ++ 21 files changed, 3197 insertions(+) create mode 100644 .github/workflows/CI-cygwin.yml create mode 100644 .github/workflows/CI-mingw.yml create mode 100644 .github/workflows/CI-unixish-docker.yml create mode 100644 .github/workflows/CI-unixish.yml create mode 100644 .github/workflows/CI-windows.yml create mode 100644 .github/workflows/asan.yml create mode 100644 .github/workflows/buildman.yml create mode 100644 .github/workflows/cifuzz.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/coverity.yml create mode 100644 .github/workflows/cppcheck-premium.yml create mode 100644 .github/workflows/format.yml create mode 100644 .github/workflows/iwyu.yml create mode 100644 .github/workflows/release-windows-mingw.yml create mode 100644 .github/workflows/release-windows.yml create mode 100644 .github/workflows/scriptcheck.yml create mode 100644 .github/workflows/selfcheck.yml create mode 100644 .github/workflows/tsan.yml create mode 100644 .github/workflows/ubsan.yml create mode 100644 .github/workflows/valgrind.yml diff --git a/.github/workflows/CI-cygwin.yml b/.github/workflows/CI-cygwin.yml new file mode 100644 index 00000000000..0eee9446869 --- /dev/null +++ b/.github/workflows/CI-cygwin.yml @@ -0,0 +1,62 @@ +# 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: CI-cygwin + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +defaults: + run: + shell: cmd + +jobs: + # TODO: add CMake build + build_cygwin: + strategy: + matrix: + # only use the latest windows-* as the installed toolchain is identical + os: [windows-2025] + platform: [x86_64] + include: + - platform: 'x86_64' + packages: | + gcc-g++ + python3 + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Cygwin + uses: cygwin/cygwin-install-action@master + with: + site: https://mirrors.cicku.me/cygwin/ + platform: ${{ matrix.platform }} + packages: ${{ matrix.packages }} + + # Cygwin will always link the binaries even if they already exist. The linking is also extremely slow. So just run the "check" target which includes all the binaries. + - name: Build all and run test + run: | + C:\cygwin\bin\bash.exe -l -c cd %GITHUB_WORKSPACE% && make VERBOSE=1 -j%NUMBER_OF_PROCESSORS% CXXOPTS="-Werror" test + + - name: Extra test for misra + run: | + cd %GITHUB_WORKSPACE%\addons\test + ..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 + python3 ..\misra.py -verify misra\misra-test.c.dump + ..\..\cppcheck.exe --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 misra\misra-ctu-1-test.c misra\misra-ctu-2-test.c + diff --git a/.github/workflows/CI-mingw.yml b/.github/workflows/CI-mingw.yml new file mode 100644 index 00000000000..1b0cf3e5672 --- /dev/null +++ b/.github/workflows/CI-mingw.yml @@ -0,0 +1,75 @@ +# 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: CI-mingw + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +defaults: + run: + shell: msys2 {0} + +jobs: + # TODO: add CMake build + build_mingw: + strategy: + matrix: + # only use the latest windows-* as the installed toolchain is identical + os: [windows-2025] + fail-fast: false + + runs-on: ${{ matrix.os }} + + timeout-minutes: 19 # max + 3*std of the last 7K runs + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + with: + release: false # use pre-installed + # TODO: install mingw-w64-x86_64-make and use mingw32.make instead - currently fails with "Windows Subsystem for Linux has no installed distributions." + install: >- + mingw-w64-x86_64-lld + mingw-w64-x86_64-ccache + make + mingw-w64-x86_64-gcc + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Build cppcheck + run: | + export PATH="/mingw64/lib/ccache/bin:$PATH" + # set RDYNAMIC to work around broken MinGW detection + # use lld for faster linking + make VERBOSE=1 RDYNAMIC=-lshlwapi LDOPTS=-fuse-ld=lld -j$(nproc) CXXOPTS="-Werror" cppcheck + + - name: Build test + run: | + export PATH="/mingw64/lib/ccache/bin:$PATH" + # set RDYNAMIC to work around broken MinGW detection + # use lld for faster linking + make VERBOSE=1 RDYNAMIC=-lshlwapi LDOPTS=-fuse-ld=lld -j$(nproc) CXXOPTS="-Werror" testrunner + + - name: Run test + run: | + export PATH="/mingw64/lib/ccache/bin:$PATH" + # set RDYNAMIC to work around broken MinGW detection + # use lld for faster linking + make VERBOSE=1 RDYNAMIC=-lshlwapi LDOPTS=-fuse-ld=lld -j$(nproc) CXXOPTS="-Werror" test diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml new file mode 100644 index 00000000000..083bb7b7651 --- /dev/null +++ b/.github/workflows/CI-unixish-docker.yml @@ -0,0 +1,127 @@ +# 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: CI-unixish-docker + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build_cmake: + + strategy: + matrix: + image: ["ubuntu:24.04", "ubuntu:25.10"] + fail-fast: false # Prefer quick result + + runs-on: ubuntu-22.04 + + # TODO: is this actually applied to the guest? + env: + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software on ubuntu + if: contains(matrix.image, 'ubuntu') + run: | + apt-get update + apt-get install -y cmake g++ make libxml2-utils libpcre3-dev + + - name: Install missing software (gui) on latest ubuntu + run: | + apt-get install -y qt6-base-dev qt6-charts-dev qt6-tools-dev + + # needs to be called after the package installation since + # - it doesn't call "apt-get update" + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ matrix.image }} + + - name: Run CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + + - name: CMake build (with GUI) + run: | + cmake --build cmake.output -- -j$(nproc) + + - name: Run CMake test + run: | + cmake --build cmake.output --target check -- -j$(nproc) + + build_make: + + strategy: + matrix: + image: ["ubuntu:24.04", "ubuntu:25.10"] + fail-fast: false # Prefer quick result + + runs-on: ubuntu-22.04 + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software on ubuntu + if: contains(matrix.image, 'ubuntu') + run: | + apt-get update + apt-get install -y g++ make python3 libxml2-utils libpcre3-dev + + # needs to be called after the package installation since + # - it doesn't call "apt-get update" + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ matrix.image }} + + - name: Build cppcheck + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" + + - name: Build test + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) HAVE_RULES=yes CXXOPTS="-Werror" testrunner + + - name: Run test + run: | + make -j$(nproc) HAVE_RULES=yes test + + # requires python3 + - name: Run extra tests + run: | + test/scripts/generate_and_run_more_tests.sh + + # requires which + - name: Validate + run: | + make -j$(nproc) checkCWEEntries validateXML + + - name: Test addons + run: | + ./cppcheck --addon=threadsafety addons/test/threadsafety + ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml new file mode 100644 index 00000000000..8f355644bc2 --- /dev/null +++ b/.github/workflows/CI-unixish.yml @@ -0,0 +1,734 @@ +# 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: CI-unixish + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build_cmake_tinyxml2: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + env: + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install libxml2-utils libtinyxml2-dev + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + + # coreutils contains "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + # pcre was removed from runner images in November 2022 + brew install coreutils qt@6 tinyxml2 pcre + + - name: CMake build on ubuntu (with GUI / system tinyxml2) + if: contains(matrix.os, 'ubuntu') + run: | + cmake -S . -B cmake.output.tinyxml2 -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake --build cmake.output.tinyxml2 -- -j$(nproc) + + - name: CMake build on macos (with GUI / system tinyxml2) + if: contains(matrix.os, 'macos') + run: | + cmake -S . -B cmake.output.tinyxml2 -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 + cmake --build cmake.output.tinyxml2 -- -j$(nproc) + + - name: Run CMake test (system tinyxml2) + run: | + cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc) + + build_cmake: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + env: + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + # TODO: move latest compiler to separate step + # TODO: bail out on warnings with latest GCC + - name: Set up GCC + uses: egor-tensin/setup-gcc@v1 + if: false # matrix.os == 'ubuntu-22.04' + with: + version: 13 + platform: x64 + + - name: Select compiler + if: false # matrix.os == 'ubuntu-22.04' + run: | + echo "CXX=g++-13" >> $GITHUB_ENV + + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + + # coreutils contains "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + # pcre was removed from runner images in November 2022 + brew install coreutils qt@6 pcre + + - name: Run CMake on ubuntu (with GUI) + if: contains(matrix.os, 'ubuntu') + run: | + cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install + + - name: Run CMake on macos (with GUI) + if: contains(matrix.os, 'macos') + run: | + cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 + + - name: Run CMake build + run: | + cmake --build cmake.output -- -j$(nproc) + + - name: Run CMake test + run: | + cmake --build cmake.output --target check -- -j$(nproc) + + - name: Run CTest + run: | + pushd cmake.output + ctest --output-on-failure -j$(nproc) + + - name: Run CMake install + run: | + cmake --build cmake.output --target install + + - name: Run CMake on ubuntu (no CLI) + if: matrix.os == 'ubuntu-22.04' + run: | + cmake -S . -B cmake.output_nocli -Werror=dev -DBUILD_TESTING=Off -DBUILD_CLI=Off + + - name: Run CMake on ubuntu (no CLI / with tests) + if: matrix.os == 'ubuntu-22.04' + run: | + # the test and CLI code are too intertwined so for now we need to reject that + if cmake -S . -B cmake.output_nocli_tests -Werror=dev -DBUILD_TESTING=On -DBUILD_CLI=Off; then + exit 1 + else + exit 0 + fi + + - name: Run CMake on ubuntu (no CLI / with GUI) + if: matrix.os == 'ubuntu-22.04' + run: | + cmake -S . -B cmake.output_nocli_gui -Werror=dev -DBUILD_TESTING=Off -DBUILD_CLI=Off -DBUILD_GUI=On + + - name: Run CMake on ubuntu (no GUI) + if: matrix.os == 'ubuntu-22.04' + run: | + cmake -S . -B cmake.output_nogui -Werror=dev -DBUILD_TESTING=Off -DBUILD_GUI=Off + + - name: Run CMake on ubuntu (no GUI / with triage) + if: matrix.os == 'ubuntu-22.04' + run: | + # cannot build triage without GUI + if cmake -S . -B cmake.output_nogui_triage -Werror=dev -DBUILD_TESTING=Off -DBUILD_GUI=Off -DBUILD_TRIAGE=On; then + exit 1 + else + exit 0 + fi + + - name: Run CMake on ubuntu (no CLI / no GUI) + if: matrix.os == 'ubuntu-22.04' + run: | + cmake -S . -B cmake.output_nocli_nogui -Werror=dev -DBUILD_TESTING=Off -DBUILD_GUI=Off + + build_cmake_cxxstd: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + cxxstd: [14, 17, 20] + # FIXME: macos-15 fails to compile with C++20 + # + # /Users/runner/work/cppcheck/cppcheck/cmake.output/gui/test/projectfile/moc_testprojectfile.cpp:84:1: error: 'constinit' specifier is incompatible with C++ standards before C++20 [-Werror,-Wc++20-compat] + # 84 | Q_CONSTINIT const QMetaObject TestProjectFile::staticMetaObject = { { + # | ^ + # /opt/homebrew/opt/qt/lib/QtCore.framework/Headers/qcompilerdetection.h:1409:23: note: expanded from macro 'Q_CONSTINIT' + exclude: + - os: macos-15 + cxxstd: 20 + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + env: + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.cxxstd }} + + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + + # coreutils contains "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + # pcre was removed from runner images in November 2022 + brew install coreutils qt@6 pcre + + - name: Run CMake on ubuntu (with GUI) + if: contains(matrix.os, 'ubuntu') + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd }} -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + + - name: Run CMake on macos (with GUI) + if: contains(matrix.os, 'macos') + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd }} -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6 + + - name: Run CMake build + run: | + cmake --build cmake.output -- -j$(nproc) + + build_uchar: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + # coreutils contains "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + brew install coreutils + + - name: Build with Unsigned char + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror -funsigned-char" testrunner + + - name: Test with Unsigned char + run: | + ./testrunner + + build_mathlib: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + # coreutils contains "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + brew install coreutils + + - name: Build with TEST_MATHLIB_VALUE + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror" CPPOPTS=-DTEST_MATHLIB_VALUE all + + - name: Test with TEST_MATHLIB_VALUE + run: | + make -j$(nproc) test + + check_nonneg: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + # coreutils contains "g++" (default is "c++") and "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + brew install coreutils + + - name: Check syntax with NONNEG + run: | + make check-nonneg CXXOPTS="-Werror" + + build_cmake_boost: + + strategy: + matrix: + os: [macos-15] # non-macos platforms are already built with Boost in other contexts + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + env: + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Run CMake on macOS (force Boost) + run: | + # make sure we fail when Boost is requested and not available. + # will fail because no package configuration is available. + if cmake -S . -B cmake.output.boost-force-noavail -Werror=dev -DBUILD_TESTING=Off -DUSE_BOOST=On; then + exit 1 + else + exit 0 + fi + + # coreutils contains "nproc" + - name: Install missing software on macOS + run: | + brew install coreutils boost + + - name: Run CMake on macOS (force Boost) + run: | + cmake -S . -B cmake.output.boost-force -Werror=dev -DBUILD_TESTING=Off -DUSE_BOOST=On + + - name: Run CMake on macOS (no Boost) + run: | + # make sure Boost is not used when disabled even though it is available + cmake -S . -B cmake.output.boost-no -Werror=dev -DBUILD_TESTING=Off -DUSE_BOOST=Off + if grep -q '\-DHAVE_BOOST' ./cmake.output.boost-no/compile_commands.json; then + exit 1 + else + exit 0 + fi + + - name: Run CMake on macOS (with Boost) + run: | + cmake -S . -B cmake.output.boost -Werror=dev -DBUILD_TESTING=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + grep -q '\-DHAVE_BOOST' ./cmake.output.boost/compile_commands.json + + - name: Build with CMake on macOS (with Boost) + run: | + cmake --build cmake.output.boost -- -j$(nproc) + + build_cmake_minimum: # TODO: move to docker workflow? + + runs-on: ubuntu-22.04 # use the oldest available runner + + env: + CMAKE_VERSION: 3.22 + CMAKE_VERSION_FULL: 3.22.6 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + + - name: Install CMake + run: | + wget https://cmake.org/files/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64.tar.gz + tar xf cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64.tar.gz + + - name: Run CMake (without GUI) + run: | + export PATH=cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64/bin:$PATH + cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On + + - name: Run CMake (with GUI) + run: | + export PATH=cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64/bin:$PATH + cmake -S . -B cmake.output.gui -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On + + build: + + strategy: + matrix: + os: [ubuntu-22.04, macos-15] + include: + - xdist_n: auto + # FIXME: test_color_tty fails with xdist - see #13278 + - os: macos-15 + xdist_n: '1' + fail-fast: false # Prefer quick result + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Install missing software on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + + # packages for strict cfg checks + - name: Install missing software on ubuntu 22.04 (cfg) + if: matrix.os == 'ubuntu-22.04' + run: | + sudo apt-get install libcairo2-dev libcurl4-openssl-dev liblua5.3-dev libssl-dev libsqlite3-dev libcppunit-dev libsigc++-2.0-dev libgtk-3-dev libboost-all-dev libselinux-dev libwxgtk3.0-gtk3-dev xmlstarlet qtbase5-dev + + # coreutils contains "nproc" + - name: Install missing software on macos + if: contains(matrix.os, 'macos') + run: | + # pcre was removed from runner images in November 2022 + brew install coreutils pcre gnu-sed + + - name: Install missing Python packages on ubuntu + if: contains(matrix.os, 'ubuntu') + run: | + python3 -m pip install pip --upgrade + python3 -m pip install pytest + python3 -m pip install pytest-timeout + python3 -m pip install pytest-xdist + python3 -m pip install psutil + + # we need to use -break-system-packages --user because the common approaches do not work. + # using pip works but it appears to install the packages into a different Python installation so they are not found later on. + # using python3 -m pip without the additional flags fails since the packages are being managed by a different tool (brew) and that lacks some of the packages. + # using pipx also does not work. + - name: Install missing Python packages on macos + if: contains(matrix.os, 'macos') + run: | + python3 -m pip install --break-system-packages --user pip --upgrade + python3 -m pip install --break-system-packages --user pytest + python3 -m pip install --break-system-packages --user pytest-timeout + python3 -m pip install --break-system-packages --user pytest-xdist + python3 -m pip install --break-system-packages --user psutil + + - name: Build cppcheck + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror" HAVE_RULES=yes + + - name: Build test + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror" HAVE_RULES=yes testrunner + + - name: Run test + run: | + make -j$(nproc) HAVE_RULES=yes test + + # requires "gnu-sed" installed on macos + - name: Run extra tests + run: | + test/scripts/generate_and_run_more_tests.sh + + - name: Run test/cli + run: | + python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli + + # TODO: use the step below instead + # do not use pushd in this step since we go below the working directory + - name: Run test/cli (symlink) + run: | + cd .. + ln -s cppcheck 'cpp check' + cd 'cpp check/test/cli' + python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} + + # FIXME: proj2_test.py fails because of the relative path cleanups in ImportProject::setRelativePaths() + # It fails because the application path used as base path has its symlink resolved by getcwd(). + - name: Run test/cli (symlink) + if: false + run: | + ln -s . 'cpp check' + python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} 'cpp check/test/cli' + + - name: Run test/cli (-j2) + run: | + python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli + env: + TEST_CPPCHECK_INJECT_J: 2 + + - name: Run test/cli (--clang) + if: false + run: | + python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli + env: + TEST_CPPCHECK_INJECT_CLANG: clang + + - name: Run test/cli (--cppcheck-build-dir) + run: | + python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli + env: + TEST_CPPCHECK_INJECT_BUILDDIR: injected + + - name: Run cfg tests + if: matrix.os != 'ubuntu-22.04' + run: | + make -j$(nproc) checkcfg + + - name: Run cfg tests (strict) + if: matrix.os == 'ubuntu-22.04' + run: | + make -j$(nproc) checkcfg + env: + STRICT: 1 + + - name: Run --dump test + run: | + ./cppcheck test/testpreprocessor.cpp --dump + xmllint --noout test/testpreprocessor.cpp.dump + + - name: Validate + run: | + make -j$(nproc) checkCWEEntries validateXML + + - name: Test install + run: | + # this is only to test the "install" target - since we did not build with FILESDIR it would not work as intended + make DESTDIR=cppcheck-make-install FILESDIR=/share/Cppcheck install + rm -rf cppcheck-make-install + + - name: Test Signalhandler + run: | + cmake -S . -B build.cmake.signal -Werror=dev -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On + cmake --build build.cmake.signal --target test-signalhandler -- -j$(nproc) + # TODO: how to run this without copying the file? + cp build.cmake.signal/bin/test-s* . + python3 -m pytest -Werror --strict-markers -vv test/signal/test-signalhandler.py + rm test-signalhandler + + # no unix backtrace support on MacOs + - name: Test Stacktrace + if: contains(matrix.os, 'ubuntu') + run: | + cmake -S . -B build.cmake.stack -Werror=dev -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On + cmake --build build.cmake.stack --target test-stacktrace -- -j$(nproc) + # TODO: how to run this without copying the file? + cp build.cmake.stack/bin/test-s* . + python3 -m pytest -Werror --strict-markers -vv test/signal/test-stacktrace.py + rm test-stacktrace + + # TODO: move to scriptcheck.yml so these are tested with all Python versions? + - name: Test addons + run: | + set -x + ./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety addons/test/threadsafety + ./cppcheck --error-exitcode=1 --inline-suppr --addon=threadsafety --std=c++03 addons/test/threadsafety + ./cppcheck --error-exitcode=1 --inline-suppr --addon=misra addons/test/misra/crash*.c + ./cppcheck --error-exitcode=1 --inline-suppr --addon=misra --enable=information addons/test/misra/config*.c + + ./cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c + pushd addons/test + # We'll force C89 standard to enable an additional verification for + # rules 5.4 and 5.5 which have standard-dependent options. + ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 + python3 ../misra.py -verify misra/misra-test.c.dump + # Test slight MISRA differences in C11 standard + ../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test-c11.c --std=c11 --platform=unix64 + python3 ../misra.py -verify misra/misra-test-c11.c.dump + # TODO: do we need to verify something here? + ../../cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h + ../../cppcheck --dump misra/misra-test.cpp + python3 ../misra.py -verify misra/misra-test.cpp.dump + python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump + python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump + python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump + ../../cppcheck --addon=misra --enable=style --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c + ../../cppcheck --dump misc-test.cpp + python3 ../misc.py -verify misc-test.cpp.dump + ../../cppcheck --dump naming_test.c + python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump + ../../cppcheck --dump naming_test.cpp + python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump + + # TODO: run with "-n auto" when misra_test.py can be run in parallel + - name: test addons (Python) + if: matrix.os != 'ubuntu-22.04' + run: | + python3 -m pytest -Werror --strict-markers -vv -n 1 addons/test + env: + PYTHONPATH: ./addons + + # TODO: run with "-n auto" when misra_test.py can be run in parallel + # we cannot specify -Werror since xml/etree/ElementTree.py in Python 3.10 contains an unclosed file + - name: test addons (Python) + if: matrix.os == 'ubuntu-22.04' + run: | + python3 -m pytest --strict-markers -vv -n 1 addons/test + env: + PYTHONPATH: ./addons + + - name: Build democlient + if: matrix.os == 'ubuntu-22.04' + run: | + warnings="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar" + g++ $warnings -c -Ilib -Iexternals/tinyxml2 democlient/democlient.cpp + + - name: Test disabled executors + if: matrix.os == 'ubuntu-22.04' + run: | + g++ -Ilib -c cli/threadexecutor.cpp -DDISALLOW_THREAD_EXECUTOR + test -z "$(nm threadexecutor.o)" + g++ -Ilib -c cli/processexecutor.cpp -DDISALLOW_PROCESS_EXECUTOR + test -z "$(nm processexecutor.o)" + # TODO: test NO_* defines + + - name: Show all ignored files + if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched + run: | + git ls-files --others --ignored --exclude-standard + + - name: Check for changed and unversioned files + run: | + # TODO: how to do this with a single command? + git status --ignored=no + git status --ignored=no | grep -q 'working tree clean' + + selfcheck: + needs: build # wait for all tests to be successful first + + runs-on: ubuntu-22.04 # run on the latest image only + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + sudo apt-get install libboost-container-dev + + - name: Self check (build) + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + # compile with verification and ast matchers + make -j$(nproc) CXXOPTS="-Werror -g -O2" CPPOPTS="-DCHECK_INTERNAL -DHAVE_BOOST" MATCHCOMPILER=yes VERIFY=1 + + - name: CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On + + - name: Generate dependencies + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps triage-build-ui-deps + + - name: Self check + run: | + ./selfcheck.sh diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml new file mode 100644 index 00000000000..c993c57753a --- /dev/null +++ b/.github/workflows/CI-windows.yml @@ -0,0 +1,338 @@ +# 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: CI-windows + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +defaults: + run: + shell: cmd + +jobs: + + build_qt: + strategy: + matrix: + os: [windows-2022, windows-2025] + qt_ver: [6.10.0] + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Install Qt ${{ matrix.qt_ver }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ matrix.qt_ver }} + modules: 'qtcharts' + setup-python: 'false' + cache: true + aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available + + - name: Run CMake + run: | + rem TODO: enable rules? + rem specify Release build so matchcompiler is used + cmake -S . -B build -Werror=dev -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! + + - name: Build GUI release + run: | + cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel! + + - name: Deploy GUI + run: | + windeployqt build\bin\Release || exit /b !errorlevel! + del build\bin\Release\cppcheck-gui.ilk || exit /b !errorlevel! + del build\bin\Release\cppcheck-gui.pdb || exit /b !errorlevel! + + # TODO: run GUI tests + + - name: Run CMake install + run: | + cmake --build build --target install + + build_cmake_cxxstd: + strategy: + matrix: + os: [windows-2022, windows-2025] + cxxstd: [14, 17, 20] + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Run CMake + run: | + cmake -S . -B build.cxxstd -Werror=dev -G "Visual Studio 17 2022" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.cxxstd }} -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! + + - name: Build + run: | + cmake --build build.cxxstd --config Debug || exit /b !errorlevel! + + build_cmake_minimum: + + runs-on: windows-2022 # use the oldest available runner + + env: + CMAKE_VERSION: 3.22 + CMAKE_VERSION_FULL: 3.22.6 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install CMake + run: | + curl -fsSL https://cmake.org/files/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64.zip -o cmake.zip || exit /b !errorlevel! + 7z x cmake.zip || exit /b !errorlevel! + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: 6.10.0 + modules: 'qtcharts' + setup-python: 'false' + cache: true + aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available + + - name: Run CMake (without GUI) + run: | + :: TODO: enable DHAVE_RULES? + cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64\bin\cmake.exe -S . -B cmake.output -G "Visual Studio 17 2022" -A x64 -DHAVE_RULES=Off -DBUILD_TESTING=On + + - name: Run CMake (with GUI) + run: | + :: TODO: enable DHAVE_RULES? + cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64\bin\cmake.exe -S . -B cmake.output.gui -G "Visual Studio 17 2022" -A x64 -DHAVE_RULES=Off -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On + + build: + strategy: + matrix: + os: [windows-2022, windows-2025] + config: [debug, release] + fail-fast: false + + runs-on: ${{ matrix.os }} + + env: + # see https://www.pcre.org/original/changelog.txt + PCRE_VERSION: 8.45 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python + if: matrix.config == 'release' + uses: actions/setup-python@v5 + with: + python-version: '3.14' + check-latest: true + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Cache PCRE + id: cache-pcre + uses: actions/cache@v4 + with: + path: | + externals\pcre.h + externals\pcre.lib + externals\pcre64.lib + key: pcre-${{ env.PCRE_VERSION }}-x64-bin-win + + - name: Download PCRE + if: steps.cache-pcre.outputs.cache-hit != 'true' + run: | + curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + + - name: Install PCRE + if: steps.cache-pcre.outputs.cache-hit != 'true' + run: | + @echo on + 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + cd pcre-%PCRE_VERSION% || exit /b !errorlevel! + git apply --ignore-space-change ..\externals\pcre.patch || exit /b !errorlevel! + cmake . -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPCRE_BUILD_PCRECPP=Off -DPCRE_BUILD_TESTS=Off -DPCRE_BUILD_PCREGREP=Off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! + nmake || exit /b !errorlevel! + copy pcre.h ..\externals || exit /b !errorlevel! + copy pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! + env: + CL: /MP + + - name: Install missing Python packages + if: matrix.config == 'release' + run: | + python -m pip install pip --upgrade || exit /b !errorlevel! + python -m pip install pytest || exit /b !errorlevel! + python -m pip install pytest-custom_exit_code || exit /b !errorlevel! + python -m pip install pytest-timeout || exit /b !errorlevel! + python -m pip install pytest-xdist || exit /b !errorlevel! + python -m pip install psutil || exit /b !errorlevel! + + - name: Build CLI debug configuration using MSBuild + if: matrix.config == 'debug' + run: | + :: cmake --build build --target check --config Debug || exit /b !errorlevel! + msbuild -m cppcheck.sln /p:Configuration=Debug-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel! + env: + _CL_: /WX + + - name: Run Debug test + if: matrix.config == 'debug' + run: .\bin\debug\testrunner.exe || exit /b !errorlevel! + + - name: Build CLI release configuration using MSBuild + if: matrix.config == 'release' + run: | + :: cmake --build build --target check --config Release || exit /b !errorlevel! + msbuild -m cppcheck.sln /p:Configuration=Release-PCRE;Platform=x64 -maxcpucount || exit /b !errorlevel! + env: + _CL_: /WX + + - name: Run Release test + if: matrix.config == 'release' + run: .\bin\testrunner.exe || exit /b !errorlevel! + + - name: Prepare test/cli + if: matrix.config == 'release' + run: | + :: since FILESDIR is not set copy the binary to the root so the addons are found + :: copy .\build\bin\Release\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! + copy .\bin\cppcheck.exe .\cppcheck.exe || exit /b !errorlevel! + copy .\bin\cppcheck-core.dll .\cppcheck-core.dll || exit /b !errorlevel! + + - name: Run test/cli + if: matrix.config == 'release' + run: | + python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! + + - name: Run test/cli (-j2) + if: matrix.config == 'release' + run: | + python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! + env: + TEST_CPPCHECK_INJECT_J: 2 + + # TODO: install clang + - name: Run test/cli (--clang) + if: false # matrix.config == 'release' + run: | + python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! + env: + TEST_CPPCHECK_INJECT_CLANG: clang + + - name: Run test/cli (--cppcheck-build-dir) + if: matrix.config == 'release' + run: | + python -m pytest -Werror --strict-markers -vv -n auto test/cli || exit /b !errorlevel! + env: + TEST_CPPCHECK_INJECT_BUILDDIR: injected + + # TODO: test with Release configuration? + - name: Test SEH wrapper + if: matrix.config == 'release' + run: | + cmake -S . -B build.cmake.seh -Werror=dev -DBUILD_TESTING=On -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! + cmake --build build.cmake.seh --target test-sehwrapper || exit /b !errorlevel! + :: TODO: how to run this without copying the file? + copy build.cmake.seh\bin\Debug\test-sehwrapper.exe . || exit /b !errorlevel! + python3 -m pytest -Werror --strict-markers -vv test/seh/test-sehwrapper.py || exit /b !errorlevel! + del test-sehwrapper.exe || exit /b !errorlevel! + + - name: Test addons + if: matrix.config == 'release' + run: | + echo on + .\cppcheck --addon=threadsafety addons\test\threadsafety || exit /b !errorlevel! + .\cppcheck --addon=threadsafety --std=c++03 addons\test\threadsafety || exit /b !errorlevel! + .\cppcheck --addon=misra --enable=style --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c || exit /b !errorlevel! + cd addons\test + rem We'll force C89 standard to enable an additional verification for + rem rules 5.4 and 5.5 which have standard-dependent options. + ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 || exit /b !errorlevel! + python3 ..\misra.py -verify misra\misra-test.c.dump || exit /b !errorlevel! + rem Test slight MISRA differences in C11 standard + ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test-c11.c --std=c11 --platform=unix64 || exit /b !errorlevel! + python3 ..\misra.py -verify misra\misra-test-c11.c.dump || exit /b !errorlevel! + rem TODO: do we need to verify something here? + ..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra\misra-test.h || exit /b !errorlevel! + ..\..\cppcheck --dump misra\misra-test.cpp || exit /b !errorlevel! + python3 ..\misra.py -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_ascii.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_utf8.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_windows1250.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel! + ..\..\cppcheck --addon=misra --enable=style --platform=avr8 --error-exitcode=1 misra\misra-test-avr8.c || exit /b !errorlevel! + ..\..\cppcheck --dump misc-test.cpp || exit /b !errorlevel! + python3 ..\misc.py -verify misc-test.cpp.dump || exit /b !errorlevel! + ..\..\cppcheck --dump naming_test.c || exit /b !errorlevel! + rem TODO: fix this - does not fail on Linux + rem python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump || exit /b !errorlevel! + ..\..\cppcheck --dump naming_test.cpp || exit /b !errorlevel! + python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump || exit /b !errorlevel! + + # TODO: run with "-n auto" when misra_test.py can be run in parallel + - name: test addons (Python) + if: matrix.config == 'release' + run: | + python -m pytest -Werror --strict-markers -vv -n 1 addons/test || exit /b !errorlevel! + env: + PYTHONPATH: ./addons + + - name: Check Windows test syntax + if: matrix.config == 'debug' + run: | + cd test\cfg + cl.exe windows.cpp -DUNICODE=1 -D_UNICODE=1 /Zs || exit /b !errorlevel! + cl.exe mfc.cpp /EHsc /Zs || exit /b !errorlevel! + + - name: Show all ignored files + if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched + run: | + git ls-files --others --ignored --exclude-standard || exit /b !errorlevel! + + - name: Check for changed and unversioned files + run: | + :: TODO: how to do this with a single command? + git status --ignored=no + :: TODO: make this work + :: git status --ignored=no | grep -q 'working tree clean' diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml new file mode 100644 index 00000000000..977d3f05337 --- /dev/null +++ b/.github/workflows/asan.yml @@ -0,0 +1,145 @@ +# 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: address sanitizer + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + env: + QT_VERSION: 6.10.0 + ASAN_OPTIONS: detect_stack_use_after_return=1 + LSAN_OPTIONS: suppressions=lsan-suppr.txt:print_suppressions=0 + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.14' + check-latest: true + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils + sudo apt-get install -y libcups2-dev # required for Qt6PrintSupport in CMake since Qt 6.7.3 + + - name: Install clang + run: | + sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 21 + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: 'false' + cache: true + + - name: Install missing Python packages + run: | + python3 -m pip install pip --upgrade + python3 -m pip install pytest + python3 -m pip install pytest-timeout + python3 -m pip install pytest-xdist + python3 -m pip install psutil + + - name: CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + env: + CC: clang-21 + CXX: clang++-21 + + - name: Build cppcheck + run: | + cmake --build cmake.output --target cppcheck -- -j $(nproc) + + - name: Build test + run: | + cmake --build cmake.output --target testrunner -- -j $(nproc) + + - name: Build GUI tests + run: | + cmake --build cmake.output --target gui-tests -- -j $(nproc) + + - name: Run tests + run: ./cmake.output/bin/testrunner + + - name: Run cfg tests + run: | + cmake --build cmake.output --target checkcfg -- -j $(nproc) + + - name: Run CTest + run: | + cp lsan-suppr.txt cmake.output/bin + ctest --test-dir cmake.output --output-on-failure -j$(nproc) + + - name: Run test/cli + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + + - name: Run test/cli (-j2) + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_J: 2 + + - name: Run test/cli (--clang) + if: false + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_CLANG: clang + + - name: Run test/cli (--cppcheck-build-dir) + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_BUILDDIR: injected + + - name: Generate dependencies + if: false + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps triage-build-ui-deps + + # TODO: this is currently way too slow (~60 minutes) to enable it + # TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError + - name: Self check + if: false + run: | + ./selfcheck_san.sh ./cmake.output diff --git a/.github/workflows/buildman.yml b/.github/workflows/buildman.yml new file mode 100644 index 00000000000..b0b399dd851 --- /dev/null +++ b/.github/workflows/buildman.yml @@ -0,0 +1,65 @@ +# 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: Build manual + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + convert_via_pandoc: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - run: | + mkdir output + + - uses: docker://pandoc/latex:3.6.3 + with: + args: --output=output/manual.html man/manual.md + + - uses: docker://pandoc/latex:3.6.3 + with: + args: --output=output/manual.pdf man/manual.md + + - uses: docker://pandoc/latex:3.6.3 + with: + args: --output=output/manual-premium.pdf man/manual-premium.md + + - uses: actions/upload-artifact@v4 + with: + name: output + path: output + + manpage: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install -y xsltproc docbook-xsl + + - name: build manpage + run: | + make man + + - uses: actions/upload-artifact@v4 + with: + name: cppcheck.1 + path: cppcheck.1 diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml new file mode 100644 index 00000000000..7b462c688f0 --- /dev/null +++ b/.github/workflows/cifuzz.yml @@ -0,0 +1,34 @@ +# 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: CIFuzz + +on: [pull_request] + +permissions: + contents: read + +jobs: + Fuzzing: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'danmar' }} + steps: + - name: Build Fuzzers + id: build + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'cppcheck' + dry-run: false + language: c++ + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'cppcheck' + fuzz-seconds: 300 + dry-run: false + language: c++ + - name: Upload Crash + uses: actions/upload-artifact@v4 + if: failure() && steps.build.outcome == 'success' + with: + name: artifacts + path: ./out/artifacts diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000000..12e758d2c9e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,52 @@ +# 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: "CodeQL" + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-22.04 + permissions: + security-events: write + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['cpp', 'python'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: Build cppcheck + if: matrix.language == 'cpp' + run: | + make -j$(nproc) CXXOPTS="-Werror" HAVE_RULES=yes CPPCHK_GLIBCXX_DEBUG= cppcheck + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..13f56172a80 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,71 @@ +# 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: Coverage + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ runner.os }} + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install libxml2-utils lcov + + - name: Install missing Python packages on ubuntu + run: | + python -m pip install pip --upgrade + python -m pip install lcov_cobertura + + - name: Compile instrumented + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror -g -fprofile-arcs -ftest-coverage" HAVE_RULES=yes CPPCHK_GLIBCXX_DEBUG= all + + - name: Run instrumented tests + run: | + ./testrunner + test/cfg/runtests.sh + + - name: Generate coverage report + run: | + gcov lib/*.cpp -o lib/ + lcov --directory ./ --capture --output-file lcov_tmp.info -b ./ + lcov --extract lcov_tmp.info "$(pwd)/*" --output-file lcov.info + genhtml lcov.info -o coverage_report --frame --legend --demangle-cpp + + - uses: actions/upload-artifact@v4 + with: + name: Coverage results + path: coverage_report + + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + # file: ./coverage.xml # optional + flags: unittests # optional + name: ${{ github.repository }} # optional + fail_ci_if_error: true # optional (default = false): diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml new file mode 100644 index 00000000000..3c07b61d7c7 --- /dev/null +++ b/.github/workflows/coverity.yml @@ -0,0 +1,41 @@ +# 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: Coverity + +on: + schedule: + - cron: "0 0 * * *" + +permissions: + contents: read + +jobs: + scan: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'danmar' }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev libboost-container-dev + - name: Download Coverity build tool + run: | + wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=cppcheck" -O coverity_tool.tar.gz + mkdir coverity_tool + tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool + - name: Build with Coverity build tool + run: | + export PATH=`pwd`/coverity_tool/bin:$PATH + cov-build --dir cov-int make CPPCHK_GLIBCXX_DEBUG= + - name: Submit build result to Coverity Scan + run: | + tar czvf cov.tar.gz cov-int + curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \ + --form email=daniel.marjamaki@gmail.com \ + --form file=@cov.tar.gz \ + --form version="Commit $GITHUB_SHA" \ + --form description="Development" \ + https://scan.coverity.com/builds?project=cppcheck diff --git a/.github/workflows/cppcheck-premium.yml b/.github/workflows/cppcheck-premium.yml new file mode 100644 index 00000000000..5cb63ca4d5e --- /dev/null +++ b/.github/workflows/cppcheck-premium.yml @@ -0,0 +1,72 @@ +# 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: cppcheck-premium + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + workflow_dispatch: + inputs: + premium_version: + description: 'Cppcheck Premium version' + +permissions: + contents: read + security-events: write + +jobs: + + build: + runs-on: ubuntu-24.04 # run on the latest image only + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Download cppcheckpremium release + run: | + premium_version=${{ inputs.premium_version }} + if [ -z $premium_version ]; then + premium_version=25.8.3 + #wget https://files.cppchecksolutions.com/devdrop/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz + wget https://files.cppchecksolutions.com/$premium_version/ubuntu-24.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz + else + wget https://files.cppchecksolutions.com/$premium_version/ubuntu-24.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz + fi + tar xzf cppcheckpremium.tar.gz + mv cppcheckpremium-$premium_version cppcheckpremium + + - name: Generate a license file + run: | + echo cppcheck > cppcheck.lic + echo 261231 >> cppcheck.lic + echo 80000 >> cppcheck.lic + echo 4b64673f03fb6230 >> cppcheck.lic + echo path:lib >> cppcheck.lic + + - name: Check + run: | + cppcheckpremium/premiumaddon --check-loc-license cppcheck.lic > cppcheck-premium-loc + cppcheckpremium/cppcheck --premium=safety-off -j$(nproc) -D__GNUC__ -D__CPPCHECK__ --suppressions-list=cppcheckpremium-suppressions --platform=unix64 --enable=style --premium=misra-c++-2023 --premium=cert-c++-2016 --inline-suppr lib --error-exitcode=0 --output-format=sarif 2> results.sarif + + - name: Cat results + run: | + #sed -i 's|"security-severity":.*||' results.sarif + cat results.sarif + + - uses: actions/upload-artifact@v4 + with: + name: results + path: results.sarif + + - name: Upload report + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif + category: cppcheckpremium diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000000..fd491c0ec0e --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,55 @@ +# 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: format + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + env: + UNCRUSTIFY_VERSION: 0.80.1 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Cache uncrustify + uses: actions/cache@v4 + id: cache-uncrustify + with: + path: | + ~/uncrustify + key: ${{ runner.os }}-uncrustify-${{ env.UNCRUSTIFY_VERSION }} + + - name: build uncrustify + if: steps.cache-uncrustify.outputs.cache-hit != 'true' + run: | + set -x + wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-${{ env.UNCRUSTIFY_VERSION }}.tar.gz + tar xzvf uncrustify-${{ env.UNCRUSTIFY_VERSION }}.tar.gz + cd uncrustify-uncrustify-${{ env.UNCRUSTIFY_VERSION }} + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + cmake --build build -- -j$(nproc) -s + mkdir ~/uncrustify + cp build/uncrustify ~/uncrustify/ + + - name: Uncrustify check + run: | + UNCRUSTIFY=~/uncrustify/uncrustify ./runformat + git diff + git diff | diff - /dev/null &> /dev/null diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml new file mode 100644 index 00000000000..fa9be0cbba8 --- /dev/null +++ b/.github/workflows/iwyu.yml @@ -0,0 +1,271 @@ +# 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: include-what-you-use + +on: + schedule: + - cron: '0 0 * * 0' + workflow_dispatch: + +permissions: + contents: read + +jobs: + iwyu: + + strategy: + matrix: + # "opensuse/tumbleweed:latest" / "fedora:latest" / "debian:unstable" / "archlinux:latest" + include: + - os: ubuntu-22.04 + image: "fedora:latest" + stdlib: libstdc++ + clang_inc: '-isystem/usr/lib/clang/20/include' + # TODO: disable because it currently fails with "error: tried including but didn't find libc++'s header." + #- os: ubuntu-22.04 + # image: "fedora:latest" + # stdlib: libc++ + # clang_inc: '-isystem/usr/lib/clang/20/include' + - os: macos-26 + image: "" + stdlib: libc++ # no libstdc++ on macOS + mapping_file_opt: '-Xiwyu --mapping_file=$(realpath ./macos.imp)' + fail-fast: false + + runs-on: ${{ matrix.os }} + if: ${{ github.repository_owner == 'danmar' }} + + container: + image: ${{ matrix.image }} + + env: + QT_VERSION: 6.10.0 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software on debian/ubuntu + if: contains(matrix.image, 'debian') + run: | + apt-get update + apt-get install -y cmake clang make libpcre3-dev + apt-get install -y libgl-dev # fixes missing dependency for Qt in CMake + apt-get install -y iwyu + + - name: Install missing software on archlinux + if: contains(matrix.image, 'archlinux') + run: | + set -x + pacman -Sy + pacman -S cmake make clang pcre --noconfirm + pacman -S libglvnd --noconfirm # fixes missing dependency for Qt in CMake + pacman-key --init + pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com + pacman-key --lsign-key 3056513887B78AEB + pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm + echo "[chaotic-aur]" >> /etc/pacman.conf + echo "Include = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf + pacman -Sy + pacman -S include-what-you-use --noconfirm + ln -s iwyu-tool /usr/sbin/iwyu_tool + + - name: Install missing software on Fedora + if: contains(matrix.image, 'fedora') + run: | + dnf install -y cmake clang pcre-devel + dnf install -y libglvnd-devel # fixes missing dependency for Qt in CMake + dnf install -y p7zip-plugins # required as fallback for py7zr in Qt installation + dnf install -y python3-pip # fixes missing pip module in jurplel/install-qt-action + dnf install -y python3-devel # fixes building of wheels for jurplel/install-qt-action + dnf install -y cairo-devel gtk3-devel libcurl-devel lua-devel openssl-devel python3-devel sqlite-devel boost-devel cppunit-devel libsigc++20-devel # for strict cfg checks + dnf install -y iwyu + ln -s iwyu_tool.py /usr/bin/iwyu_tool + + - name: Install missing software on Fedora (libc++) + if: contains(matrix.image, 'fedora') && matrix.stdlib == 'libc++' + run: | + dnf install -y libcxx-devel + + - name: Install missing software on OpenSUSE + if: contains(matrix.image, 'opensuse') + run: | + zypper install -y cmake clang pcre-devel + zypper install -y include-what-you-use-tools + ln -s iwyu_tool.py /usr/bin/iwyu_tool + + # coreutils contains "nproc" + - name: Install missing software on macOS + if: contains(matrix.os, 'macos') + run: | + brew install include-what-you-use pcre coreutils + # on Apple Silicon files are symlinked under /opt/homebrew/bin + ln -s /opt/homebrew/bin/iwyu_tool.py /usr/local/bin/iwyu_tool + + # Fails on OpenSUSE: + # Warning: Failed to restore: Tar failed with error: Unable to locate executable file: tar. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable. + # Also the shell is broken afterwards: + # OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown + # + # On macos-26 we need to perform the Python setup because the default installation is managed externally managed + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: ${{ contains(matrix.os, 'macos') }} + install-deps: false + cache: true + + - name: Generate macOS mappings + if: contains(matrix.os, 'macos') + run: | + set -x + + wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-apple-libc.py + python3 iwyu-mapgen-apple-libc.py $(xcrun --show-sdk-path)/usr/include > macos.imp + + - name: Prepare CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.stdlib == 'libc++' }} + env: + CC: clang + CXX: clang++ + + # Fails on Debian: + # /__w/cppcheck/Qt/6.7.0/gcc_64/libexec/rcc: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory + - name: Prepare CMake dependencies + run: | + # make sure the auto-generated GUI sources exist + make -C cmake.output autogen + # make sure the precompiled headers exist + #make -C cmake.output/cli cmake_pch.hxx.pch + #make -C cmake.output/gui cmake_pch.hxx.pch + #make -C cmake.output/lib cmake_pch.hxx.pch + #make -C cmake.output/test cmake_pch.hxx.pch + # make sure the auto-generated GUI dependencies exist + make -C cmake.output gui-build-deps + make -C cmake.output triage-build-ui-deps + + - name: iwyu_tool + run: | + # TODO: remove -stdlib= - it should have been taken from the compilation database + iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -stdlib=${{ matrix.stdlib }} ${{ matrix.mapping_file_opt }} ${{ matrix.clang_inc }} > iwyu.log + + # TODO: run with all configurations + - name: test/cfg + if: matrix.stdlib == 'libstdc++' + run: | + # TODO: redirect to log + ./test/cfg/runtests.sh + env: + IWYU: include-what-you-use + IWYU_CLANG_INC: ${{ matrix.clang_inc }} + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Compilation Database (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }}) + path: ./cmake.output/compile_commands.json + + - uses: actions/upload-artifact@v4 + if: ${{ contains(matrix.os, 'macos') && (success() || failure()) }} + with: + name: macOS Mappings + path: | + ./iwyu-mapgen-apple-libc.py + ./macos.imp + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Logs (include-what-you-use - ${{ matrix.os }} ${{ matrix.stdlib }}) + path: ./*.log + + clang-include-cleaner: + + strategy: + matrix: + stdlib: [libstdc++, libc++] + include: + - stdlib: libstdc++ + use_libcxx: Off + - stdlib: libc++ + use_libcxx: On + fail-fast: false + + runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'danmar' }} + + env: + QT_VERSION: 6.10.0 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software + run: | + sudo apt-get update + sudo apt-get install -y cmake make libpcre3-dev + sudo apt-get install -y libgl-dev # missing dependency for using Qt in CMake + + - name: Install clang + run: | + sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 22 + sudo apt-get install -y clang-tools-22 + + - name: Install libc++ + if: matrix.stdlib == 'libc++' + run: | + sudo apt-get install -y libc++-22-dev + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: 'false' + install-deps: false + cache: true + + - name: Prepare CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }} + env: + CC: clang-22 + CXX: clang++-22 + + - name: Prepare CMake dependencies + run: | + # make sure the auto-generated GUI sources exist + make -C cmake.output autogen + # make sure the precompiled headers exist + #make -C cmake.output/cli cmake_pch.hxx.pch + #make -C cmake.output/gui cmake_pch.hxx.pch + #make -C cmake.output/lib cmake_pch.hxx.pch + #make -C cmake.output/test cmake_pch.hxx.pch + # make sure the auto-generated GUI dependencies exist + make -C cmake.output gui-build-deps + + - name: clang-include-cleaner + run: | + # TODO: run multi-threaded + find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-22 --print=changes --extra-arg=-w --extra-arg=-stdlib=${{ matrix.stdlib }} -p cmake.output > clang-include-cleaner.log 2>&1 + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Compilation Database (clang-include-cleaner - ${{ matrix.stdlib }}) + path: ./cmake.output/compile_commands.json + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Logs (clang-include-cleaner - ${{ matrix.stdlib }}) + path: ./*.log diff --git a/.github/workflows/release-windows-mingw.yml b/.github/workflows/release-windows-mingw.yml new file mode 100644 index 00000000000..3b9b836347f --- /dev/null +++ b/.github/workflows/release-windows-mingw.yml @@ -0,0 +1,69 @@ +# 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: release-windows-mingw + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +defaults: + run: + shell: msys2 {0} + +jobs: + # TODO: add CMake build + build_mingw: + strategy: + matrix: + # only use the latest windows-* as the installed toolchain is identical + os: [windows-2025] + fail-fast: false + + runs-on: ${{ matrix.os }} + + timeout-minutes: 19 # max + 3*std of the last 7K runs + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + with: + release: false # use pre-installed + # TODO: install mingw-w64-x86_64-make and use mingw32.make instead - currently fails with "Windows Subsystem for Linux has no installed distributions." + install: >- + mingw-w64-x86_64-lld + make + mingw-w64-x86_64-gcc + python + + - name: Build cppcheck + run: | + export PATH="/mingw64/lib/ccache/bin:$PATH" + # set RDYNAMIC to work around broken MinGW detection + make VERBOSE=1 RDYNAMIC=-lshlwapi -j$(nproc) CXXFLAGS=-O2 MATCHCOMPILER=yes cppcheck + + - name: Package + run: | + mkdir cppcheck-mingw + cp cppcheck.exe cppcheck-mingw/ + cp -R cfg platforms cppcheck-mingw/ + cp /mingw64/bin/libgcc_s_seh-1.dll cppcheck-mingw/ + cp /mingw64/bin/libstdc*.dll cppcheck-mingw/ + cp /mingw64/bin/libwinpthread-1.dll cppcheck-mingw/ + + - uses: actions/upload-artifact@v4 + with: + name: cppcheck-mingw + path: cppcheck-mingw diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml new file mode 100644 index 00000000000..20868c1c607 --- /dev/null +++ b/.github/workflows/release-windows.yml @@ -0,0 +1,209 @@ +# 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: release-windows + +on: + push: + tags: + - '2.*' + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +permissions: + contents: read + +defaults: + run: + shell: cmd + +jobs: + + build: + + runs-on: windows-2025 + if: ${{ github.repository_owner == 'danmar' }} + + env: + # see https://www.pcre.org/original/changelog.txt + PCRE_VERSION: 8.45 + QT_VERSION: 6.10.0 + BOOST_MINOR_VERSION: 89 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + + - name: Download PCRE + run: | + curl -fsSL https://github.com/pfultz2/pcre/archive/refs/tags/%PCRE_VERSION%.zip -o pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + + - name: Install PCRE + run: | + @echo on + 7z x pcre-%PCRE_VERSION%.zip || exit /b !errorlevel! + cd pcre-%PCRE_VERSION% || exit /b !errorlevel! + git apply --ignore-space-change ..\externals\pcre.patch || exit /b !errorlevel! + cmake . -G "Visual Studio 17 2022" -A x64 -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! + msbuild -m PCRE.sln -p:Configuration=Release -p:Platform=x64 || exit /b !errorlevel! + copy pcre.h ..\externals || exit /b !errorlevel! + copy Release\pcre.lib ..\externals\pcre64.lib || exit /b !errorlevel! + + - name: Download Boost + run: | + curl -fsSL https://archives.boost.io/release/1.%BOOST_MINOR_VERSION%.0/source/boost_1_%BOOST_MINOR_VERSION%_0.7z -o boost.zip || exit /b !errorlevel! + + - name: Install Boost + run: | + @echo on + 7z x boost.zip boost_1_%BOOST_MINOR_VERSION%_0/boost || exit /b !errorlevel! + ren boost_1_%BOOST_MINOR_VERSION%_0 boost || exit /b !errorlevel! + + # available modules: https://github.com/miurahr/aqtinstall/blob/master/docs/getting_started.rst#installing-modules + # available tools: https://github.com/miurahr/aqtinstall/blob/master/docs/getting_started.rst#installing-tools + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: 'false' + tools: 'tools_opensslv3_x64' + aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available + + # TODO: build with multiple threads + - name: Build x64 release GUI + run: | + :: TODO: enable rules? + :: specify Release build so matchcompiler is used + cmake -S . -B build -Werror=dev -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=Off -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On -DUSE_BOOST=ON -DBOOST_INCLUDEDIR=%GITHUB_WORKSPACE%\boost -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! + cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel! + + # TODO: package PDBs + - name: Deploy app + run: | + windeployqt build\bin\Release || exit /b !errorlevel! + del build\bin\Release\cppcheck-gui.ilk || exit /b !errorlevel! + del build\bin\Release\cppcheck-gui.pdb || exit /b !errorlevel! + + - uses: actions/upload-artifact@v4 + with: + name: deploy + path: build\bin\Release + + - name: Matchcompiler + run: python tools\matchcompiler.py --write-dir lib || exit /b !errorlevel! + + # TODO: build with multiple threads + - name: Build CLI x64 release configuration using MSBuild + run: msbuild -m cppcheck.sln -t:cli -p:Configuration=Release-PCRE -p:Platform=x64 -p:HaveBoost=HAVE_BOOST -p:BoostInclude=%GITHUB_WORKSPACE%\boost || exit /b !errorlevel! + env: + _CL_: /WX + + - uses: actions/upload-artifact@v4 + with: + name: bin + path: bin + + - name: Install missing Python packages + run: | + pip install -U pyinstaller || exit /b !errorlevel! + + # TODO: include in installer? + - name: Compile misra.py executable + run: | + cd addons || exit /b !errorlevel! + pyinstaller --hidden-import xml --hidden-import xml.etree --hidden-import xml.etree.ElementTree misra.py || exit /b !errorlevel! + del *.spec || exit /b !errorlevel! + + # TODO: include in installer? + - name: Compile cppcheck-htmlreport executable + run: | + cd htmlreport || exit /b !errorlevel! + pyinstaller cppcheck-htmlreport || exit /b !errorlevel! + del *.spec || exit /b !errorlevel! + + # TODO: test the compiled Python files + + - name: Collect files + run: | + @echo on + move build\bin\Release win_installer\files || exit /b !errorlevel! + copy AUTHORS win_installer\files\authors.txt || exit /b !errorlevel! + copy win_installer\GPLv3.txt win_installer\files\ || exit /b !errorlevel! + copy externals\picojson\LICENSE win_installer\files\picojson-license.txt || exit /b !errorlevel! + copy externals\simplecpp\LICENSE win_installer\files\simplecpp-license.txt || exit /b !errorlevel! + copy externals\tinyxml2\LICENSE win_installer\files\tinyxml2-license.txt || exit /b !errorlevel! + copy addons\dist\misra\*.* win_installer\files\addons || exit /b !errorlevel! + copy bin\cppcheck.exe win_installer\files || exit /b !errorlevel! + copy bin\cppcheck-core.dll win_installer\files || exit /b !errorlevel! + :: mkdir win_installer\files\help || exit /b !errorlevel! + xcopy /s gui\help win_installer\files\help || exit /b !errorlevel! + copy gui\help\online-help.qhc win_installer\files\ || exit /b !errorlevel! + copy gui\help\online-help.qch win_installer\files\ || exit /b !errorlevel! + del win_installer\files\cfg\*.rng || exit /b !errorlevel! + del win_installer\files\platforms\*.rng || exit /b !errorlevel! + del win_installer\files\translations\*.qm || exit /b !errorlevel! + move build\gui\*.qm win_installer\files\translations || exit /b !errorlevel! + copy htmlreport\dist\cppcheck-htmlreport\*.* win_installer\files || exit /b !errorlevel! + :: copy libcrypto-3-x64.dll and libssl-3-x64.dll + copy %RUNNER_WORKSPACE%\Qt\Tools\OpenSSLv3\Win_x64\bin\lib*.dll win_installer\files || exit /b !errorlevel! + + - uses: actions/upload-artifact@v4 + with: + name: collect + path: win_installer\files + + - name: Build Installer + run: | + cd win_installer || exit /b !errorlevel! + :: Read ProductVersion + for /f "tokens=4 delims= " %%a in ('find "ProductVersion" productInfo.wxi') do set PRODUCTVER=%%a + :: Remove double quotes + set PRODUCTVER=%PRODUCTVER:"=% + @echo ProductVersion="%PRODUCTVER%" || exit /b !errorlevel! + msbuild -m cppcheck.wixproj -p:Platform=x64,ProductVersion=%PRODUCTVER%.${{ github.run_number }} || exit /b !errorlevel! + + - uses: actions/upload-artifact@v4 + with: + name: installer + path: win_installer/Build/ + + - name: Clean up deploy + run: | + @echo on + :: del win_installer\files\addons\*.dll || exit /b !errorlevel! + del win_installer\files\addons\*.doxyfile || exit /b !errorlevel! + del win_installer\files\addons\*.md || exit /b !errorlevel! + :: del win_installer\files\addons\*.pyd || exit /b !errorlevel! + :: del win_installer\files\addons\base_library.zip || exit /b !errorlevel! + rmdir /s /q win_installer\files\addons\test || exit /b !errorlevel! + rmdir /s /q win_installer\files\addons\doc || exit /b !errorlevel! + :: rmdir /s /q win_installer\files\bearer || exit /b !errorlevel! + rmdir /s /q win_installer\files\generic || exit /b !errorlevel! + rmdir /s /q win_installer\files\help || exit /b !errorlevel! + rmdir /s /q win_installer\files\iconengines || exit /b !errorlevel! + rmdir /s /q win_installer\files\imageformats || exit /b !errorlevel! + rmdir /s /q win_installer\files\networkinformation || exit /b !errorlevel! + :: rmdir /s /q win_installer\files\printsupport || exit /b !errorlevel! + rmdir /s /q win_installer\files\sqldrivers || exit /b !errorlevel! + rmdir /s /q win_installer\files\tls || exit /b !errorlevel! + ren win_installer\files\translations lang || exit /b !errorlevel! + del win_installer\files\d3dcompiler_47.dll || exit /b !errorlevel! + del win_installer\files\dxcompiler.dll || exit /b !errorlevel! + del win_installer\files\dxil.dll || exit /b !errorlevel! + del win_installer\files\dmake.exe || exit /b !errorlevel! + del win_installer\files\dmake.pdb || exit /b !errorlevel! + :: del win_installer\files\libEGL.dll || exit /b !errorlevel! + :: del win_installer\files\libGLESv2.dll || exit /b !errorlevel! + del win_installer\files\opengl32sw.dll || exit /b !errorlevel! + del win_installer\files\Qt6Svg.dll || exit /b !errorlevel! + del win_installer\files\vc_redist.x64.exe || exit /b !errorlevel! + + - uses: actions/upload-artifact@v4 + with: + name: portable + path: win_installer\files diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml new file mode 100644 index 00000000000..844b1d5c2f3 --- /dev/null +++ b/.github/workflows/scriptcheck.yml @@ -0,0 +1,222 @@ +# 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: scriptcheck + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ runner.os }} + + - name: Cache Cppcheck + uses: actions/cache@v4 + with: + path: cppcheck + key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} + + - name: build cppcheck + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror" + strip -s ./cppcheck + + scriptcheck: + + needs: build + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', '3.13', '3.14'] + include: + - python-version: '3.14' + python-latest: true + + fail-fast: false + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + # TODO: bailout on error + - name: Restore Cppcheck + uses: actions/cache@v4 + with: + path: cppcheck + key: ${{ runner.os }}-scriptcheck-cppcheck-${{ github.sha }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + check-latest: true + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install tidy libxml2-utils + + - name: Install missing software on ubuntu (Python 3) + run: | + # shellcheck cannot be installed via pip + # ERROR: Could not find a version that satisfies the requirement shellcheck (from versions: none) + # ERROR: No matching distribution found for shellcheck + sudo apt-get install shellcheck + python -m pip install pip --upgrade + python -m pip install natsort + python -m pip install pexpect + python -m pip install 'pylint<4.1.0' + python -m pip install unittest2 + python -m pip install pytest + python -m pip install pytest-xdist + python -m pip install pygments + python -m pip install requests + python -m pip install psutil + python -m pip install setuptools + + - name: run Shellcheck + if: matrix.python-latest + run: | + find . -name "*.sh" | xargs shellcheck --exclude SC2002,SC2013,SC2034,SC2035,SC2043,SC2046,SC2086,SC2089,SC2090,SC2129,SC2211,SC2231 + + - name: run pylint + if: matrix.python-latest + run: | + shopt -s globstar + pylint --jobs $(nproc) --py-version 3.7 addons/**/*.py htmlreport/cppcheck-htmlreport htmlreport/**/*.py test/**/*.py tools/**/*.py + + - name: check .json files + if: matrix.python-latest + run: | + find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null + + - name: Validate + if: matrix.python-latest + run: | + make -j$(nproc) validateCFG validatePlatforms validateRules + + - name: check python syntax + run: | + shopt -s globstar + python -m py_compile addons/**/*.py + python -m py_compile htmlreport/cppcheck-htmlreport + python -m py_compile htmlreport/**/*.py + python -m py_compile test/**/*.py + python -m py_compile tools/**/*.py + + - name: compile addons + run: | + python -m compileall ./addons + + - name: test matchcompiler + run: | + python test/tools/test_matchcompiler.py + env: + PYTHONPATH: ./tools + + # TODO: run with "-n auto" when misra_test.py can be run in parallel + # we cannot specify -Werror since xml/etree/ElementTree.py in Python 3.9/3.10 contains an unclosed file + - name: test addons + if: matrix.python-version == '3.9' || matrix.python-version == '3.10' + run: | + python -m pytest --strict-markers -vv -n 1 addons/test + env: + PYTHONPATH: ./addons + + # TODO: run with "-n auto" when misra_test.py can be run in parallel + - name: test addons + if: matrix.python-version != '3.9' && matrix.python-version != '3.10' + run: | + python -m pytest -Werror --strict-markers -vv -n 1 addons/test + env: + PYTHONPATH: ./addons + + - name: test htmlreport (standalone) + run: | + test/tools/htmlreport/test_htmlreport.py + test/tools/htmlreport/check.sh + + - name: test htmlreport (pip) + run: | + python -m venv venv + source venv/bin/activate + python -m pip install -U pip + pip install ./htmlreport/ + which cppcheck-htmlreport + PIP_PACKAGE_TEST=1 test/tools/htmlreport/test_htmlreport.py + # TODO: does not test the pip binary + test/tools/htmlreport/check.sh + + - name: test reduce + run: | + python -m pytest -Werror --strict-markers -vv test/tools/reduce_test.py + env: + PYTHONPATH: ./tools + + - name: test donate_cpu_lib + run: | + python -m pytest -Werror --strict-markers -vv test/tools/donate_cpu_lib_test.py + env: + PYTHONPATH: ./tools + + - name: test donate_cpu_server + run: | + python -m pytest -Werror --strict-markers -vv test/tools/donate_cpu_server_test.py + # TODO: why is this file generated? also should be in a temporary folder if possible + rm -f test/tools/donate-cpu-server.log + env: + PYTHONPATH: ./tools + + - name: Show all ignored files + if: false # TODO: currently lists all the contents of ignored folders - we only need what actually matched + run: | + git ls-files --others --ignored --exclude-standard + + - name: Check for changed and unversioned files + run: | + # TODO: how to do this with a single command? + git status --ignored=no + git status --ignored=no | grep -q 'working tree clean' + + dmake: + strategy: + matrix: + os: [ubuntu-22.04, macos-15, windows-2025] + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: run dmake + run: | + make -j3 CXXOPTS="-Werror" run-dmake + + - name: check diff + run: | + git diff --exit-code diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml new file mode 100644 index 00000000000..ec52b15f939 --- /dev/null +++ b/.github/workflows/selfcheck.yml @@ -0,0 +1,204 @@ +# 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: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + env: + QT_VERSION: 6.10.0 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ runner.os }} + + - name: Install missing software + run: | + sudo apt-get update + sudo apt-get install clang-14 + sudo apt-get install libboost-container-dev + sudo apt-get install valgrind + sudo apt-get install -y libgl-dev # fixes missing dependency for Qt in CMake + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: 'false' + install-deps: false + cache: true + + # TODO: cache this - perform same build as for the other self check + - name: Self check (build) + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + # valgrind cannot handle DWARF 5 yet so force version 4 + # work around performance regression with -inline-deferral + make -j$(nproc) CXXOPTS="-Werror -O2 -gdwarf-4" CPPOPTS="-DHAVE_BOOST -mllvm -inline-deferral" MATCHCOMPILER=yes CPPCHK_GLIBCXX_DEBUG= + env: + CC: clang-14 + CXX: clang++-14 + + # unusedFunction - start + - name: CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off + + - name: Generate dependencies + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + # make sure the precompiled headers exist + make -C cmake.output lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx + make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx + # make sure the auto-generated GUI dependencies exist + make -C cmake.output gui-build-deps + + - name: Self check (unusedFunction) + if: false # TODO: fails with preprocessorErrorDirective - see #10667 + run: | + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + env: + DISABLE_VALUEFLOW: 1 + UNUSEDFUNCTION_ONLY: 1 + # unusedFunction - end + + # the following steps are duplicated from above since setting up the build node in a parallel step takes longer than the actual steps + + # unusedFunction notest - start + - name: CMake (no test) + run: | + cmake -S . -B cmake.output.notest -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_GUI=ON -DBUILD_TRIAGE=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off + + - name: Generate dependencies (no test) + run: | + # make sure auto-generated GUI files exist + make -C cmake.output.notest autogen + # make sure the precompiled headers exist + make -C cmake.output.notest lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx + # make sure the auto-generated GUI dependencies exist + make -C cmake.output.notest gui-build-deps + + - name: Self check (unusedFunction / no test) + run: | + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + env: + DISABLE_VALUEFLOW: 1 + UNUSEDFUNCTION_ONLY: 1 + # unusedFunction notest - end + + # unusedFunction notest nogui - start + - name: CMake (no test / no gui) + run: | + cmake -S . -B cmake.output.notest_nogui -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off + + - name: Generate dependencies (no test / no gui) + run: | + # make sure the precompiled headers exist + make -C cmake.output.notest_nogui lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx + + - name: Self check (unusedFunction / no test / no gui) + run: | + supprs="--suppress=unusedFunction:lib/errorlogger.h:197 --suppress=unusedFunction:lib/importproject.cpp:1531 --suppress=unusedFunction:lib/importproject.cpp:1555" + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr $supprs + env: + DISABLE_VALUEFLOW: 1 + UNUSEDFUNCTION_ONLY: 1 + # unusedFunction notest nogui - end + + # unusedFunction notest nocli - start + - name: CMake (no test / no cli) + run: | + cmake -S . -B cmake.output.notest_nocli -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_CLI=Off -DBUILD_GUI=ON -DWITH_QCHART=ON -DBUILD_TRIAGE=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off + + - name: Generate dependencies (no test / no cli) + run: | + # make sure auto-generated GUI files exist + make -C cmake.output.notest_nocli autogen + # make sure the precompiled headers exist + make -C cmake.output.notest_nocli lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx + # make sure the auto-generated GUI dependencies exist + make -C cmake.output.notest_nocli gui-build-deps + + - name: Self check (unusedFunction / no test / no cli) + if: false # TODO: the findings are currently too intrusive + run: | + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nocli/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + env: + DISABLE_VALUEFLOW: 1 + UNUSEDFUNCTION_ONLY: 1 + # unusedFunction notest nocli - end + + # unusedFunction notest nocli nogui - start + - name: CMake (no test / no cli / no gui) + run: | + cmake -S . -B cmake.output.notest_nocli_nogui -Werror=dev -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_CLI=Off -DBUILD_GUI=Off -DENABLE_CHECK_INTERNAL=On -DCPPCHK_GLIBCXX_DEBUG=Off + + - name: Generate dependencies (no test / no cli / no gui) + run: | + # make sure the precompiled headers exist + make -C cmake.output.notest_nocli_nogui lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx + + - name: Self check (unusedFunction / no test / no cli / no gui) + if: false # TODO: the findings are currently too intrusive + run: | + ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nocli_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr + env: + DISABLE_VALUEFLOW: 1 + UNUSEDFUNCTION_ONLY: 1 + # unusedFunction notest nocli nogui - end + + - 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 -DHAVE_RULES=On -DBUILD_TESTING=Off -DBUILD_GUI=ON -DUSE_QT6=On -DWITH_QCHART=ON -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + + - name: Generate dependencies (corpus) + run: | + # make sure auto-generated GUI files exist + make -C cmake.output.corpus autogen + # make sure the precompiled headers exist + make -C cmake.output.corpus lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx + # make sure the auto-generated GUI dependencies exist + make -C cmake.output.corpus gui-build-deps + + - 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=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --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 + + - uses: actions/upload-artifact@v4 + with: + name: Callgrind Output + path: ./callgrind.* diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml new file mode 100644 index 00000000000..0e78566faae --- /dev/null +++ b/.github/workflows/tsan.yml @@ -0,0 +1,146 @@ +# 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: thread sanitizer + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + env: + QT_VERSION: 6.10.0 + TSAN_OPTIONS: halt_on_error=1 + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.14' + check-latest: true + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils + sudo apt-get install -y libcups2-dev # required for Qt6PrintSupport in CMake since Qt 6.7.3 + + - name: Install clang + run: | + sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 21 + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: 'false' + cache: true + + - name: Install missing Python packages + run: | + python3 -m pip install pip --upgrade + python3 -m pip install pytest + python3 -m pip install pytest-timeout + python3 -m pip install pytest-xdist + python3 -m pip install psutil + + - name: CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + env: + CC: clang-21 + CXX: clang++-21 + + - name: Build cppcheck + run: | + cmake --build cmake.output --target cppcheck -- -j $(nproc) + + - name: Build test + run: | + cmake --build cmake.output --target testrunner -- -j $(nproc) + + - name: Build GUI tests + run: | + cmake --build cmake.output --target gui-tests -- -j $(nproc) + + - name: Run tests + run: ./cmake.output/bin/testrunner + + - name: Run cfg tests + run: | + cmake --build cmake.output --target checkcfg -- -j $(nproc) + + - name: Run CTest + if: false # TODO: test-filelist fails with data race in pthread_cond_destroy + run: | + ctest --test-dir cmake.output --output-on-failure -j$(nproc) + + - name: Run test/cli + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_EXECUTOR: thread + + - name: Run test/cli (-j2) + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_J: 2 + + - name: Run test/cli (--clang) + if: false + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_CLANG: clang + + - name: Run test/cli (--cppcheck-build-dir) + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_BUILDDIR: injected + + - name: Generate dependencies + if: false + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps triage-build-ui-deps + + # TODO: disabled for now as it takes around 40 minutes to finish + # set --error-exitcode=0 so we only fail on sanitizer issues - since it uses threads for execution it will exit the whole process on the first issue + - name: Self check + if: false + run: | + ./selfcheck_san.sh ./cmake.output "--executor=thread --error-exitcode=0" diff --git a/.github/workflows/ubsan.yml b/.github/workflows/ubsan.yml new file mode 100644 index 00000000000..66c56b6966a --- /dev/null +++ b/.github/workflows/ubsan.yml @@ -0,0 +1,140 @@ +# 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: undefined behaviour sanitizers + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + env: + QT_VERSION: 6.10.0 + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1 + # TODO: figure out why there are cache misses with PCH enabled + CCACHE_SLOPPINESS: pch_defines,time_macros + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.14' + check-latest: true + + - name: Install missing software on ubuntu + run: | + sudo apt-get update + sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils + sudo apt-get install -y libcups2-dev # required for Qt6PrintSupport in CMake since Qt 6.7.3 + + - name: Install clang + run: | + sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 21 + + - name: Install Qt ${{ env.QT_VERSION }} + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + modules: 'qtcharts' + setup-python: 'false' + cache: true + + - name: Install missing Python packages + run: | + python3 -m pip install pip --upgrade + python3 -m pip install pytest + python3 -m pip install pytest-timeout + python3 -m pip install pytest-xdist + python3 -m pip install psutil + + - name: CMake + run: | + cmake -S . -B cmake.output -Werror=dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DFILESDIR= -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + env: + CC: clang-21 + CXX: clang++-21 + + - name: Build cppcheck + run: | + cmake --build cmake.output --target cppcheck -- -j $(nproc) + + - name: Build test + run: | + cmake --build cmake.output --target testrunner -- -j $(nproc) + + - name: Build GUI tests + run: | + cmake --build cmake.output --target gui-tests -- -j $(nproc) + + - name: Run tests + run: ./cmake.output/bin/testrunner + + - name: Run cfg tests + run: | + cmake --build cmake.output --target checkcfg -- -j $(nproc) + + - name: Run CTest + run: | + ctest --test-dir cmake.output --output-on-failure -j$(nproc) + + - name: Run test/cli + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + + - name: Run test/cli (-j2) + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_J: 2 + + - name: Run test/cli (--clang) + if: false + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_CLANG: clang + + - name: Run test/cli (--cppcheck-build-dir) + run: | + pwd=$(pwd) + TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv -n auto test/cli + env: + TEST_CPPCHECK_INJECT_BUILDDIR: injected + + - name: Generate dependencies + run: | + # make sure auto-generated GUI files exist + make -C cmake.output autogen + make -C cmake.output gui-build-deps triage-build-ui-deps + + # TODO: only fail the step on sanitizer issues - since we use processes it will only fail the underlying process which will result in an cppcheckError + - name: Self check + run: | + ./selfcheck_san.sh ./cmake.output diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml new file mode 100644 index 00000000000..9a6026aa25b --- /dev/null +++ b/.github/workflows/valgrind.yml @@ -0,0 +1,65 @@ +# 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: valgrind + +on: + push: + branches: + - 'main' + - 'releases/**' + - '2.*' + tags: + - '2.*' + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ runner.os }} + + - name: Install missing software + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + sudo apt-get install valgrind + sudo apt-get install libboost-container-dev + sudo apt-get install debuginfod + + - name: Build cppcheck + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror -O1 -g" CPPOPTS="-DHAVE_BOOST" HAVE_RULES=yes MATCHCOMPILER=yes CPPCHK_GLIBCXX_DEBUG= + + - name: Build test + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + make -j$(nproc) CXXOPTS="-Werror -O1 -g" CPPOPTS="-DHAVE_BOOST" HAVE_RULES=yes MATCHCOMPILER=yes CPPCHK_GLIBCXX_DEBUG= testrunner + + - name: Run valgrind + run: | + ec=0 + valgrind --error-limit=yes --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --suppressions=valgrind/testrunner.supp --gen-suppressions=all --log-fd=9 --error-exitcode=42 ./testrunner TestGarbage TestOther TestSimplifyTemplate 9>memcheck.log || ec=1 + cat memcheck.log + exit $ec + # TODO: debuginfod.ubuntu.com is currently not responding to any requests causing it to run into a 40(!) minute timeout + #env: + # DEBUGINFOD_URLS: https://debuginfod.ubuntu.com + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: Logs + path: ./*.log