From 87986a2a8ebc6bf540d00330249d8156ae7a2e9f Mon Sep 17 00:00:00 2001 From: Emin Date: Thu, 3 Sep 2026 16:05:12 +0800 Subject: [PATCH 1/2] fix(ci): wire sccache into the CMake compiler launcher The sccache action only installs the binary and configures the GitHub Actions cache backend; it never hooks sccache into the compiler invocation, so builds ran uncached. Point CMAKE_C/CXX_COMPILER_LAUNCHER at sccache when it is available on PATH and print cache statistics after the build to make hits observable. --- .github/scripts/build-sizer.sh | 9 +++++++++ .github/workflows/build.yml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/.github/scripts/build-sizer.sh b/.github/scripts/build-sizer.sh index aac5905..ba04fd6 100755 --- a/.github/scripts/build-sizer.sh +++ b/.github/scripts/build-sizer.sh @@ -25,8 +25,17 @@ if [[ -f "${openroad_deps_prefixes}" ]]; then done fi +cmake_compiler_launcher_args=() +if command -v sccache >/dev/null 2>&1; then + cmake_compiler_launcher_args=( + -DCMAKE_C_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + ) +fi + cmake -S . -B build \ "${cmake_dependency_args[@]}" \ + "${cmake_compiler_launcher_args[@]}" \ -DCMAKE_BUILD_TYPE=Release \ -DENABLE_TESTS=OFF \ -DUSE_SYSTEM_BOOST=ON \ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c5cd6e..b4d16c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,10 @@ jobs: env: SIZER_VERSION: ${{ inputs.version }} + - name: Show sccache stats + if: always() + run: sccache --show-stats + - name: Package Sizer with runtime wrapper id: package env: From 1e28e7019707b18963d37f0b1064975a81bda89d Mon Sep 17 00:00:00 2001 From: Emin Date: Thu, 3 Sep 2026 17:54:50 +0800 Subject: [PATCH 2/2] fix(ci): enable the sccache GitHub Actions cache backend sccache-action only installs the binary and exports SCCACHE_PATH; the GHA cache backend stays off unless SCCACHE_GHA_ENABLED is set, so the cache lived on the ephemeral runner disk and never persisted across runs. Enable it at the job level so sccache uses the GitHub Actions cache service (v2) via the runner-provided ACTIONS_RESULTS_URL and ACTIONS_RUNTIME_TOKEN. Also log the compiler-launcher decision in build-sizer.sh and verify after configure that the generated compile rules actually invoke sccache, so a silently unwired launcher is visible in the CI log instead of only surfacing as zero compile requests in the stats. --- .github/scripts/build-sizer.sh | 11 +++++++++++ .github/workflows/build.yml | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/scripts/build-sizer.sh b/.github/scripts/build-sizer.sh index ba04fd6..e03be1c 100755 --- a/.github/scripts/build-sizer.sh +++ b/.github/scripts/build-sizer.sh @@ -27,10 +27,13 @@ fi cmake_compiler_launcher_args=() if command -v sccache >/dev/null 2>&1; then + echo "sccache detected at $(command -v sccache); enabling CMake compiler launcher" cmake_compiler_launcher_args=( -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ) +else + echo "sccache not found on PATH; building without a compiler cache" fi cmake -S . -B build \ @@ -49,4 +52,12 @@ cmake -S . -B build \ -DZLIB_HOME=/usr/lib/x86_64-linux-gnu \ -DCMAKE_RULE_MESSAGES=OFF +if [[ ${#cmake_compiler_launcher_args[@]} -gt 0 ]]; then + if grep -q "sccache" build/src/CMakeFiles/Sizer.dir/build.make; then + echo "Verified: generated compile rules invoke sccache" + else + echo "WARNING: sccache is missing from the generated compile rules" >&2 + fi +fi + cmake --build build --target Sizer -j "${NPROC:-$(nproc)}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4d16c2..035b43a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,10 @@ jobs: build-linux-x64: name: Build Linux x64 runs-on: ubuntu-22.04 + env: + # sccache-action does not enable the GHA cache backend by itself; + # without this, sccache falls back to an ephemeral local-disk cache. + SCCACHE_GHA_ENABLED: "true" outputs: archive-name: ${{ steps.package.outputs.archive-name }} steps: @@ -39,7 +43,7 @@ jobs: - name: Show sccache stats if: always() - run: sccache --show-stats + run: "${SCCACHE_PATH:-sccache} --show-stats" - name: Package Sizer with runtime wrapper id: package