Skip to content

Commit

Permalink
Merge branch 'main' into chr_13496
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Jan 2, 2025
2 parents e8b38cf + 3216458 commit beb894c
Show file tree
Hide file tree
Showing 222 changed files with 5,158 additions and 2,786 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Checks: >
-modernize-replace-auto-ptr,
-modernize-return-braced-init-list,
-modernize-type-traits,
-modernize-use-auto,
-modernize-use-designated-initializers,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/CI-cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ defaults:
shell: cmd

jobs:
# TODO: add CMake build
build_cygwin:
strategy:
matrix:
os: [windows-2022]
arch: [x64]
platform: [x86_64]
include:
- platform: 'x86_64'
packages: |
Expand All @@ -42,7 +43,7 @@ jobs:
- name: Set up Cygwin
uses: cygwin/cygwin-install-action@master
with:
platform: ${{ matrix.arch }}
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.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/CI-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ defaults:
shell: msys2 {0}

jobs:
# TODO: add CMake build
build_mingw:
strategy:
matrix:
Expand Down
77 changes: 56 additions & 21 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@ jobs:
# pcre was removed from runner images in November 2022
brew install coreutils qt@6 pcre
- name: CMake build on ubuntu (with GUI)
- name: Run CMake on ubuntu (with GUI)
if: contains(matrix.os, 'ubuntu')
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build cmake.output -- -j$(nproc)
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=${{ matrix.use_qt6 }} -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install
- name: CMake build on macos (with GUI)
- name: Run CMake on macos (with GUI)
if: contains(matrix.os, 'macos')
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt6_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=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
Expand All @@ -165,6 +167,10 @@ jobs:
pushd cmake.output
ctest --output-on-failure -j$(nproc)
- name: Run CMake install
run: |
cmake --build cmake.output --target install
build_uchar:

strategy:
Expand Down Expand Up @@ -262,6 +268,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-13]
include:
- xdist_n: auto
# FIXME: test_color_tty fails with xdist
- os: macos-13
xdist_n: '1'
fail-fast: false # Prefer quick result

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -300,6 +311,7 @@ jobs:
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: Build cppcheck
Expand All @@ -323,7 +335,7 @@ jobs:
- name: Run test/cli
run: |
python3 -m pytest -Werror --strict-markers -vv test/cli
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
Expand All @@ -332,32 +344,32 @@ jobs:
cd ..
ln -s cppcheck 'cpp check'
cd 'cpp check/test/cli'
python3 -m pytest -Werror --strict-markers -vv
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 'cpp check/test/cli'
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 test/cli
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 test/cli
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 test/cli
python3 -m pytest -Werror --strict-markers -vv -n ${{ matrix.xdist_n }} test/cli
env:
TEST_CPPCHECK_INJECT_BUILDDIR: injected

Expand All @@ -382,21 +394,31 @@ jobs:
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 cmake.output.signal -G "Unix Makefiles" -DBUILD_TESTS=On
cmake --build cmake.output.signal --target test-signalhandler -- -j$(nproc)
cp cmake.output.signal/bin/test-s* .
cmake -S . -B build.cmake.signal -G "Unix Makefiles" -DBUILD_TESTS=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 cmake.output.signal -G "Unix Makefiles" -DBUILD_TESTS=On
cmake --build cmake.output.signal --target test-stacktrace -- -j$(nproc)
cp cmake.output.signal/bin/test-s* .
cmake -S . -B build.cmake.stack -G "Unix Makefiles" -DBUILD_TESTS=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
Expand Down Expand Up @@ -431,18 +453,20 @@ jobs:
../../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 addons/test
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 addons/test
python3 -m pytest --strict-markers -vv -n 1 addons/test
env:
PYTHONPATH: ./addons

Expand All @@ -452,6 +476,17 @@ jobs:
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: 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

Expand Down Expand Up @@ -504,8 +539,8 @@ jobs:
exit $ec
fi
# self check simplecpp
./cppcheck $selfcheck_options externals/simplecpp || ec=1
# self check externals
./cppcheck $selfcheck_options externals || ec=1
# self check lib/cli
mkdir b1
./cppcheck $selfcheck_options $cppcheck_options --cppcheck-build-dir=b1 --addon=naming.json cli || ec=1
Expand Down
51 changes: 41 additions & 10 deletions .github/workflows/CI-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,22 @@ jobs:
modules: 'qtcharts'
cache: true

- name: Build GUI release (Qt 5)
- name: Run CMake for GUI release (Qt 5)
if: startsWith(matrix.qt_ver, '5')
run: |
; TODO: enable rules?
; specify Release build so matchcompiler is used
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install || exit /b !errorlevel!
- name: Build GUI release (Qt 6)
- name: Run CMake for GUI release (Qt 6)
if: startsWith(matrix.qt_ver, '6')
run: |
; TODO: enable rules?
; specify Release build so matchcompiler is used
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On || exit /b !errorlevel!
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DBUILD_ONLINE_HELP=On -DCMAKE_INSTALL_PREFIX=cppcheck-cmake-install || exit /b !errorlevel!
- name: Run CMake build
run: |
cmake --build build --target cppcheck-gui --config Release || exit /b !errorlevel!
- name: Deploy GUI
Expand All @@ -73,6 +75,10 @@ jobs:
# TODO: run GUI tests

- name: Run CMake install
run: |
cmake --build build --target install
build:
strategy:
matrix:
Expand Down Expand Up @@ -137,6 +143,7 @@ jobs:
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!
# TODO: build with CMake
Expand Down Expand Up @@ -176,30 +183,41 @@ jobs:
- name: Run test/cli
if: matrix.config == 'release'
run: |
python -m pytest -Werror --strict-markers -vv test/cli || exit /b !errorlevel!
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 test/cli || exit /b !errorlevel!
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 test/cli || exit /b !errorlevel!
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 test/cli || exit /b !errorlevel!
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 -DBUILD_TESTS=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: |
Expand Down Expand Up @@ -231,10 +249,11 @@ jobs:
..\..\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 addons/test || exit /b !errorlevel!
python -m pytest -Werror --strict-markers -vv -n 1 addons/test || exit /b !errorlevel!
env:
PYTHONPATH: ./addons

Expand All @@ -244,3 +263,15 @@ jobs:
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'
Loading

0 comments on commit beb894c

Please sign in to comment.