Skip to content

Commit dccdbc3

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 686d70d commit dccdbc3

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
steps:
7373
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7474
with:
@@ -80,6 +80,7 @@ jobs:
8080
with:
8181
python-version: ${{ env.PYTHON_VERSION }}
8282
- name: Set up sccache
83+
if: github.base_ref == 'main' || github.ref_name == 'main'
8384
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
8485
with:
8586
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

4343
permissions:
4444
contents: read
@@ -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

4343
permissions:
4444
contents: read
@@ -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

4040
permissions:
4141
contents: read
@@ -53,6 +53,7 @@ jobs:
5353
with:
5454
python-version: ${{ env.PYTHON_VERSION }}
5555
- name: Set up sccache
56+
if: github.base_ref == 'main' || github.ref_name == 'main'
5657
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
5758
with:
5859
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

3838
permissions:
3939
contents: read
@@ -56,6 +56,7 @@ jobs:
5656
with:
5757
python-version: ${{ env.PYTHON_VERSION }}
5858
- name: Set up sccache
59+
if: github.base_ref == 'main' || github.ref_name == 'main'
5960
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
6061
with:
6162
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
steps:
5252
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5353
with:
@@ -60,6 +60,7 @@ jobs:
6060
- name: Set up Xcode ${{ env.XCODE_VERSION }}
6161
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
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

0 commit comments

Comments
 (0)