Skip to content

Commit 60bf051

Browse files
joyeecheungaduh95
authored andcommitted
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 5cfc065 commit 60bf051

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

.github/workflows/build-tarball.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ jobs:
6666
needs: build-tarball
6767
runs-on: ubuntu-24.04
6868
env:
69-
CC: sccache clang
70-
CXX: sccache clang++
71-
SCCACHE_GHA_ENABLED: 'true'
69+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
70+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
71+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
7272
SCCACHE_IDLE_TIMEOUT: '0'
7373
steps:
7474
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -81,6 +81,7 @@ jobs:
8181
with:
8282
python-version: ${{ env.PYTHON_VERSION }}
8383
- name: Set up sccache
84+
if: github.base_ref == 'main' || github.ref_name == 'main'
8485
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
8586
with:
8687
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
@@ -36,9 +36,9 @@ concurrency:
3636
env:
3737
PYTHON_VERSION: '3.14'
3838
FLAKY_TESTS: keep_retrying
39-
CC: sccache clang
40-
CXX: sccache clang++
41-
SCCACHE_GHA_ENABLED: 'true'
39+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
40+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
41+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
4242
SCCACHE_IDLE_TIMEOUT: '0'
4343

4444
permissions:
@@ -57,6 +57,7 @@ jobs:
5757
with:
5858
python-version: ${{ env.PYTHON_VERSION }}
5959
- name: Set up sccache
60+
if: github.base_ref == 'main' || github.ref_name == 'main'
6061
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6162
with:
6263
version: v0.12.0

.github/workflows/coverage-linux.yml

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

4444
permissions:
@@ -57,6 +57,7 @@ jobs:
5757
with:
5858
python-version: ${{ env.PYTHON_VERSION }}
5959
- name: Set up sccache
60+
if: github.base_ref == 'main' || github.ref_name == 'main'
6061
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6162
with:
6263
version: v0.12.0

.github/workflows/test-internet.yml

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

4141
permissions:
@@ -54,6 +54,7 @@ jobs:
5454
with:
5555
python-version: ${{ env.PYTHON_VERSION }}
5656
- name: Set up sccache
57+
if: github.base_ref == 'main' || github.ref_name == 'main'
5758
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
5859
with:
5960
version: v0.12.0

.github/workflows/test-linux.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ concurrency:
3131
env:
3232
PYTHON_VERSION: '3.14'
3333
FLAKY_TESTS: keep_retrying
34-
CC: sccache clang
35-
CXX: sccache clang++
36-
SCCACHE_GHA_ENABLED: 'true'
34+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
35+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
36+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
3737
SCCACHE_IDLE_TIMEOUT: '0'
3838

3939
permissions:
@@ -57,6 +57,7 @@ jobs:
5757
with:
5858
python-version: ${{ env.PYTHON_VERSION }}
5959
- name: Set up sccache
60+
if: github.base_ref == 'main' || github.ref_name == 'main'
6061
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6162
with:
6263
version: v0.12.0

.github/workflows/test-macos.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
fail-fast: false
4646
runs-on: macos-14
4747
env:
48-
CC: sccache gcc
49-
CXX: sccache g++
50-
SCCACHE_GHA_ENABLED: 'true'
48+
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} gcc
49+
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} g++
50+
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
5151
SCCACHE_IDLE_TIMEOUT: '0'
5252
steps:
5353
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -61,6 +61,7 @@ jobs:
6161
- name: Set up Xcode ${{ env.XCODE_VERSION }}
6262
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
6363
- name: Set up sccache
64+
if: github.base_ref == 'main' || github.ref_name == 'main'
6465
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6566
with:
6667
version: v0.12.0

0 commit comments

Comments
 (0)