Skip to content

Commit f7d010e

Browse files
committed
chore(ci): cache local sccache state in manual workflows
Stop relying on the sccache GitHub Actions backend in the manual verify, write-generated, and release-build workflows. Restore and save ~/.cache/sccache with actions/cache instead, and configure RUSTC_WRAPPER with SCCACHE_DIR so the manual jobs can compile reliably on the fork runners.
1 parent a728501 commit f7d010e

File tree

3 files changed

+76
-4
lines changed

3 files changed

+76
-4
lines changed

.github/workflows/manual-release-build.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ jobs:
6767
manual-release-linux-cargo-home-${{ steps.lockhash.outputs.hash }}-
6868
manual-release-linux-cargo-home-
6969
70+
- name: Restore sccache cache
71+
id: cache_sccache_restore
72+
uses: actions/cache/restore@v5
73+
with:
74+
path: ~/.cache/sccache
75+
key: manual-release-linux-sccache-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
76+
restore-keys: |
77+
manual-release-linux-sccache-${{ steps.lockhash.outputs.hash }}-
78+
manual-release-linux-sccache-
79+
7080
- name: Install sccache
7181
uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532
7282
with:
@@ -83,8 +93,8 @@ jobs:
8393
shell: bash
8494
run: |
8595
set -euo pipefail
86-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
8796
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
97+
echo "SCCACHE_DIR=$HOME/.cache/sccache" >> "$GITHUB_ENV"
8898
8999
- name: Pre-warm dependency cache (cargo-chef)
90100
shell: bash
@@ -141,6 +151,14 @@ jobs:
141151
~/.cargo/git/db/
142152
key: manual-release-linux-cargo-home-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
143153

154+
- name: Save sccache cache
155+
if: always() && !cancelled() && steps.cache_sccache_restore.outputs.cache-hit != 'true'
156+
continue-on-error: true
157+
uses: actions/cache/save@v5
158+
with:
159+
path: ~/.cache/sccache
160+
key: manual-release-linux-sccache-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
161+
144162
macos_intel:
145163
name: Release build — x86_64-apple-darwin
146164
if: ${{ inputs.build_macos_intel }}
@@ -179,6 +197,16 @@ jobs:
179197
manual-release-macos-intel-cargo-home-${{ steps.lockhash.outputs.hash }}-
180198
manual-release-macos-intel-cargo-home-
181199
200+
- name: Restore sccache cache
201+
id: cache_sccache_restore
202+
uses: actions/cache/restore@v5
203+
with:
204+
path: ~/.cache/sccache
205+
key: manual-release-macos-intel-sccache-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
206+
restore-keys: |
207+
manual-release-macos-intel-sccache-${{ steps.lockhash.outputs.hash }}-
208+
manual-release-macos-intel-sccache-
209+
182210
- name: Install sccache
183211
uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532
184212
with:
@@ -195,8 +223,8 @@ jobs:
195223
shell: bash
196224
run: |
197225
set -euo pipefail
198-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
199226
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
227+
echo "SCCACHE_DIR=$HOME/.cache/sccache" >> "$GITHUB_ENV"
200228
201229
- name: Pre-warm dependency cache (cargo-chef)
202230
shell: bash
@@ -252,3 +280,11 @@ jobs:
252280
~/.cargo/registry/cache/
253281
~/.cargo/git/db/
254282
key: manual-release-macos-intel-cargo-home-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
283+
284+
- name: Save sccache cache
285+
if: always() && !cancelled() && steps.cache_sccache_restore.outputs.cache-hit != 'true'
286+
continue-on-error: true
287+
uses: actions/cache/save@v5
288+
with:
289+
path: ~/.cache/sccache
290+
key: manual-release-macos-intel-sccache-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}

.github/workflows/manual-verify.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ jobs:
6565
manual-verify-cargo-home-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-
6666
manual-verify-cargo-home-${{ runner.os }}-
6767
68+
- name: Restore sccache cache
69+
id: cache_sccache_restore
70+
uses: actions/cache/restore@v5
71+
with:
72+
path: ~/.cache/sccache
73+
key: manual-verify-sccache-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
74+
restore-keys: |
75+
manual-verify-sccache-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-
76+
manual-verify-sccache-${{ runner.os }}-
77+
6878
- name: Install sccache
6979
uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532
7080
with:
@@ -80,8 +90,8 @@ jobs:
8090
shell: bash
8191
run: |
8292
set -euo pipefail
83-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
8493
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
94+
echo "SCCACHE_DIR=$HOME/.cache/sccache" >> "$GITHUB_ENV"
8595
8696
- name: cargo fmt --check
8797
run: cargo fmt -- --config imports_granularity=Item --check
@@ -116,3 +126,11 @@ jobs:
116126
~/.cargo/registry/cache/
117127
~/.cargo/git/db/
118128
key: manual-verify-cargo-home-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
129+
130+
- name: Save sccache cache
131+
if: always() && !cancelled() && steps.cache_sccache_restore.outputs.cache-hit != 'true'
132+
continue-on-error: true
133+
uses: actions/cache/save@v5
134+
with:
135+
path: ~/.cache/sccache
136+
key: manual-verify-sccache-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}

.github/workflows/manual-write-generated.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ jobs:
7575
manual-write-generated-cargo-home-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-
7676
manual-write-generated-cargo-home-${{ runner.os }}-
7777
78+
- name: Restore sccache cache
79+
id: cache_sccache_restore
80+
uses: actions/cache/restore@v5
81+
with:
82+
path: ~/.cache/sccache
83+
key: manual-write-generated-sccache-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
84+
restore-keys: |
85+
manual-write-generated-sccache-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-
86+
manual-write-generated-sccache-${{ runner.os }}-
87+
7888
- name: Install sccache
7989
uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532
8090
with:
@@ -85,8 +95,8 @@ jobs:
8595
shell: bash
8696
run: |
8797
set -euo pipefail
88-
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
8998
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
99+
echo "SCCACHE_DIR=$HOME/.cache/sccache" >> "$GITHUB_ENV"
90100
91101
- name: Write config schema
92102
if: ${{ inputs.write_config_schema }}
@@ -143,3 +153,11 @@ jobs:
143153
~/.cargo/registry/cache/
144154
~/.cargo/git/db/
145155
key: manual-write-generated-cargo-home-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
156+
157+
- name: Save sccache cache
158+
if: always() && !cancelled() && steps.cache_sccache_restore.outputs.cache-hit != 'true'
159+
continue-on-error: true
160+
uses: actions/cache/save@v5
161+
with:
162+
path: ~/.cache/sccache
163+
key: manual-write-generated-sccache-${{ runner.os }}-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}

0 commit comments

Comments
 (0)