Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ jobs:
fetch-depth: 0
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
Expand Down Expand Up @@ -282,6 +284,8 @@ jobs:
with:
components: rustfmt
- uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe
- uses: taiki-e/install-action@cargo-make
- run: cargo make format-check

Expand All @@ -302,6 +306,8 @@ jobs:
toolchain: nightly-2025-10-09
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- name: Docs
run: cargo doc --workspace --all-features --no-deps --document-private-items
Expand All @@ -321,6 +327,8 @@ jobs:
components: clippy
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

# TODO: We have a bunch of platform-dependent code so should
# probably run this job on the full platform matrix
Expand Down Expand Up @@ -371,6 +379,8 @@ jobs:
toolchain: ${{ env.MSRV }}
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- name: Check MSRV all features
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
toolchain: nightly-2025-10-09
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- name: Generate Docs
run: cargo doc --workspace --all-features --no-deps
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/netsim_runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ jobs:

- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- name: Build iroh
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/patchbay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe
- name: Install cargo-make and cargo-nextest
uses: taiki-e/install-action@v2
with:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/sccache-probe/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Probe sccache backend
description: >
Verify the sccache backend is reachable; if not, unset RUSTC_WRAPPER so
the job runs without sccache rather than failing. Handles transient
outages of GHA cache (Blacksmith proxy 502, GitHub cache hiccups, etc.)
without requiring a re-run.

runs:
using: composite
steps:
- name: Probe sccache backend
# Skip on Windows: our Windows runners are self-hosted hetz with
# local-disk sccache (no GHA backend → no 502s to handle), and
# `shell: bash` on those runners resolves to the WSL launcher
# which fails outright. Probe only matters where SCCACHE_GHA_ENABLED
# is in play, i.e. Linux self-hosted (Blacksmith) and ubuntu-latest.
if: env.RUSTC_WRAPPER == 'sccache' && runner.os != 'Windows'
shell: bash
env:
# Cap each --start-server attempt at 5s in case sccache hangs on
# backend init. Empirically 502s from Blacksmith's GHA proxy
# already fail in ~5s; this just bounds pathological hangs.
# Two attempts × 5s = ~10s worst case. Portable across
# Linux/macOS/Windows bash (no coreutils `timeout` needed).
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "5"
run: |
# If the sccache binary isn't installed (e.g. mozilla-actions/sccache-action
# failed to download from GitHub releases), bail out fast.
if ! command -v sccache >/dev/null 2>&1; then
echo "::warning::sccache binary not found (install likely failed); running this job without sccache"
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=" >> "$GITHUB_ENV"
exit 0
fi
# sccache --start-server triggers a backend probe (.sccache_check
# read). On failure (e.g. Blacksmith's GHA cache proxy returning
# 502 Bad Gateway), the daemon won't start and every rustc call
# fails. One quick retry, then fall through to plain rustc —
# slower, but the job will still succeed.
for attempt in 1 2; do
if sccache --start-server >/dev/null 2>&1; then
echo "sccache backend OK (attempt $attempt)"
exit 0
fi
echo "sccache start failed (attempt $attempt/2)"
done
echo "::warning::sccache backend unreachable; running this job without sccache"
# mozilla-actions/sccache-action exports these via $GITHUB_ENV — override.
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the right way to clear an env variable? :O

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well 2 things happening here:
a) if it was set before you kinda need to unset it so this would be bash wise wrong
b) this is github actions and they have their funny github_env thing which I'd rather not touch more than needed and it doesn't have proper unset semantics

echo "SCCACHE_GHA_ENABLED=" >> "$GITHUB_ENV"
6 changes: 6 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ jobs:

- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- name: Select features
run: |
Expand Down Expand Up @@ -262,6 +264,8 @@ jobs:

- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- uses: msys2/setup-msys2@v2
with:
Expand Down Expand Up @@ -362,6 +366,8 @@ jobs:

- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- uses: ./.github/workflows/sccache-probe

- uses: msys2/setup-msys2@v2
with:
Expand Down
Loading