From 5ad7c5793a0bb070219621336a8dbdff53bf54f5 Mon Sep 17 00:00:00 2001 From: adriadam10 Date: Sun, 27 Sep 2026 19:44:15 +0200 Subject: [PATCH 1/2] ci: build and test on Linux and Windows Builds with tests enabled and runs ctest on every push to main and every pull request: GCC on Linux, and on Windows the MinGW-w64 winlibs GCC 15.2.0 toolchain required by the README. ccache and the toolchain are cached, and only pushes to main save the ccache, so pull requests reuse it without evicting it. Windows build steps run in cmd because Git Bash puts its own mingw64 DLLs first in PATH, which breaks build tools such as nid_patcher that link libstdc++ dynamically. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..feef942e8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: Build + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +env: + CONFIGURE: >- + -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON + -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ + -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + +jobs: + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + submodules: true + - uses: hendrikmuhs/ccache-action@v1.2.24 + with: + key: linux + save: ${{ github.event_name == 'push' }} + evict-old-files: job + - run: cmake -S . -B build $CONFIGURE + - run: cmake --build build + - run: ctest --test-dir build --output-on-failure + + windows: + runs-on: windows-latest + env: + WINLIBS_RELEASE: 15.2.0posix-14.0.0-ucrt-r7 + WINLIBS_ZIP: winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-14.0.0-r7.zip + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v7 + with: + submodules: true + - id: toolchain + uses: actions/cache@v6 + with: + path: C:\winlibs + key: ${{ env.WINLIBS_ZIP }} + - if: steps.toolchain.outputs.cache-hit != 'true' + run: | + curl -sSfL -o "$RUNNER_TEMP/winlibs.zip" "https://github.com/brechtsanders/winlibs_mingw/releases/download/$WINLIBS_RELEASE/$WINLIBS_ZIP" + 7z x "$RUNNER_TEMP/winlibs.zip" -oC:/winlibs > /dev/null + - run: echo 'C:\winlibs\mingw64\bin' >> "$GITHUB_PATH" + - uses: hendrikmuhs/ccache-action@v1.2.24 + with: + key: windows + save: ${{ github.event_name == 'push' }} + evict-old-files: job + - shell: cmd + run: cmake -S . -B build %CONFIGURE% + - shell: cmd + run: cmake --build build + - shell: cmd + run: ctest --test-dir build --output-on-failure From 682fb3d73c20d61787336c20fef96f70ff4c8626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Franch?= Date: Mon, 28 Sep 2026 16:29:45 +0200 Subject: [PATCH 2/2] ci: time out hung tests --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index feef942e8..5b07dfadd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,7 @@ env: jobs: linux: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v7 with: @@ -33,10 +34,11 @@ jobs: evict-old-files: job - run: cmake -S . -B build $CONFIGURE - run: cmake --build build - - run: ctest --test-dir build --output-on-failure + - run: ctest --test-dir build --output-on-failure --timeout 120 windows: runs-on: windows-latest + timeout-minutes: 45 env: WINLIBS_RELEASE: 15.2.0posix-14.0.0-ucrt-r7 WINLIBS_ZIP: winlibs-x86_64-posix-seh-gcc-15.2.0-mingw-w64ucrt-14.0.0-r7.zip @@ -67,4 +69,4 @@ jobs: - shell: cmd run: cmake --build build - shell: cmd - run: ctest --test-dir build --output-on-failure + run: ctest --test-dir build --output-on-failure --timeout 120