From 9e0c1896956c108fb8961e3711306f6b383973df Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 4 Nov 2025 17:06:54 +0100 Subject: [PATCH 1/9] CI-windows.yml: also run tests in Windows Server (Core) Docker container --- .github/workflows/CI-windows.yml | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index ccf208fa..b36be8d4 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -55,6 +55,57 @@ jobs: run: | .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! + # TODO: does not actually fail on errors + - name: Selfcheck + run: | + .\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! + + - name: integration test + run: | + set SIMPLECPP_EXE_PATH=.\${{ matrix.config }}\simplecpp.exe + python -m pytest integration_test.py -vv || exit /b !errorlevel! + + - name: Cache Binaries + if: matrix.os == 'windows-2025' + uses: actions/cache@v4 + with: + path: | + .\${{ matrix.config }}\testrunner.exe + .\${{ matrix.config }}\simplecpp.exe + key: simplecpp-${{ matrix.config }}-${{ github.sha }} + + test-core: + needs: build + runs-on: ubuntu-24.04 + strategy: + matrix: + image: [ "mcr.microsoft.com/windows/server:ltsc2025", "mcr.microsoft.com/windows/servercore:ltsc2025" ] + config: [Release, Debug] + fail-fast: false + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Restore Binaries + uses: actions/cache@v4 + with: + path: | + .\${{ matrix.config }}\testrunner.exe + .\${{ matrix.config }}\simplecpp.exe + key: simplecpp-${{ matrix.config }}-${{ github.sha }} + fail-on-cache-miss: true + + # TODO: how to share the following steps + - name: Test + run: | + .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! + + # TODO: does not actually fail on errors - name: Selfcheck run: | .\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! From 6a7a66e2175fed15a6981a6a883705717c3c41a7 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 4 Nov 2025 17:07:10 +0100 Subject: [PATCH 2/9] remove --- .github/workflows/CI-unixish.yml | 183 ------------------------------- .github/workflows/CI-windows.yml | 2 +- .github/workflows/clang-tidy.yml | 51 --------- .github/workflows/format.yml | 62 ----------- appveyor.yml | 21 ---- 5 files changed, 1 insertion(+), 318 deletions(-) delete mode 100644 .github/workflows/CI-unixish.yml delete mode 100644 .github/workflows/clang-tidy.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 appveyor.yml diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml deleted file mode 100644 index d6800a82..00000000 --- a/.github/workflows/CI-unixish.yml +++ /dev/null @@ -1,183 +0,0 @@ -name: CI-unixish - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - build: - - strategy: - matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15] - compiler: [clang++] - include: - - os: ubuntu-22.04 - compiler: g++ - - os: ubuntu-24.04 - compiler: g++ - fail-fast: false - - runs-on: ${{ matrix.os }} - - env: - CXX: ${{ matrix.compiler }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - # the man-db trigger causes package installations to stall for several minutes at times. so just drop the package. - # see https://github.com/actions/runner/issues/4030 - - name: Remove man-db package on ubuntu - if: matrix.os == 'ubuntu-24.04' - run: | - sudo apt-get update - sudo apt-get remove man-db - - - name: Install missing software on ubuntu - if: matrix.os == 'ubuntu-24.04' - run: | - sudo apt-get update - sudo apt-get install valgrind - - # llvm contains llvm-profdata - - name: Install missing software on ubuntu (clang++) - if: contains(matrix.os, 'ubuntu') && matrix.compiler == 'clang++' - run: | - sudo apt-get update - sudo apt-get install libc++-dev llvm - - # coreutils contains "nproc" - - name: Install missing software on macos - if: contains(matrix.os, 'macos') - run: | - brew install coreutils - - - name: Install missing Python packages - run: | - python3 -m pip config set global.break-system-packages true - python3 -m pip install pytest - - - name: make simplecpp - run: make -j$(nproc) CXXOPTS="-Werror" - - - name: make test - run: make -j$(nproc) test CXXOPTS="-Werror" - - - name: selfcheck - run: | - make -j$(nproc) selfcheck - - - name: make testrunner (c++17) - run: | - make clean - make -j$(nproc) testrunner CXXOPTS="-std=c++17" - - - name: make testrunner (c++20) - run: | - make clean - make -j$(nproc) testrunner CXXOPTS="-std=c++20" - - - name: Run CMake - run: | - cmake -S . -B cmake.output -Werror=dev --warn-uninitialized -DCMAKE_COMPILE_WARNING_AS_ERROR=On - - - name: CMake simplecpp - run: | - cmake --build cmake.output --target simplecpp -- -j $(nproc) - - - name: CMake testrunner - run: | - cmake --build cmake.output --target testrunner -- -j $(nproc) - ./cmake.output/testrunner - # Re-run tests from within the build directory to validate that - # SIMPLECPP_TEST_SOURCE_DIR is correctly defined and resolved - (cd cmake.output && ./testrunner) - - - name: Run valgrind - if: matrix.os == 'ubuntu-24.04' - run: | - make clean - make -j$(nproc) CXXOPTS="-O1" - valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./testrunner - # TODO: run Python tests with valgrind - VALGRIND_TOOL=memcheck ./selfcheck.sh - - - name: Run with libstdc++ debug mode - if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'g++' - run: | - make clean - make -j$(nproc) test selfcheck CXXOPTS="-Werror -g3 -D_GLIBCXX_DEBUG" - - - name: Run with libc++ hardening mode - if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++' - run: | - make clean - make -j$(nproc) test selfcheck CXXOPTS="-Werror -stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDOPTS="-lc++" - - - name: Run AddressSanitizer - if: matrix.os == 'ubuntu-24.04' - run: | - make clean - make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=address" LDOPTS="-fsanitize=address" - env: - ASAN_OPTIONS: detect_stack_use_after_return=1 - - - name: Run UndefinedBehaviorSanitizer - if: matrix.os == 'ubuntu-24.04' - run: | - make clean - make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDOPTS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow" - env: - UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1 - - # TODO: requires instrumented libc++ - - name: Run MemorySanitizer - if: false && matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++' - run: | - make clean - make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -stdlib=libc++ -fsanitize=memory" LDOPTS="-lc++ -fsanitize=memory" - - - name: Run callgrind - if: matrix.os == 'ubuntu-24.04' - run: | - wget https://github.com/danmar/simplecpp/archive/refs/tags/1.5.1.tar.gz - tar xvf 1.5.1.tar.gz - rm -f 1.5.1.tar.gz - - make clean - make -j$(nproc) CXXOPTS="-O2 -g3" simplecpp - VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind.log || (cat callgrind.log && false) - cat callgrind.log - - # PGO - start - make clean - make -j$(nproc) CXXOPTS="-O2 -g3 -fprofile-generate" LDOPTS="-fprofile-generate" simplecpp - SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >/dev/null - - if compgen -G "default_*.profraw" > /dev/null; then - llvm-profdata merge -output=default.profdata default_*.profraw - fi - - make clean - make -j$(nproc) CXXOPTS="-O2 -g3 -fprofile-use" LDOPTS="-fprofile-use" simplecpp - VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_pgo.log || (cat callgrind_pgo.log && false) - cat callgrind_pgo.log - # PGO - end - - for f in callgrind.out.*; - do - callgrind_annotate --auto=no $f > $f.annotated.log - head -50 $f.annotated.log - done - rm -rf simplecpp-1.5.1 - - - uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-24.04' - with: - name: Callgrind Output - ${{ matrix.compiler }} - path: | - ./callgrind.* diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index b36be8d4..79ed624e 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -18,7 +18,7 @@ jobs: build: strategy: matrix: - os: [windows-2022, windows-2025, windows-11-arm] + os: [windows-2025] config: [Release, Debug] fail-fast: false diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml deleted file mode 100644 index 4b52d7bc..00000000 --- a/.github/workflows/clang-tidy.yml +++ /dev/null @@ -1,51 +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: clang-tidy - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - # the man-db trigger causes package installations to stall for several minutes at times. so just drop the package. - # see https://github.com/actions/runner/issues/4030 - - name: Remove man-db package - run: | - sudo apt-get update - sudo apt-get remove man-db - - - name: Install missing software - run: | - sudo apt-get update - sudo apt-get install -y cmake make - - - name: Install clang - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 21 - sudo apt-get install clang-tidy-21 - - - name: Verify clang-tidy configuration - run: | - clang-tidy-21 --verify-config - - - name: Prepare CMake - run: | - cmake -S . -B cmake.output -Werror=dev --warn-uninitialized -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - env: - CXX: clang-21 - - - name: Clang-Tidy - run: | - run-clang-tidy-21 -q -j $(nproc) -p=cmake.output diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 4d5657f8..00000000 --- a/.github/workflows/format.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: format - -on: - push: - branches: - - 'master' - - 'releases/**' - - '1.*' - tags: - - '1.*' - pull_request: - -permissions: - contents: read - -jobs: - format: - - runs-on: ubuntu-22.04 - - defaults: - run: - shell: bash -euo pipefail {0} - - env: - UNCRUSTIFY_INSTALL_DIR: ${{ github.workspace }}/runformat-uncrustify - - steps: - - uses: actions/checkout@v5 - with: - persist-credentials: false - - - name: Determine uncrustify version - id: get-uncrustify-version - run: | - version="$(./runformat --expected-uncrustify-version)" - echo "Expected uncrustify version: $version" - echo "version=$version" >> "$GITHUB_OUTPUT" - - - name: Set UNCRUSTIFY_VERSION env variable - run: | - version=$(./runformat --expected-uncrustify-version) - echo "version [$version]" - echo "UNCRUSTIFY_VERSION=${version}" >> "$GITHUB_ENV" - - - name: Cache uncrustify - uses: actions/cache@v4 - id: cache-uncrustify - with: - path: ${{ env.UNCRUSTIFY_INSTALL_DIR }} - key: ${{ runner.os }}-uncrustify-${{ steps.get-uncrustify-version.outputs.version }} - - - name: Install uncrustify - if: steps.cache-uncrustify.outputs.cache-hit != 'true' - run: | - ./runformat --install --install-dir "${UNCRUSTIFY_INSTALL_DIR}" - - - name: Uncrustify check - run: | - ./runformat diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 09aa6cbe..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 1.{build} - -environment: - matrix: - - VisualStudioVersion: 14.0 - platform: "Win32" - configuration: "Debug" - vcvarsall_platform: "x86" - PlatformToolset: "v140" - -build_script: - - ECHO Building %configuration% %platform% with MSVC %VisualStudioVersion% using %PlatformToolset% PlatformToolset - - cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=On -G "Visual Studio 14" . - - dir - - 'CALL "C:\Program Files (x86)\Microsoft Visual Studio %VisualStudioVersion%\VC\vcvarsall.bat" %vcvarsall_platform%' - - set _CL_=/WX - - msbuild "simplecpp.sln" /consoleloggerparameters:Verbosity=minimal /target:Build /property:Configuration="%configuration%";Platform=%platform% /p:PlatformToolset=%PlatformToolset% /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - -test_script: - - debug\testrunner.exe - - debug\simplecpp.exe simplecpp.cpp -e From f170082cd75f86752ec8afea814bf6292f4e5a76 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:24:37 +0100 Subject: [PATCH 3/9] s --- .github/workflows/CI-windows.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 79ed624e..88ca06b7 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -83,9 +83,6 @@ jobs: config: [Release, Debug] fail-fast: false - container: - image: ${{ matrix.image }} - steps: - uses: actions/checkout@v4 with: @@ -103,15 +100,15 @@ jobs: # TODO: how to share the following steps - name: Test run: | - .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! + docker run ${{ matrix.image }} .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! # TODO: does not actually fail on errors - name: Selfcheck run: | - .\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! + docker run ${{ matrix.image }} .\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! - name: integration test run: | set SIMPLECPP_EXE_PATH=.\${{ matrix.config }}\simplecpp.exe - python -m pytest integration_test.py -vv || exit /b !errorlevel! + docker run ${{ matrix.image }} python -m pytest integration_test.py -vv || exit /b !errorlevel! From 68a471a3593800ead33a81fb04bdfd80b23485f3 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:33:03 +0100 Subject: [PATCH 4/9] s --- .github/workflows/CI-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 88ca06b7..dde3f061 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -76,7 +76,7 @@ jobs: test-core: needs: build - runs-on: ubuntu-24.04 + runs-on: windows-2025 strategy: matrix: image: [ "mcr.microsoft.com/windows/server:ltsc2025", "mcr.microsoft.com/windows/servercore:ltsc2025" ] From 636e12904a452cb72273ade33b26ba4e649b4b69 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:36:54 +0100 Subject: [PATCH 5/9] s --- .github/workflows/CI-windows.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index dde3f061..15c2d14a 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -97,6 +97,11 @@ jobs: key: simplecpp-${{ matrix.config }}-${{ github.sha }} fail-on-cache-miss: true + # TODO: only do this once + - name: Pull Image + run: | + docker image pull ${{ matrix.image }} + # TODO: how to share the following steps - name: Test run: | From 67bfcb6ddb97958577e5b0b979ad9d5be8d40ccb Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:37:37 +0100 Subject: [PATCH 6/9] s --- .github/workflows/CI-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 15c2d14a..090ef25f 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -97,7 +97,7 @@ jobs: key: simplecpp-${{ matrix.config }}-${{ github.sha }} fail-on-cache-miss: true - # TODO: only do this once + # TODO: only do this once per image - name: Pull Image run: | docker image pull ${{ matrix.image }} From cd4ebe34b13a62daa9402a5775e9dea70ab4fc11 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:40:57 +0100 Subject: [PATCH 7/9] s --- .github/workflows/CI-windows.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 090ef25f..698c9adb 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -100,7 +100,8 @@ jobs: # TODO: only do this once per image - name: Pull Image run: | - docker image pull ${{ matrix.image }} + docker image pull ${{ matrix.image }} || exit /b !errorlevel! + docker image ls || exit /b !errorlevel! # TODO: how to share the following steps - name: Test From bc717bafbd8fc83d0db98adf97bb11e3179d6f82 Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:41:22 +0100 Subject: [PATCH 8/9] s --- .github/workflows/CI-windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 698c9adb..3e05c049 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -98,6 +98,7 @@ jobs: fail-on-cache-miss: true # TODO: only do this once per image + # TODO: cache this as it takes several minutes for it to complete - name: Pull Image run: | docker image pull ${{ matrix.image }} || exit /b !errorlevel! From 8c7c3f6651eedc34e29dec74636721fcbfc2562c Mon Sep 17 00:00:00 2001 From: firewave Date: Sat, 29 Nov 2025 11:50:32 +0100 Subject: [PATCH 9/9] s --- .github/workflows/CI-windows.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index 3e05c049..4cecb9c8 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -107,15 +107,14 @@ jobs: # TODO: how to share the following steps - name: Test run: | - docker run ${{ matrix.image }} .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! + docker run -v %%GITHUB_WORKSPACE%%\${{ matrix.config }}:C:\${{ matrix.config }} ${{ matrix.image }} C:\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! # TODO: does not actually fail on errors - name: Selfcheck run: | - docker run ${{ matrix.image }} .\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! + docker run -v %%GITHUB_WORKSPACE%%\${{ matrix.config }}:C:\${{ matrix.config }} ${{ matrix.image }} C:\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! - name: integration test run: | - set SIMPLECPP_EXE_PATH=.\${{ matrix.config }}\simplecpp.exe - docker run ${{ matrix.image }} python -m pytest integration_test.py -vv || exit /b !errorlevel! + docker run -v %%GITHUB_WORKSPACE%%\${{ matrix.config }}:C:\${{ matrix.config }} ${{ matrix.image }} -e SIMPLECPP_EXE_PATH=C:\${{ matrix.config }}\simplecpp.exe python -m pytest integration_test.py -vv || exit /b !errorlevel!