From bb575a2b589e1bd795ff06542e510badf438b1d9 Mon Sep 17 00:00:00 2001 From: StreamKit Devin Date: Sat, 25 Apr 2026 14:08:20 +0000 Subject: [PATCH] ci: enable sccache GHA backend and optimize rust-cache keys - Add SCCACHE_GHA_ENABLED=true to all Rust workflows so sccache uses the GitHub Actions cache API instead of local disk (which is empty on each ephemeral runner, causing 0% hit rate). - Add RUSTC_WRAPPER=sccache to release.yml and marketplace-build.yml where it was missing (sccache was installed but never used). - Use shared-key in Swatinem/rust-cache to group jobs with similar compilation profiles: skit (lint/test/build), skit-e2e (pipeline-validation/playwright), skit-gpu (GPU jobs). This reduces 7 independent cache namespaces to 3. - Add save-if on hosted runner jobs so rust-cache is only saved from main branch runs. PR runs still restore from main cache; sccache handles the delta for changed crates. - Enable cache-on-failure everywhere so partially-completed builds still contribute to the cache. Signed-off-by: StreamKit Devin Co-Authored-By: Claudio Costa --- .github/workflows/e2e.yml | 12 ++++++++++++ .github/workflows/marketplace-build.yml | 2 ++ .github/workflows/plugins.yml | 1 + .github/workflows/release.yml | 4 ++++ .github/workflows/skit.yml | 16 ++++++++++++++++ 5 files changed, 35 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 602a4520..2f0eed72 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -10,6 +10,7 @@ on: env: CARGO_TERM_COLOR: always RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: "true" jobs: pipeline-validation: @@ -48,6 +49,10 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit-e2e + save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true - name: Install system dependencies run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm cmake ninja-build yasm meson ffmpeg @@ -121,6 +126,9 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit-gpu + cache-on-failure: true - name: Install system dependencies run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm cmake ninja-build yasm meson ffmpeg libopus-dev pkg-config libssl-dev @@ -234,6 +242,10 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit-e2e + save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true - name: Install system dependencies (libvpx for VP9, nasm for AV1 assembly, meson for dav1d) run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm cmake ninja-build yasm meson diff --git a/.github/workflows/marketplace-build.yml b/.github/workflows/marketplace-build.yml index b48a211b..ebbf91ec 100644 --- a/.github/workflows/marketplace-build.yml +++ b/.github/workflows/marketplace-build.yml @@ -26,6 +26,8 @@ on: env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 + RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: "true" SHERPA_ONNX_VERSION: "1.12.17" MINISIGN_DEB_URL: "http://launchpadlibrarian.net/780165111/minisign_0.12-1_amd64.deb" REGISTRY_BASE_URL: ${{ inputs.registry_base_url || 'https://streamkit.dev/registry' }} diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index b5310699..619de6b4 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -13,6 +13,7 @@ env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: "true" SHERPA_ONNX_VERSION: "1.12.17" ONNXRUNTIME_VERSION: "1.22.0" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32a4a151..e9da1dbf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,8 @@ on: env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 + RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: "true" jobs: build-linux-x64: @@ -55,6 +57,8 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true - name: Install system dependencies (libvpx for VP9, cmake + nasm for AV1 static build) run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm cmake diff --git a/.github/workflows/skit.yml b/.github/workflows/skit.yml index 2356ce04..abbd6476 100644 --- a/.github/workflows/skit.yml +++ b/.github/workflows/skit.yml @@ -7,6 +7,7 @@ env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 RUSTC_WRAPPER: sccache + SCCACHE_GHA_ENABLED: "true" jobs: lint: @@ -49,6 +50,10 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit + save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true - name: Check formatting run: cargo fmt --all -- --check @@ -106,6 +111,10 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit + save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true - name: Run tests (GPU tests run separately on self-hosted runner) run: | @@ -137,6 +146,9 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit-gpu + cache-on-failure: true - name: Run GPU tests env: @@ -198,6 +210,10 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - uses: Swatinem/rust-cache@v2 + with: + shared-key: skit + save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true - name: Build all crates run: |