From f99786e195a9d13447b99332a18722893f939192 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 21 Jul 2026 12:37:50 -0300 Subject: [PATCH] cache compiled objects with sccache Compiler cache stored in the GitHub Actions cache, shared across runs. Requires /Z7 instead of the CMake default /Zi, since sccache cannot cache objects whose debug information lands in a shared PDB. That is a debug information format change only, the generated code is unchanged. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/build.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b22c10ea2..d3fd3582c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -152,6 +152,9 @@ jobs: fail-fast: false matrix: application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor] + env: + # store the compiler cache in the GitHub Actions cache + SCCACHE_GHA_ENABLED: 'true' steps: - name: Checkout source @@ -193,9 +196,14 @@ jobs: - uses: egor-tensin/vs-shell@v2 with: arch: x86 + - uses: mozilla-actions/sccache-action@v0.0.10 - name: Prepare build run: | - cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DApplications="$Env:JA2Application" + # sccache can only cache MSVC objects when the debug information is embedded + # in them (/Z7) instead of collected in a shared PDB (/Zi, the CMake default) + cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DApplications="$Env:JA2Application" ` + -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded ` + -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache - name: Build run: | cmake --build build/ -- -v @@ -203,6 +211,7 @@ jobs: shell: bash run: | find build/ + sccache --show-stats - name: Upload uses: actions/upload-artifact@v7