ci(release): stabilize sccache startup to fix slow builds

- Export ACTIONS_* env to child procs for GHAC
- Pre-stop then start sccache to avoid port races
- Set SCCACHE_IDLE_TIMEOUT for job lifespan
- Keep local dir cache as fallback via actions/cache
- Ensure RUSTC_WRAPPER and GHAC envs are set reliably
This commit is contained in:
James Peter
2025-08-24 08:55:20 +10:00
parent 4ec50832b2
commit f00ea33a1b
+11 -1
View File
@@ -132,6 +132,7 @@ jobs:
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
echo "SCCACHE_IDLE_TIMEOUT=1800" >> "$GITHUB_ENV" # keep server alive during job
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
case "${{ runner.os }}" in
macOS)
@@ -146,6 +147,13 @@ jobs:
;;
esac
# Ensure GH Actions cache credentials are inherited by child processes (sccache server)
- name: Export GH cache env for children
shell: bash
run: |
echo "ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL}" >> "$GITHUB_ENV"
echo "ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN}" >> "$GITHUB_ENV"
# ✅ Persist the local sccache directory as a shared, stable fallback across runs
- name: Cache sccache directory (fallback)
uses: actions/cache@v4
@@ -217,6 +225,8 @@ jobs:
run: |
cd codex-rs
echo "Restarting sccache server to avoid race conditions"
sccache --stop-server || true
echo "Starting sccache server (GHAC preferred)"
if ! sccache --start-server; then
echo "sccache GHAC failed to start; switching to local disk cache"
@@ -399,4 +409,4 @@ jobs:
files: |
release-assets/*
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}