From 23eea5f171d5df93653c4d277a5cecc52aa14219 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 12 Feb 2026 16:10:47 +0100 Subject: [PATCH] build: skip sscache action on non-main branches To reduce cache thrashing. --- .github/workflows/build-tarball.yml | 7 ++++--- .github/workflows/coverage-linux-without-intl.yml | 7 ++++--- .github/workflows/coverage-linux.yml | 7 ++++--- .github/workflows/test-internet.yml | 7 ++++--- .github/workflows/test-linux.yml | 7 ++++--- .github/workflows/test-macos.yml | 7 ++++--- .github/workflows/test-shared.yml | 1 + 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index e9725ad7b56c50..26416ae4bd1000 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -100,9 +100,9 @@ jobs: needs: build-tarball runs-on: ubuntu-24.04 env: - CC: sccache clang-19 - CXX: sccache clang++-19 - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} SCCACHE_IDLE_TIMEOUT: '0' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -120,6 +120,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} allow-prereleases: true - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.12.0 diff --git a/.github/workflows/coverage-linux-without-intl.yml b/.github/workflows/coverage-linux-without-intl.yml index 25445b760ad9f4..64f8fe1ff3161e 100644 --- a/.github/workflows/coverage-linux-without-intl.yml +++ b/.github/workflows/coverage-linux-without-intl.yml @@ -37,9 +37,9 @@ env: PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying CLANG_VERSION: '19' - CC: sccache clang-19 - CXX: sccache clang++-19 - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} SCCACHE_IDLE_TIMEOUT: '0' permissions: @@ -63,6 +63,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} allow-prereleases: true - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.12.0 diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml index d2495ef60c3ef2..666f0568f4c4b7 100644 --- a/.github/workflows/coverage-linux.yml +++ b/.github/workflows/coverage-linux.yml @@ -37,9 +37,9 @@ env: PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying CLANG_VERSION: '19' - CC: sccache clang-19 - CXX: sccache clang++-19 - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} SCCACHE_IDLE_TIMEOUT: '0' permissions: @@ -63,6 +63,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} allow-prereleases: true - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.12.0 diff --git a/.github/workflows/test-internet.yml b/.github/workflows/test-internet.yml index bda70922bc5e0d..085657f1ef2db8 100644 --- a/.github/workflows/test-internet.yml +++ b/.github/workflows/test-internet.yml @@ -34,9 +34,9 @@ env: PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying CLANG_VERSION: '19' - CC: sccache clang-19 - CXX: sccache clang++-19 - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} SCCACHE_IDLE_TIMEOUT: '0' permissions: @@ -60,6 +60,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} allow-prereleases: true - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.12.0 diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 1e74796563f27d..6d49f08991cf86 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -34,9 +34,9 @@ env: PYTHON_VERSION: '3.14' FLAKY_TESTS: keep_retrying CLANG_VERSION: '19' - CC: sccache clang-19 - CXX: sccache clang++-19 - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} SCCACHE_IDLE_TIMEOUT: '0' RUSTC_VERSION: '1.82' @@ -70,6 +70,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} allow-prereleases: true - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.12.0 diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 4ba14cbd1be537..e227877f38a007 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -78,9 +78,9 @@ jobs: fail-fast: false runs-on: macos-15 env: - CC: sccache gcc - CXX: sccache g++ - SCCACHE_GHA_ENABLED: 'true' + CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} gcc + CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} g++ + SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }} SCCACHE_IDLE_TIMEOUT: '0' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -99,6 +99,7 @@ jobs: rustup override set "$RUSTC_VERSION" rustup --version - name: Set up sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 with: version: v0.12.0 diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 101001ea64e16e..23f4c1bef60e9d 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -175,6 +175,7 @@ jobs: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Configure sccache + if: github.base_ref == 'main' || github.ref_name == 'main' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: |