diff --git a/.github/workflows/CI-mingw.yml b/.github/workflows/CI-mingw.yml deleted file mode 100644 index 390de83d..00000000 --- a/.github/workflows/CI-mingw.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: CI-mingw - -on: [push, pull_request] - -permissions: - contents: read - -defaults: - run: - shell: msys2 {0} - -jobs: - build: - - strategy: - matrix: - compiler: [g++, clang++] - # TODO: add MSYS after #556 is fixed - msystem: [MINGW32, MINGW64, CLANG64] - include: - #- msystem: MSYS - # pkg-prefix: '' - - msystem: MINGW32 - pkg-prefix: 'mingw-w64-i686-' - - msystem: MINGW64 - pkg-prefix: 'mingw-w64-x86_64-' - - msystem: CLANG64 - pkg-prefix: 'mingw-w64-clang-x86_64-' - - compiler: g++ - compiler-pkg: gcc - - compiler: clang++ - compiler-pkg: clang - exclude: - - msystem: CLANG64 - compiler: g++ - # the mingw-w64-i686-clang package is no longer available - - msystem: MINGW32 - compiler: clang++ - fail-fast: false - - runs-on: windows-2025 - - env: - CXX: ${{ matrix.compiler }} - - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Set up MSYS2 - uses: msys2/setup-msys2@v2 - with: - release: false # use pre-installed - msystem: ${{ matrix.msystem }} - # TODO: install mingw-w64-x86_64-make and use mingw32.make instead - currently fails with "Windows Subsystem for Linux has no installed distributions." - # TODO: also run tests with non-prefixed Python? - install: >- - make - ${{ matrix.pkg-prefix }}cmake - ${{ matrix.pkg-prefix }}python - ${{ matrix.pkg-prefix }}python-pytest - - - name: install compiler - run: | - pacman -S --noconfirm ${{ matrix.pkg-prefix }}${{ matrix.compiler-pkg }} - ${CXX} -v - - - name: make simplecpp - run: | - make -j$(nproc) CXXOPTS="-Werror" - - # gcc *and* clang are required to run-tests.py - # install it at this point since it has gcc as dependency which might interfere with the build - - name: install compiler (clang) - if: matrix.compiler == 'g++' - run: | - pacman -S --noconfirm clang - - - name: install compiler (gcc) - if: matrix.compiler == 'clang++' - run: | - pacman -S --noconfirm gcc - - - name: make test - run: | - # TODO: run tests with Windows paths - make -j$(nproc) test - - - name: selfcheck - run: | - # TODO: run tests with Windows paths - make -j$(nproc) selfcheck - - - name: make (c++14) - run: | - make clean - make -j$(nproc) CXXOPTS="-Werror -std=c++14" - - - name: make (c++17) - run: | - make clean - make -j$(nproc) CXXOPTS="-Werror -std=c++17" - - - name: make (c++20) - run: | - make clean - make -j$(nproc) CXXOPTS="-Werror -std=c++20" - - - name: make (c++23) - run: | - make clean - make -j$(nproc) CXXOPTS="-Werror -std=c++23" - - - name: Run CMake - run: | - cmake -S . -B cmake.output -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) - - - name: Run testrunner - run: | - ./cmake.output/testrunner - - - name: Run with libstdc++ debug mode - if: 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.compiler == 'clang++' && matrix.msystem == 'CLANG64' - run: | - make clean - make -j$(nproc) test selfcheck CXXOPTS="-Werror -stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDOPTS="-lc++" diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 1a4ce649..57abb798 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - os: [ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-15, macos-15-intel, macos-26, macos-26-intel] + os: [ubuntu-24.04] compiler: [clang++] include: - os: ubuntu-22.04 @@ -32,13 +32,13 @@ jobs: # 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' + if: startsWith(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' + if: startsWith(matrix.os, 'ubuntu-24.04') run: | sudo apt-get update sudo apt-get install valgrind @@ -109,7 +109,7 @@ jobs: (cd cmake.output && ./testrunner) - name: Run valgrind - if: matrix.os == 'ubuntu-24.04' + if: startsWith(matrix.os, 'ubuntu-24.04') run: | make clean make -j$(nproc) CXXOPTS="-O1" @@ -118,19 +118,19 @@ jobs: VALGRIND_TOOL=memcheck ./selfcheck.sh - name: Run with libstdc++ debug mode - if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'g++' + if: startsWith(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++' + if: startsWith(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' || matrix.os == 'macos-26' + if: startsWith(matrix.os, 'ubuntu-24.04') || startsWith(matrix.os, 'macos-26') run: | make clean make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=address" LDOPTS="-fsanitize=address" @@ -138,7 +138,7 @@ jobs: ASAN_OPTIONS: detect_stack_use_after_return=1 - name: Run UndefinedBehaviorSanitizer - if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-26' + if: startsWith(matrix.os, 'ubuntu-24.04') || startsWith(matrix.os, 'macos-26') 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" @@ -147,22 +147,45 @@ jobs: # TODO: requires instrumented libc++ - name: Run MemorySanitizer - if: false && matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++' + if: false && startsWith(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' + if: startsWith(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 + # O2 - start 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 + VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_o2.log || (cat callgrind_o2.log && false) + cat callgrind_o2.log + # O2 - end + + # O3 - start + make clean + make -j$(nproc) CXXOPTS="-O3 -g3" simplecpp + VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_o3.log || (cat callgrind_o3.log && false) + cat callgrind_o3.log + # O3 - end + + # O2+LTO - start + make clean + make -j$(nproc) CXXOPTS="-O2 -g3 -flto" LDOPTS="-flto" simplecpp + VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_o2_lto.log || (cat callgrind_o2_lto.log && false) + cat callgrind_o2_lto.log + # O2+LTO - end + + # O3+LTO - start + make clean + make -j$(nproc) CXXOPTS="-O2 -g3 -flto" LDOPTS="-flto" simplecpp + VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_o3_lto.log || (cat callgrind_o3_lto.log && false) + cat callgrind_o3_lto.log + # O3+LTO - end # PGO - start make clean @@ -179,6 +202,9 @@ jobs: cat callgrind_pgo.log # PGO - end + # TODO: PGO+O3 + # TODO: PGO+LTO + for f in callgrind.out.*; do callgrind_annotate --auto=no $f > $f.annotated.log @@ -187,8 +213,8 @@ jobs: rm -rf simplecpp-1.5.1 - uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-24.04' + if: startsWith(matrix.os, 'ubuntu-24.04') with: - name: Callgrind Output - ${{ matrix.compiler }} + name: Callgrind Output - ${{ matrix.os }} - ${{ matrix.compiler }} path: | ./callgrind.* diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml deleted file mode 100644 index cfced0d2..00000000 --- a/.github/workflows/CI-windows.yml +++ /dev/null @@ -1,82 +0,0 @@ -# Some convenient links: -# - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -# - -name: CI-windows - -on: [push,pull_request] - -permissions: - contents: read - -defaults: - run: - shell: cmd - -jobs: - - build: - strategy: - matrix: - os: [windows-2022, windows-2025, windows-11-arm] - config: [Release, Debug] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - - name: Setup msbuild.exe - uses: microsoft/setup-msbuild@v2 - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: '3.14' - check-latest: true - - - name: Install missing Python packages - run: | - python -m pip install pip --upgrade || exit /b !errorlevel! - python -m pip install pytest || exit /b !errorlevel! - - - name: Run CMake - run: | - cmake -G "Visual Studio 17 2022" -A x64 -Werror=dev --warn-uninitialized -DCMAKE_COMPILE_WARNING_AS_ERROR=On . || exit /b !errorlevel! - - - name: Build - run: | - msbuild -m simplecpp.sln /p:Configuration=${{ matrix.config }} /p:Platform=x64 || exit /b !errorlevel! - - - name: Test - run: | - .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! - - - 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: Run CMake (c++17) - run: | - cmake -S . -B build.cxx17 -G "Visual Studio 17 2022" -A x64 -Werror=dev --warn-uninitialized -DCMAKE_CXX_STANDARD=17 -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - - - name: Build (c++17) - run: | - msbuild -m build.cxx17\simplecpp.sln /p:Configuration=${{ matrix.config }} /p:Platform=x64 || exit /b !errorlevel! - - - name: Run CMake (c++20) - run: | - cmake -S . -B build.cxx20 -G "Visual Studio 17 2022" -A x64 -Werror=dev --warn-uninitialized -DCMAKE_CXX_STANDARD=20 -DCMAKE_COMPILE_WARNING_AS_ERROR=On || exit /b !errorlevel! - - - name: Build (c++20) - run: | - msbuild -m build.cxx20\simplecpp.sln /p:Configuration=${{ matrix.config }} /p:Platform=x64 || exit /b !errorlevel! - diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml deleted file mode 100644 index 333672d7..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@v6 - 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 22 - sudo apt-get install clang-tidy-22 - - - name: Verify clang-tidy configuration - run: | - clang-tidy-22 --verify-config - - - name: Prepare CMake - run: | - cmake -S . -B cmake.output -Werror=dev --warn-uninitialized -DCMAKE_CXX_STANDARD=23 -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - env: - CXX: clang-22 - - - name: Clang-Tidy - run: | - run-clang-tidy-22 -q -j $(nproc) -enable-check-profile -p=cmake.output diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index e9f1361d..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@v6 - 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