Skip to content

Commit 3314ea7

Browse files
committed
fix: make sccache optional to handle cache service outages
sccache now gracefully falls back to regular compilation when GitHub Actions cache service is unavailable. Changes: - Remove global RUSTC_WRAPPER env var - Add continue-on-error to sccache setup - Only set RUSTC_WRAPPER if sccache is available and working This prevents build failures during GitHub infrastructure issues.
1 parent 92a19f0 commit 3314ea7

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
env:
1010
CARGO_TERM_COLOR: always
1111
RUST_BACKTRACE: 1
12-
SCCACHE_GHA_ENABLED: "true"
13-
RUSTC_WRAPPER: "sccache"
1412

1513
jobs:
1614
fmt:
@@ -43,6 +41,13 @@ jobs:
4341
components: clippy
4442
- name: Setup sccache
4543
uses: mozilla-actions/[email protected]
44+
continue-on-error: true
45+
- name: Configure sccache
46+
run: |
47+
if command -v sccache &> /dev/null; then
48+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
49+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
50+
fi
4651
- name: Cache cargo registry
4752
uses: actions/cache@v4
4853
with:
@@ -76,6 +81,13 @@ jobs:
7681
uses: dtolnay/rust-toolchain@stable
7782
- name: Setup sccache
7883
uses: mozilla-actions/[email protected]
84+
continue-on-error: true
85+
- name: Configure sccache
86+
run: |
87+
if command -v sccache &> /dev/null; then
88+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
89+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
90+
fi
7991
- name: Cache cargo registry
8092
uses: actions/cache@v4
8193
with:
@@ -108,6 +120,13 @@ jobs:
108120
uses: dtolnay/rust-toolchain@stable
109121
- name: Setup sccache
110122
uses: mozilla-actions/[email protected]
123+
continue-on-error: true
124+
- name: Configure sccache
125+
run: |
126+
if command -v sccache &> /dev/null; then
127+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
128+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
129+
fi
111130
- name: Cache cargo registry
112131
uses: actions/cache@v4
113132
with:

.github/workflows/release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ permissions:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14-
SCCACHE_GHA_ENABLED: "true"
15-
RUSTC_WRAPPER: "sccache"
1614

1715
jobs:
1816
build:
@@ -49,6 +47,18 @@ jobs:
4947
- name: Setup sccache
5048
if: matrix.use_cross != true
5149
uses: mozilla-actions/[email protected]
50+
continue-on-error: true
51+
52+
- name: Configure sccache env
53+
if: matrix.use_cross != true
54+
run: |
55+
if command -v sccache &> /dev/null && sccache --version &> /dev/null; then
56+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
57+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
58+
else
59+
echo "sccache not available, building without cache"
60+
fi
61+
shell: bash
5262

5363
- name: Cache cargo registry
5464
uses: actions/cache@v4

0 commit comments

Comments
 (0)