From 65c649f524c1d613b205f3b01eaa0cf85ff3fd6e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 18:33:51 +0000 Subject: [PATCH] ci: build Windows host with Ninja and sccache The Windows host job never hit its cache. With no generator in the host-single-Debug preset, CMake picked Visual Studio there, and that generator ignores CMAKE__COMPILER_LAUNCHER. On #361 the Windows cache stayed at 0.0 / 2.0 GB, while macOS hit 84%. Build Windows with Ninja inside an MSVC developer environment (msvc-dev-cmd), through sccache. Debug info is embedded (/Z7, via CMP0141), because sccache cannot cache /Zi. CC/CXX=cl keeps run-cmake from running its own vcpkg-based MSVC setup. macOS keeps ccache. Two further fixes in the same job: - The job is named "Host Build & Test (${{ matrix.os }})", so the include-based matrix keeps the existing check names. - Failed-test logs upload per OS from build/host-single-Debug. That is the preset's binary directory; the old path was build/host, which this job never writes. This mirrors embedded-infra-lib's 8363cb0e (#150). The other compiling jobs (Ubuntu host, QEMU ARM, coverage) already cache with ccache, at roughly 80% hits. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Q53m7MZDmHwocmKbhhd2o5 --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efac20b7..f907108b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,11 +107,21 @@ jobs: path: build/${{ matrix.preset }}/Testing/Temporary/ host_build_test: - name: Host Build & Test + name: Host Build & Test (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, windows-latest] + include: + - os: macos-latest + cache-variant: ccache + cmake-args: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']" + # The Visual Studio generator ignores compiler launchers; sccache cannot cache /Zi, so debug info is embedded (/Z7). + # CC/CXX make run-cmake skip its vcpkg-based MSVC setup; msvc-dev-cmd already did it. + - os: windows-latest + cache-variant: sccache + cmake-args: "['-GNinja', '-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache', '-DCMAKE_POLICY_DEFAULT_CMP0141=NEW', '-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded']" + cc: cl + fail-fast: false steps: - name: Configure Git run: | @@ -121,20 +131,28 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + - if: ${{ runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + - if: ${{ runner.os == 'Windows' }} + uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 - uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 with: + variant: ${{ matrix.cache-variant }} key: ${{ github.job }}-${{ matrix.os }} max-size: 2G save: ${{ github.ref == 'refs/heads/main' }} - uses: lukka/run-cmake@5d55ea7949e25f69f0ecb516d8d572297e03a956 # v10.9 + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cc }} with: configurePreset: "host-single-Debug" buildPreset: "host-single-Debug" testPreset: "host-single-Debug" - configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']" + configurePresetAdditionalArgs: ${{ matrix.cmake-args }} - name: Upload test logs if: ${{ failure() }} uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: test-logs - path: build/host/Testing/Temporary/ + name: test-logs-${{ matrix.os }} + path: build/host-single-Debug/Testing/Temporary/