Skip to content

Commit 3698f29

Browse files
committed
build: skip sscache action on non-main branches
To reduce cache thrashing.
1 parent 27ec431 commit 3698f29

File tree

7 files changed

+27
-20
lines changed

7 files changed

+27
-20
lines changed

.github/workflows/build-tarball.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ jobs:
102102
needs: build-tarball
103103
runs-on: ubuntu-24.04
104104
env:
105-
CC: sccache clang-19
106-
CXX: sccache clang++-19
107-
SCCACHE_GHA_ENABLED: 'true'
105+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang-19' || 'clang-19' }}
106+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || 'clang++-19' }}
107+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
108108
SCCACHE_IDLE_TIMEOUT: '0'
109109
steps:
110110
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -122,6 +122,7 @@ jobs:
122122
python-version: ${{ env.PYTHON_VERSION }}
123123
allow-prereleases: true
124124
- name: Set up sccache
125+
if: github.base_ref == 'main' || github.ref_name == 'main'
125126
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
126127
with:
127128
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' || 'clang-19' }}
41+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || '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' || 'clang-19' }}
41+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || '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' || 'clang-19' }}
38+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || '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' || 'clang-19' }}
38+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || '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
@@ -80,9 +80,9 @@ jobs:
8080
fail-fast: false
8181
runs-on: macos-15
8282
env:
83-
CC: sccache gcc
84-
CXX: sccache g++
85-
SCCACHE_GHA_ENABLED: 'true'
83+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache gcc' || 'gcc' }}
84+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache g++' || 'g++' }}
85+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
8686
SCCACHE_IDLE_TIMEOUT: '0'
8787
steps:
8888
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -101,6 +101,7 @@ jobs:
101101
rustup override set "$RUSTC_VERSION"
102102
rustup --version
103103
- name: Set up sccache
104+
if: github.base_ref == 'main' || github.ref_name == 'main'
104105
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
105106
with:
106107
version: v0.12.0

.github/workflows/test-shared.yml

Lines changed: 3 additions & 2 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: |
@@ -195,9 +196,9 @@ jobs:
195196
nix-shell \
196197
-I nixpkgs=./tools/nix/pkgs.nix \
197198
--pure --keep TAR_DIR --keep FLAKY_TESTS \
198-
--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
199+
${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN' || '' }} \
199200
--arg loadJSBuiltinsDynamically false \
200-
--arg ccache '(import <nixpkgs> {}).sccache' \
201+
${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--arg ccache ''(import <nixpkgs> {}).sccache''' || '' }} \
201202
--arg devTools '[]' \
202203
--arg benchmarkTools '[]' \
203204
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}

0 commit comments

Comments
 (0)