Better caching for keynote and index jobs (#5475)

# Description of Changes

Moves the index scan job to its own crate to remove its dependency on
`spacetimedb-bench`. Also enables `sccache` for index, keynote, and
smoketests for caching workspace dependencies which the rust-cache isn't
optimized for.

# API and ABI breaking changes

N/A

# Expected complexity level and risk

1

# Testing

Should see better caching in CI.
This commit is contained in:
joshua-spacetime
2026-07-02 22:33:11 -07:00
committed by GitHub
parent 8f76e0180b
commit 2a07c57ba7
7 changed files with 59 additions and 7 deletions
@@ -19,6 +19,15 @@ runs:
shell: bash
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Enable sccache
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >>"$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >>"$GITHUB_ENV"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
+20 -3
View File
@@ -110,6 +110,15 @@ jobs:
- name: Set default rust toolchain
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Enable sccache
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >>"$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >>"$GITHUB_ENV"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
@@ -428,16 +437,24 @@ jobs:
- name: Set default rust toolchain
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
- name: Set up sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Enable sccache
run: |
echo "SCCACHE_GHA_ENABLED=true" >>"$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >>"$GITHUB_ENV"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ github.workspace }}
shared-key: spacetimedb
save-if: false
shared-key: spacetimedb-index-scan
cache-on-failure: false
prefix-key: v1
- name: Run index scan benchmark regression check
run: cargo bench -p spacetimedb-bench --bench index_scan_gate
run: cargo run --release -p spacetimedb-index-scan-gate
lints:
needs: [merge_queue_noop]
Generated
+10
View File
@@ -8555,6 +8555,16 @@ dependencies = [
"tempfile",
]
[[package]]
name = "spacetimedb-index-scan-gate"
version = "2.7.0"
dependencies = [
"anyhow",
"spacetimedb-sats",
"spacetimedb-testing",
"tikv-jemallocator",
]
[[package]]
name = "spacetimedb-lib"
version = "2.7.0"
+1
View File
@@ -19,6 +19,7 @@ members = [
"crates/expr",
"crates/guard",
"crates/fs-utils",
"crates/index-scan-gate",
"crates/lib",
"crates/metrics",
"crates/paths",
-4
View File
@@ -30,10 +30,6 @@ harness = false
name = "index"
harness = false
[[bench]]
name = "index_scan_gate"
harness = false
[[bin]]
name = "summarize"
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "spacetimedb-index-scan-gate"
version.workspace = true
edition.workspace = true
license-file = "../../licenses/BSL.txt"
publish = false
[dependencies]
anyhow.workspace = true
spacetimedb-sats.workspace = true
spacetimedb-testing = { path = "../testing" }
[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator.workspace = true
[lints]
workspace = true
@@ -1,3 +1,5 @@
#![allow(clippy::disallowed_macros)]
use std::time::Duration;
use anyhow::{bail, Context, Result};