Skip to content

Commit 4751815

Browse files
committed
Use sccache-action v0.0.9 for GHA cache v2
1 parent c6ceb9c commit 4751815

2 files changed

Lines changed: 10 additions & 48 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848
run: pnpm run test
4949

5050
build-native:
51+
env:
52+
RUSTC_WRAPPER: sccache
53+
SCCACHE_GHA_ENABLED: "true"
5154
strategy:
5255
fail-fast: false
5356
matrix:
@@ -93,29 +96,7 @@ jobs:
9396
targets: ${{ matrix.target }}
9497

9598
- name: Install sccache
96-
uses: mozilla-actions/sccache-action@v0.0.7
97-
98-
- name: Configure sccache
99-
id: sccache
100-
shell: bash
101-
run: |
102-
set -euo pipefail
103-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
104-
if sccache --start-server >/dev/null 2>&1; then
105-
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
106-
echo "enabled=true" >> "$GITHUB_OUTPUT"
107-
exit 0
108-
fi
109-
110-
echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
111-
sccache --stop-server >/dev/null 2>&1 || true
112-
if sccache --start-server >/dev/null 2>&1; then
113-
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
114-
echo "enabled=true" >> "$GITHUB_OUTPUT"
115-
else
116-
echo "enabled=false" >> "$GITHUB_OUTPUT"
117-
echo "sccache unavailable; continuing without RUSTC_WRAPPER"
118-
fi
99+
uses: mozilla-actions/sccache-action@v0.0.9
119100

120101
- name: Cache Rust build
121102
uses: Swatinem/rust-cache@v2
@@ -145,5 +126,5 @@ jobs:
145126
if-no-files-found: error
146127

147128
- name: Show sccache stats
148-
if: always() && steps.sccache.outputs.enabled == 'true'
129+
if: always()
149130
run: sccache --show-stats

.github/workflows/publish.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414

1515
jobs:
1616
build-native:
17+
env:
18+
RUSTC_WRAPPER: sccache
19+
SCCACHE_GHA_ENABLED: "true"
1720
strategy:
1821
fail-fast: false
1922
matrix:
@@ -59,29 +62,7 @@ jobs:
5962
targets: ${{ matrix.target }}
6063

6164
- name: Install sccache
62-
uses: mozilla-actions/sccache-action@v0.0.7
63-
64-
- name: Configure sccache
65-
id: sccache
66-
shell: bash
67-
run: |
68-
set -euo pipefail
69-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
70-
if sccache --start-server >/dev/null 2>&1; then
71-
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
72-
echo "enabled=true" >> "$GITHUB_OUTPUT"
73-
exit 0
74-
fi
75-
76-
echo "SCCACHE_GHA_ENABLED=false" >> "$GITHUB_ENV"
77-
sccache --stop-server >/dev/null 2>&1 || true
78-
if sccache --start-server >/dev/null 2>&1; then
79-
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
80-
echo "enabled=true" >> "$GITHUB_OUTPUT"
81-
else
82-
echo "enabled=false" >> "$GITHUB_OUTPUT"
83-
echo "sccache unavailable; continuing without RUSTC_WRAPPER"
84-
fi
65+
uses: mozilla-actions/sccache-action@v0.0.9
8566

8667
- name: Cache Rust build
8768
uses: Swatinem/rust-cache@v2
@@ -111,7 +92,7 @@ jobs:
11192
if-no-files-found: error
11293

11394
- name: Show sccache stats
114-
if: always() && steps.sccache.outputs.enabled == 'true'
95+
if: always()
11596
run: sccache --show-stats
11697

11798
publish:

0 commit comments

Comments
 (0)