Skip to content

Commit 2a07c57

Browse files
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.
1 parent 8f76e01 commit 2a07c57

7 files changed

Lines changed: 59 additions & 7 deletions

File tree

.github/actions/keynote-bench-setup/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ runs:
1919
shell: bash
2020
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
2121

22+
- name: Set up sccache
23+
uses: mozilla-actions/sccache-action@v0.0.10
24+
25+
- name: Enable sccache
26+
shell: bash
27+
run: |
28+
echo "SCCACHE_GHA_ENABLED=true" >>"$GITHUB_ENV"
29+
echo "RUSTC_WRAPPER=sccache" >>"$GITHUB_ENV"
30+
2231
- name: Cache Rust dependencies
2332
uses: Swatinem/rust-cache@v2
2433
with:

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ jobs:
110110
- name: Set default rust toolchain
111111
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
112112

113+
- name: Set up sccache
114+
uses: mozilla-actions/sccache-action@v0.0.10
115+
116+
- name: Enable sccache
117+
shell: bash
118+
run: |
119+
echo "SCCACHE_GHA_ENABLED=true" >>"$GITHUB_ENV"
120+
echo "RUSTC_WRAPPER=sccache" >>"$GITHUB_ENV"
121+
113122
- name: Cache Rust dependencies
114123
uses: Swatinem/rust-cache@v2
115124
with:
@@ -428,16 +437,24 @@ jobs:
428437
- name: Set default rust toolchain
429438
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
430439

440+
- name: Set up sccache
441+
uses: mozilla-actions/sccache-action@v0.0.10
442+
443+
- name: Enable sccache
444+
run: |
445+
echo "SCCACHE_GHA_ENABLED=true" >>"$GITHUB_ENV"
446+
echo "RUSTC_WRAPPER=sccache" >>"$GITHUB_ENV"
447+
431448
- name: Cache Rust dependencies
432449
uses: Swatinem/rust-cache@v2
433450
with:
434451
workspaces: ${{ github.workspace }}
435-
shared-key: spacetimedb
436-
save-if: false
452+
shared-key: spacetimedb-index-scan
453+
cache-on-failure: false
437454
prefix-key: v1
438455

439456
- name: Run index scan benchmark regression check
440-
run: cargo bench -p spacetimedb-bench --bench index_scan_gate
457+
run: cargo run --release -p spacetimedb-index-scan-gate
441458

442459
lints:
443460
needs: [merge_queue_noop]

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ members = [
1919
"crates/expr",
2020
"crates/guard",
2121
"crates/fs-utils",
22+
"crates/index-scan-gate",
2223
"crates/lib",
2324
"crates/metrics",
2425
"crates/paths",

crates/bench/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ harness = false
3030
name = "index"
3131
harness = false
3232

33-
[[bench]]
34-
name = "index_scan_gate"
35-
harness = false
36-
3733
[[bin]]
3834
name = "summarize"
3935

crates/index-scan-gate/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "spacetimedb-index-scan-gate"
3+
version.workspace = true
4+
edition.workspace = true
5+
license-file = "../../licenses/BSL.txt"
6+
publish = false
7+
8+
[dependencies]
9+
anyhow.workspace = true
10+
spacetimedb-sats.workspace = true
11+
spacetimedb-testing = { path = "../testing" }
12+
13+
[target.'cfg(not(target_env = "msvc"))'.dependencies]
14+
tikv-jemallocator.workspace = true
15+
16+
[lints]
17+
workspace = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::disallowed_macros)]
2+
13
use std::time::Duration;
24

35
use anyhow::{bail, Context, Result};

0 commit comments

Comments
 (0)