From e8fcfdc7d3aa6c840f62e8b66e8598f4e15da247 Mon Sep 17 00:00:00 2001 From: joshua-spacetime Date: Wed, 12 Aug 2026 13:45:28 -0700 Subject: [PATCH 1/2] Remove Swatinem/rust-cache And add v8 and openssl cache restore to dependent jobs. --- .../actions/keynote-bench-setup/action.yml | 22 -- .github/workflows/ci.yml | 273 ++++++------------ .github/workflows/llm-benchmark-periodic.yml | 24 +- .../llm-benchmark-validate-goldens.yml | 24 +- .github/workflows/release.yml | 5 - 5 files changed, 127 insertions(+), 221 deletions(-) diff --git a/.github/actions/keynote-bench-setup/action.yml b/.github/actions/keynote-bench-setup/action.yml index 95eb487e0f0..d2c006070c1 100644 --- a/.github/actions/keynote-bench-setup/action.yml +++ b/.github/actions/keynote-bench-setup/action.yml @@ -6,9 +6,6 @@ inputs: description: Path to the public SpacetimeDB checkout in the caller workspace required: false default: . - rust_cache_workspaces: - description: Workspace paths passed to Swatinem/rust-cache - required: true runs: using: composite @@ -19,25 +16,6 @@ runs: shell: bash run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ inputs.rust_cache_workspaces }} - shared-key: spacetimedb - save-if: false - prefix-key: v1 - - - name: Check v8 outputs - shell: bash - run: | - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean --release -p v8 || true - cargo build --release -p v8 - fi - working-directory: ${{ inputs.public_root }} - - name: Build public keynote benchmark binaries shell: bash run: cargo build --release -p spacetimedb-cli -p spacetimedb-standalone diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e77246e316..7d2e1cc99ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,8 @@ jobs: # The v8 version is fixed and needs to be manually kept in sync with Cargo.lock. # It should hardly ever be updated, so prefer this over more auto-derivation machinery. # The target triple identifies OS and ABI. - # CI always uses release with default features, so no other inputs are needed. + # Release CI uses default features, so no other inputs are needed. Debug has a + # separate key because Cargo stores the native output under a different profile. - &cache-rusty-v8 name: Cache rusty_v8 uses: actions/cache@v4 @@ -127,6 +128,27 @@ jobs: path: ${{ env.CARGO_TARGET_DIR }}/release/gn_out/obj key: rusty-v8-v1-145.0.0-${{ env.TARGET_TRIPLE }} + - &cache-rusty-v8-debug + name: Cache rusty_v8 (debug) + uses: actions/cache@v4 + with: + path: ${{ env.CARGO_TARGET_DIR }}/debug/gn_out/obj + key: rusty-v8-debug-v1-145.0.0-${{ env.TARGET_TRIPLE }} + + - &restore-rusty-v8 + name: Restore rusty_v8 + uses: actions/cache/restore@v4 + with: + path: ${{ env.CARGO_TARGET_DIR }}/release/gn_out/obj + key: rusty-v8-v1-145.0.0-${{ env.TARGET_TRIPLE }} + + - &restore-rusty-v8-debug + name: Restore rusty_v8 (debug) + uses: actions/cache/restore@v4 + with: + path: ${{ env.CARGO_TARGET_DIR }}/debug/gn_out/obj + key: rusty-v8-debug-v1-145.0.0-${{ env.TARGET_TRIPLE }} + # v1 is a manual schema for invalidating this cache if its layout changes. # The openssl-src version in fixed and needs to be manually kept in sync with Cargo.lock. # It should hardly ever be updated, so prefer this over more auto-derivation machinery. @@ -149,6 +171,14 @@ jobs: echo "OPENSSL_NO_VENDOR=1" >>"$GITHUB_ENV" echo "OPENSSL_DIR=${{ github.workspace }}/.ci-cache/openssl" >>"$GITHUB_ENV" + - &restore-openssl + name: Restore OpenSSL + id: cache-openssl + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/.ci-cache/openssl + key: openssl-v1-300.5.3+3.5.4-${{ env.TARGET_TRIPLE }}${{ env.OPENSSL_CACHE_SUFFIX }} + - name: Build CLI and standalone shell: bash run: | @@ -234,8 +264,8 @@ jobs: - *set-default-rust-toolchain - *verify-openssl-assembler - - *cache-rusty-v8 - - *cache-openssl + - *restore-rusty-v8 + - *restore-openssl - *configure-cached-openssl - name: Install cargo-nextest @@ -492,6 +522,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Find Git ref env: @@ -513,24 +545,10 @@ jobs: - uses: dsherret/rust-toolchain-file@v1 - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the smoketests job save the cache since it builds the most things - save-if: false - prefix-key: v1 - - - name: Check v8 outputs - shell: bash - run: | - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean --release -p v8 || true - cargo build --release -p v8 - fi + - *restore-rusty-v8-debug + - *restore-rusty-v8 + - *restore-openssl + - *configure-cached-openssl - uses: actions/setup-dotnet@v3 with: @@ -597,6 +615,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Find Git ref env: @@ -619,13 +639,9 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb-index-scan - cache-on-failure: false - prefix-key: v1 + - *restore-rusty-v8 + - *restore-openssl + - *configure-cached-openssl - name: Run index scan benchmark regression check run: cargo run --release -p spacetimedb-index-scan-gate @@ -638,6 +654,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Checkout sources uses: actions/checkout@v3 @@ -647,14 +665,9 @@ jobs: run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - run: echo ::add-matcher::.github/workflows/rust_matcher.json - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the smoketests job save the cache since it builds the most things - save-if: false - prefix-key: v1 + - *cache-rusty-v8-debug + - *restore-openssl + - *configure-cached-openssl - uses: actions/setup-dotnet@v3 with: @@ -700,14 +713,6 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - save-if: false - prefix-key: v1 - - name: Run CODEOWNERS check run: | cargo ci other-workflows codeowners-check \ @@ -722,6 +727,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - uses: actions/checkout@v3 @@ -730,14 +737,9 @@ jobs: run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - run: echo ::add-matcher::.github/workflows/rust_matcher.json - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the smoketests job save the cache since it builds the most things - save-if: false - prefix-key: v1 + - *restore-rusty-v8-debug + - *restore-openssl + - *configure-cached-openssl - name: Set up Node.js uses: actions/setup-node@v4 @@ -962,15 +964,6 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the smoketests job save the cache since it builds the most things - save-if: false - prefix-key: v1 - - name: Check for docs change run: | cargo ci cli-docs @@ -988,6 +981,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" UNITY_VERSION: 2022.3.32f1 steps: - name: Checkout repository @@ -1041,28 +1036,9 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the main CI job save the cache since it builds the most things - save-if: false - prefix-key: v1 - - # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a. - # ChatGPT suspects that this could be due to different build invocations using the same target dir, - # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with - # `cargo build --manifest-path` (which apparently build different dependency trees). - # However, we've been unable to fix it so... /shrug - - name: Check v8 outputs - run: | - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean --release -p v8 || true - cargo build --release -p v8 - fi + - *restore-rusty-v8 + - *restore-openssl + - *configure-cached-openssl - name: Install SpacetimeDB CLI from the local checkout run: | @@ -1141,6 +1117,8 @@ jobs: runs-on: spacetimedb-new-runner-2 env: CARGO_TARGET_DIR: ${{ github.workspace }}/target + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" UseLocalBsatnRuntime: true steps: - name: Checkout repository @@ -1182,28 +1160,9 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the main CI job save the cache since it builds the most things - save-if: false - prefix-key: v1 - - # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a. - # ChatGPT suspects that this could be due to different build invocations using the same target dir, - # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with - # `cargo build --manifest-path` (which apparently build different dependency trees). - # However, we've been unable to fix it so... /shrug - - name: Check v8 outputs - run: | - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean --release -p v8 || true - cargo build --release -p v8 - fi + - *restore-rusty-v8 + - *restore-openssl + - *configure-cached-openssl - name: Install SpacetimeDB CLI from the local checkout run: | @@ -1269,6 +1228,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Checkout repository id: checkout-stdb @@ -1320,34 +1281,10 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the main CI job save the cache since it builds the most things - save-if: false - prefix-key: v1 - - # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a. - # ChatGPT suspects that this could be due to different build invocations using the same target dir, - # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with - # `cargo build --manifest-path` (which apparently build different dependency trees). - # However, we've been unable to fix it so... /shrug - - name: Check v8 outputs - run: | - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean -p v8 || true - cargo build -p v8 - fi - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean --release -p v8 || true - cargo build --release -p v8 - fi + - *restore-rusty-v8-debug + - *restore-rusty-v8 + - *restore-openssl + - *configure-cached-openssl - name: Install SpacetimeDB CLI from the local checkout run: | @@ -1436,14 +1373,6 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - save-if: false - prefix-key: v1 - - name: Check global.json policy run: cargo ci global-json-policy @@ -1457,6 +1386,8 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Find Git ref env: @@ -1477,30 +1408,9 @@ jobs: - uses: dsherret/rust-toolchain-file@v1 - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - cache-on-failure: false - cache-all-crates: true - cache-workspace-crates: true - prefix-key: v1 - - # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a. - # ChatGPT suspects that this could be due to different build invocations using the same target dir, - # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with - # `cargo build --manifest-path` (which apparently build different dependency trees). - # However, we've been unable to fix it so... /shrug - - name: Check v8 outputs - shell: bash - run: | - find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then - echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - cargo clean -p v8 || true - cargo build -p v8 - fi + - *restore-rusty-v8-debug + - *restore-openssl + - *configure-cached-openssl - name: Verify crates/smoketests/tests/smoketests/mod.rs lists all entries run: | @@ -1553,7 +1463,10 @@ jobs: name: TypeScript - Tests runs-on: spacetimedb-new-runner-2 env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Checkout repository uses: actions/checkout@v4 @@ -1611,33 +1524,9 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - with: - workspaces: ${{ github.workspace }} - shared-key: spacetimedb - # Let the main CI job save the cache since it builds the most things - save-if: false - prefix-key: v1 - - # # This step shouldn't be needed, but somehow we end up with caches that are missing librusty_v8.a. - # # ChatGPT suspects that this could be due to different build invocations using the same target dir, - # # and this makes sense to me because we only see it in this job where we mix `cargo build -p` with - # # `cargo build --manifest-path` (which apparently build different dependency trees). - # # However, we've been unable to fix it so... /shrug - # - name: Check v8 outputs - # run: | - # find "${CARGO_TARGET_DIR}"/ -type f | grep '[/_]v8' || true - # if ! [ -f "${CARGO_TARGET_DIR}"/debug/gn_out/obj/librusty_v8.a ]; then - # echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - # cargo clean -p v8 || true - # cargo build -p v8 - # fi - # if ! [ -f "${CARGO_TARGET_DIR}"/release/gn_out/obj/librusty_v8.a ]; then - # echo "Could not find v8 output file librusty_v8.a; rebuilding manually." - # cargo clean --release -p v8 || true - # cargo build --release -p v8 - # fi + - *restore-rusty-v8-debug + - *restore-openssl + - *configure-cached-openssl # - name: Install SpacetimeDB CLI from the local checkout # run: | diff --git a/.github/workflows/llm-benchmark-periodic.yml b/.github/workflows/llm-benchmark-periodic.yml index 8e46d9ebc2b..c2fa5ac5c36 100644 --- a/.github/workflows/llm-benchmark-periodic.yml +++ b/.github/workflows/llm-benchmark-periodic.yml @@ -50,6 +50,10 @@ concurrency: jobs: run-benchmarks: runs-on: spacetimedb-new-runner-2 + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" steps: - name: Checkout repository @@ -58,7 +62,25 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + + - name: Restore rusty_v8 + uses: actions/cache/restore@v4 + with: + path: ${{ env.CARGO_TARGET_DIR }}/release/gn_out/obj + key: rusty-v8-v1-145.0.0-${{ env.TARGET_TRIPLE }} + + - name: Restore OpenSSL + id: cache-openssl + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/.ci-cache/openssl + key: openssl-v1-300.5.3+3.5.4-${{ env.TARGET_TRIPLE }}${{ env.OPENSSL_CACHE_SUFFIX }} + + - name: Configure cached OpenSSL + if: steps.cache-openssl.outputs.cache-hit == 'true' + run: | + echo "OPENSSL_NO_VENDOR=1" >>"$GITHUB_ENV" + echo "OPENSSL_DIR=${{ github.workspace }}/.ci-cache/openssl" >>"$GITHUB_ENV" - name: Setup .NET SDK uses: actions/setup-dotnet@v4 diff --git a/.github/workflows/llm-benchmark-validate-goldens.yml b/.github/workflows/llm-benchmark-validate-goldens.yml index a2d2ef87a3e..bfde4e16150 100644 --- a/.github/workflows/llm-benchmark-validate-goldens.yml +++ b/.github/workflows/llm-benchmark-validate-goldens.yml @@ -28,6 +28,10 @@ jobs: validate-goldens: runs-on: spacetimedb-new-runner-2 timeout-minutes: 60 + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + TARGET_TRIPLE: x86_64-unknown-linux-gnu + OPENSSL_CACHE_SUFFIX: "" strategy: fail-fast: false @@ -41,7 +45,25 @@ jobs: fetch-depth: 1 - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + + - name: Restore rusty_v8 + uses: actions/cache/restore@v4 + with: + path: ${{ env.CARGO_TARGET_DIR }}/release/gn_out/obj + key: rusty-v8-v1-145.0.0-${{ env.TARGET_TRIPLE }} + + - name: Restore OpenSSL + id: cache-openssl + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/.ci-cache/openssl + key: openssl-v1-300.5.3+3.5.4-${{ env.TARGET_TRIPLE }}${{ env.OPENSSL_CACHE_SUFFIX }} + + - name: Configure cached OpenSSL + if: steps.cache-openssl.outputs.cache-hit == 'true' + run: | + echo "OPENSSL_NO_VENDOR=1" >>"$GITHUB_ENV" + echo "OPENSSL_DIR=${{ github.workspace }}/.ci-cache/openssl" >>"$GITHUB_ENV" - name: Setup .NET SDK if: matrix.lang == 'csharp' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d83883766c7..408e3d0983c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,11 +73,6 @@ jobs: - name: Set default rust toolchain run: rustup default $(rustup show active-toolchain | cut -d' ' -f1) - - name: Cache cargo - uses: swatinem/rust-cache@v2 - with: - workspaces: ./ - - name: Install cargo-release run: | cargo install --path tools/release From 70b0f5e00904a4814e7f62891c9cef9f3f0f17e6 Mon Sep 17 00:00:00 2001 From: joshua-spacetime Date: Wed, 12 Aug 2026 21:51:56 -0700 Subject: [PATCH 2/2] empty