Skip to content

Commit fc3baf3

Browse files
srperensclaude
andauthored
ci: build without sccache when S3 credentials are unavailable (#623)
Dependabot- and fork-triggered workflow runs do not receive Actions secrets, so sccache started with empty S3 credentials and hard-failed every job with InvalidAccessKeyId. Gate RUSTC_WRAPPER on the secret being present (set once at workflow level instead of per step) and skip the sccache setup step when credentials are missing, so those runs build without the compile cache instead of failing. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ca1bda5 commit fc3baf3

1 file changed

Lines changed: 10 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ env:
2424
SCCACHE_S3_USE_SSL: "true"
2525
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_S3_ACCESS_KEY_ID }}
2626
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_S3_SECRET_ACCESS_KEY }}
27+
# Dependabot- and fork-triggered runs don't receive Actions secrets, and
28+
# sccache hard-fails on empty S3 credentials. Fall back to building without
29+
# the compile cache instead (cargo ignores an empty RUSTC_WRAPPER).
30+
RUSTC_WRAPPER: ${{ secrets.SCCACHE_S3_ACCESS_KEY_ID != '' && 'sccache' || '' }}
2731

2832
jobs:
2933
# Fast checks on Linux: fmt + clippy + test
@@ -59,30 +63,23 @@ jobs:
5963
save-if: ${{ github.ref == 'refs/heads/main' }}
6064

6165
- name: Setup sccache
66+
if: env.AWS_ACCESS_KEY_ID != ''
6267
uses: mozilla-actions/sccache-action@v0.0.10
6368

6469
- name: Check formatting
6570
run: cargo fmt --all -- --check
6671

6772
- name: Run Clippy on backend
6873
run: cargo clippy --package strom --all-targets --features efp,nvidia -- -D warnings
69-
env:
70-
RUSTC_WRAPPER: sccache
7174

7275
- name: Run Clippy on MCP server
7376
run: cargo clippy --package strom-mcp-server --all-targets -- -D warnings
74-
env:
75-
RUSTC_WRAPPER: sccache
7677

7778
- name: Run tests on backend
7879
run: cargo test --package strom --features efp,nvidia
79-
env:
80-
RUSTC_WRAPPER: sccache
8180

8281
- name: Run tests on MCP server
8382
run: cargo test --package strom-mcp-server
84-
env:
85-
RUSTC_WRAPPER: sccache
8683

8784
# WASM: clippy + build frontend
8885
check-wasm:
@@ -118,19 +115,16 @@ jobs:
118115
save-if: ${{ github.ref == 'refs/heads/main' }}
119116

120117
- name: Setup sccache
118+
if: env.AWS_ACCESS_KEY_ID != ''
121119
uses: mozilla-actions/sccache-action@v0.0.10
122120

123121
- name: Run Clippy on frontend
124122
run: cargo clippy --package strom-frontend --target wasm32-unknown-unknown --all-features -- -D warnings
125-
env:
126-
RUSTC_WRAPPER: sccache
127123

128124
- name: Build frontend
129125
run: |
130126
cd frontend
131127
trunk build --release
132-
env:
133-
RUSTC_WRAPPER: sccache
134128
135129
- name: Upload frontend dist
136130
uses: actions/upload-artifact@v7
@@ -187,6 +181,7 @@ jobs:
187181
uses: dtolnay/rust-toolchain@stable
188182

189183
- name: Setup sccache
184+
if: env.AWS_ACCESS_KEY_ID != ''
190185
uses: mozilla-actions/sccache-action@v0.0.10
191186

192187
# Must NOT share a key with check-linux: rust-cache saves only once per
@@ -242,8 +237,6 @@ jobs:
242237
fi
243238
tar -xJ -C /tmp -f /tmp/cargo-zigbuild.tar.xz
244239
install -m 0755 /tmp/cargo-zigbuild-x86_64-unknown-linux-gnu/cargo-zigbuild "$HOME/.cargo/bin/cargo-zigbuild"
245-
env:
246-
RUSTC_WRAPPER: sccache
247240
248241
# Cached apt install — avoids re-downloading the GStreamer dev stack
249242
# (~1 min) on every build. The package list must stay identical to
@@ -264,7 +257,6 @@ jobs:
264257
- name: Build
265258
env:
266259
RUSTFLAGS: "-L /usr/lib/x86_64-linux-gnu"
267-
RUSTC_WRAPPER: sccache
268260
run: |
269261
cargo zigbuild --release --package strom --features efp --target x86_64-unknown-linux-gnu.2.31
270262
cargo zigbuild --release --package strom-mcp-server --target x86_64-unknown-linux-gnu.2.31
@@ -304,6 +296,7 @@ jobs:
304296
uses: dtolnay/rust-toolchain@stable
305297

306298
- name: Setup sccache
299+
if: env.AWS_ACCESS_KEY_ID != ''
307300
uses: mozilla-actions/sccache-action@v0.0.10
308301

309302
# save-if main: see check-linux.
@@ -352,8 +345,6 @@ jobs:
352345
fi
353346
tar -xJ -C /tmp -f /tmp/cargo-zigbuild.tar.xz
354347
install -m 0755 /tmp/cargo-zigbuild-aarch64-unknown-linux-gnu/cargo-zigbuild "$HOME/.cargo/bin/cargo-zigbuild"
355-
env:
356-
RUSTC_WRAPPER: sccache
357348
358349
# Cached apt install — avoids re-downloading the GStreamer dev stack
359350
# (~1 min) on every build. The package list must stay identical to
@@ -374,7 +365,6 @@ jobs:
374365
- name: Build
375366
env:
376367
RUSTFLAGS: "-L /usr/lib/aarch64-linux-gnu"
377-
RUSTC_WRAPPER: sccache
378368
run: |
379369
cargo zigbuild --release --package strom --features efp --target aarch64-unknown-linux-gnu.2.31
380370
cargo zigbuild --release --package strom-mcp-server --target aarch64-unknown-linux-gnu.2.31
@@ -450,28 +440,23 @@ jobs:
450440
# stale or evicted by the next manual run. sccache via MinIO covers
451441
# recompiles instead.
452442
- name: Setup sccache
443+
if: env.AWS_ACCESS_KEY_ID != ''
453444
uses: mozilla-actions/sccache-action@v0.0.10
454445

455446
- name: Run Clippy
456447
run: |
457448
cargo clippy --package strom --features nvidia -- -D warnings
458449
cargo clippy --package strom-mcp-server -- -D warnings
459-
env:
460-
RUSTC_WRAPPER: sccache
461450
462451
- name: Run tests
463452
run: |
464453
cargo test --package strom --features nvidia
465454
cargo test --package strom-mcp-server
466-
env:
467-
RUSTC_WRAPPER: sccache
468455
469456
- name: Build
470457
run: |
471458
cargo build --release --package strom
472459
cargo build --release --package strom-mcp-server
473-
env:
474-
RUSTC_WRAPPER: sccache
475460
476461
- name: Upload backend binary
477462
uses: actions/upload-artifact@v7
@@ -525,28 +510,23 @@ jobs:
525510

526511
# No rust-cache here: workflow_dispatch-only, see the Windows job.
527512
- name: Setup sccache
513+
if: env.AWS_ACCESS_KEY_ID != ''
528514
uses: mozilla-actions/sccache-action@v0.0.10
529515

530516
- name: Run Clippy
531517
run: |
532518
cargo clippy --package strom --features efp,nvidia -- -D warnings
533519
cargo clippy --package strom-mcp-server -- -D warnings
534-
env:
535-
RUSTC_WRAPPER: sccache
536520
537521
- name: Run tests
538522
run: |
539523
cargo test --package strom --features efp,nvidia
540524
cargo test --package strom-mcp-server
541-
env:
542-
RUSTC_WRAPPER: sccache
543525
544526
- name: Build
545527
run: |
546528
cargo build --release --package strom --features efp
547529
cargo build --release --package strom-mcp-server
548-
env:
549-
RUSTC_WRAPPER: sccache
550530
551531
- name: Upload backend binary
552532
uses: actions/upload-artifact@v7

0 commit comments

Comments
 (0)