Skip to content

Commit 9cd6630

Browse files
authored
build: skip sscache action on non-main branches
To reduce cache thrashing. PR-URL: #61790 Refs: #61436 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent d5279e5 commit 9cd6630

File tree

7 files changed

+25
-18
lines changed

7 files changed

+25
-18
lines changed

.github/workflows/build-tarball.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ jobs:
100100
needs: build-tarball
101101
runs-on: ubuntu-24.04
102102
env:
103-
CC: sccache clang-19
104-
CXX: sccache clang++-19
105-
SCCACHE_GHA_ENABLED: 'true'
103+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19
104+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19
105+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
106106
SCCACHE_IDLE_TIMEOUT: '0'
107107
steps:
108108
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -120,6 +120,7 @@ jobs:
120120
python-version: ${{ env.PYTHON_VERSION }}
121121
allow-prereleases: true
122122
- name: Set up sccache
123+
if: github.base_ref == 'main' || github.ref_name == 'main'
123124
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
124125
with:
125126
version: v0.12.0

.github/workflows/coverage-linux-without-intl.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ env:
3737
PYTHON_VERSION: '3.14'
3838
FLAKY_TESTS: keep_retrying
3939
CLANG_VERSION: '19'
40-
CC: sccache clang-19
41-
CXX: sccache clang++-19
42-
SCCACHE_GHA_ENABLED: 'true'
40+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19
41+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19
42+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
4343
SCCACHE_IDLE_TIMEOUT: '0'
4444

4545
permissions:
@@ -63,6 +63,7 @@ jobs:
6363
python-version: ${{ env.PYTHON_VERSION }}
6464
allow-prereleases: true
6565
- name: Set up sccache
66+
if: github.base_ref == 'main' || github.ref_name == 'main'
6667
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6768
with:
6869
version: v0.12.0

.github/workflows/coverage-linux.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ env:
3737
PYTHON_VERSION: '3.14'
3838
FLAKY_TESTS: keep_retrying
3939
CLANG_VERSION: '19'
40-
CC: sccache clang-19
41-
CXX: sccache clang++-19
42-
SCCACHE_GHA_ENABLED: 'true'
40+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19
41+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19
42+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
4343
SCCACHE_IDLE_TIMEOUT: '0'
4444

4545
permissions:
@@ -63,6 +63,7 @@ jobs:
6363
python-version: ${{ env.PYTHON_VERSION }}
6464
allow-prereleases: true
6565
- name: Set up sccache
66+
if: github.base_ref == 'main' || github.ref_name == 'main'
6667
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6768
with:
6869
version: v0.12.0

.github/workflows/test-internet.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ env:
3434
PYTHON_VERSION: '3.14'
3535
FLAKY_TESTS: keep_retrying
3636
CLANG_VERSION: '19'
37-
CC: sccache clang-19
38-
CXX: sccache clang++-19
39-
SCCACHE_GHA_ENABLED: 'true'
37+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19
38+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19
39+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
4040
SCCACHE_IDLE_TIMEOUT: '0'
4141

4242
permissions:
@@ -60,6 +60,7 @@ jobs:
6060
python-version: ${{ env.PYTHON_VERSION }}
6161
allow-prereleases: true
6262
- name: Set up sccache
63+
if: github.base_ref == 'main' || github.ref_name == 'main'
6364
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6465
with:
6566
version: v0.12.0

.github/workflows/test-linux.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ env:
3434
PYTHON_VERSION: '3.14'
3535
FLAKY_TESTS: keep_retrying
3636
CLANG_VERSION: '19'
37-
CC: sccache clang-19
38-
CXX: sccache clang++-19
39-
SCCACHE_GHA_ENABLED: 'true'
37+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19
38+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19
39+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
4040
SCCACHE_IDLE_TIMEOUT: '0'
4141
RUSTC_VERSION: '1.82'
4242

@@ -70,6 +70,7 @@ jobs:
7070
python-version: ${{ env.PYTHON_VERSION }}
7171
allow-prereleases: true
7272
- name: Set up sccache
73+
if: github.base_ref == 'main' || github.ref_name == 'main'
7374
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
7475
with:
7576
version: v0.12.0

.github/workflows/test-macos.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ jobs:
7878
fail-fast: false
7979
runs-on: macos-15
8080
env:
81-
CC: sccache gcc
82-
CXX: sccache g++
83-
SCCACHE_GHA_ENABLED: 'true'
81+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} gcc
82+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} g++
83+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
8484
SCCACHE_IDLE_TIMEOUT: '0'
8585
steps:
8686
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -99,6 +99,7 @@ jobs:
9999
rustup override set "$RUSTC_VERSION"
100100
rustup --version
101101
- name: Set up sccache
102+
if: github.base_ref == 'main' || github.ref_name == 'main'
102103
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
103104
with:
104105
version: v0.12.0

.github/workflows/test-shared.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ jobs:
175175
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
176176

177177
- name: Configure sccache
178+
if: github.base_ref == 'main' || github.ref_name == 'main'
178179
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
179180
with:
180181
script: |

0 commit comments

Comments
 (0)