Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

ci: fix Rust cache duplication/eviction, fast test profile on Windows, sccache for e2e-windows (#4806)

Ezra Ellette4f0f28f53b18
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e1a56ff24..e1b807c4e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -37,24 +37,34 @@ jobs:
RUSTFLAGS: "-C link-arg=-Wl,--allow-multiple-definition"
steps:
- uses: actions/checkout@v4
- - uses: actions/cache@v4
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- target/
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
override: true
- cache: true
+ # The explicit rust-cache step below is the single cache layer.
+ # cache: true ran Swatinem/rust-cache a second time next to the
+ # plain actions/cache this replaced — two ~1 GB saves of the same
+ # artifacts per run, which fed the repo-wide cache eviction
+ # (>20 GB active vs GitHub's 10 GB limit) that kept every Rust CI
+ # restore cold.
+ cache: false
rustflags: ""
+ - name: Rust cache
+ # Replaces actions/cache keyed exactly on hashFiles(Cargo.lock) with
+ # no restore-keys — any lockfile bump meant a fully cold 20+ min
+ # build. rust-cache falls back to the closest previous cache on a
+ # prefix match, so only changed deps rebuild. Restore/save is an
+ # optimization only; a transient GHA cache service error must never
+ # fail the job (same rationale as e2e-test.yml).
+ continue-on-error: true
+ uses: Swatinem/rust-cache@v2
+ with:
+ shared-key: ci-test-ubuntu
+ cache-bin: false
+
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
@@ -78,12 +88,6 @@ jobs:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- - uses: actions/cache@v4
- with:
- path: |
- ~\AppData\Local\cargo\
- target\
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Node
uses: actions/setup-node@v4
@@ -100,9 +104,23 @@ jobs:
with:
toolchain: stable
override: true
- cache: true
+ # See test-ubuntu: the explicit rust-cache step below is the
+ # single cache layer; cache: true would save a duplicate.
+ # The removed actions/cache here was doubly broken — its
+ # ~\AppData\Local\cargo\ path isn't CARGO_HOME on GitHub
+ # runners (that's ~\.cargo), so the registry half cached junk.
+ cache: false
rustflags: ""
+ - name: Rust cache
+ # See test-ubuntu — prefix-fallback restore, single cache layer,
+ # never fail the job on a cache service error.
+ continue-on-error: true
+ uses: Swatinem/rust-cache@v2
+ with:
+ shared-key: ci-test-windows
+ cache-bin: false
+
- name: setup Bun
uses: oven-sh/setup-bun@v2
with:
@@ -171,14 +189,15 @@ jobs:
# exits with STATUS_DLL_NOT_FOUND (0xc0000135) on the first
# ort::api() call — which is exactly what test_process_ocr_task_windows
# hits inside accuracy_test. Stage them before any cargo test that
- # touches ort. Run this once for both --release/--target builds —
- # cargo test --release --target x86_64-pc-windows-msvc puts test
- # binaries under target/x86_64-pc-windows-msvc/release/deps/.
+ # touches ort. Run this once for all --profile release-dev/--target
+ # builds — cargo test --profile release-dev --target
+ # x86_64-pc-windows-msvc puts test binaries under
+ # target/x86_64-pc-windows-msvc/release-dev/deps/.
- name: Stage ONNX Runtime DLLs next to test binary
shell: pwsh
run: |
$src = "${{ github.workspace }}/apps/screenpipe-app-tauri/src-tauri/onnxruntime-win-x64-1.24.2/lib"
- $dst = "${{ github.workspace }}/target/x86_64-pc-windows-msvc/release/deps"
+ $dst = "${{ github.workspace }}/target/x86_64-pc-windows-msvc/release-dev/deps"
if (-not (Test-Path $dst)) {
New-Item -ItemType Directory -Path $dst -Force | Out-Null
}
@@ -252,7 +271,11 @@ jobs:
# above still provides the runtime DLL.
# Use prebuilt NASM objects on Windows: https://aws.github.io/aws-lc-rs/requirements/windows.html#prebuilt-nasm-objects
AWS_LC_SYS_PREBUILT_NASM: "1"
- run: cargo test -p screenpipe-screen test_process_ocr_task_windows --release --target x86_64-pc-windows-msvc
+ # --profile release-dev, not --release: the release profile is the
+ # shipping profile (fat LTO, codegen-units=1) — pointlessly slow
+ # codegen for tests. release-dev (thin LTO, 16 codegen units, same
+ # opt-level) exists exactly for this; see root Cargo.toml.
+ run: cargo test -p screenpipe-screen test_process_ocr_task_windows --profile release-dev --target x86_64-pc-windows-msvc
- name: Run PII removal tests
env:
@@ -265,7 +288,8 @@ jobs:
# above still provides the runtime DLL.
# Use prebuilt NASM objects on Windows: https://aws.github.io/aws-lc-rs/requirements/windows.html#prebuilt-nasm-objects
AWS_LC_SYS_PREBUILT_NASM: "1"
- run: cargo test -p screenpipe-core pii_removal --release --target x86_64-pc-windows-msvc
+ # release-dev, not release — see the OCR test step above.
+ run: cargo test -p screenpipe-core pii_removal --profile release-dev --target x86_64-pc-windows-msvc
- name: Run PII redaction tests
env:
@@ -278,7 +302,8 @@ jobs:
# above still provides the runtime DLL.
# Use prebuilt NASM objects on Windows: https://aws.github.io/aws-lc-rs/requirements/windows.html#prebuilt-nasm-objects
AWS_LC_SYS_PREBUILT_NASM: "1"
- run: cargo test -p screenpipe-engine --lib pii_redaction_tests --release --target x86_64-pc-windows-msvc
+ # release-dev, not release — see the OCR test step above.
+ run: cargo test -p screenpipe-engine --lib pii_redaction_tests --profile release-dev --target x86_64-pc-windows-msvc
# pipes_test removed — pipe manager system deleted in #2212
@@ -292,24 +317,29 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- - uses: actions/cache@v4
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- target/
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
override: true
- cache: true
+ # See test-ubuntu: the explicit rust-cache step below is the
+ # single cache layer; cache: true would save a duplicate.
+ cache: false
rustflags: ""
+ - name: Rust cache
+ # See test-ubuntu — prefix-fallback restore, single cache layer,
+ # never fail the job on a cache service error. cache-bin: false
+ # also stops restoring a stale ~/.cargo/bin over the toolchain,
+ # the failure mode the "Verify Rust toolchain" step below guards
+ # against.
+ continue-on-error: true
+ uses: Swatinem/rust-cache@v2
+ with:
+ shared-key: ci-test-macos
+ cache-bin: false
+
- name: Verify Rust toolchain
shell: bash
run: |
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index c3c9ec58c..dbf376c9f 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -106,6 +106,19 @@ jobs:
target: x86_64-pc-windows-msvc
cache-bin: false
+ # sccache, same as the Linux/macOS e2e jobs. This Build step is the
+ # slowest in all of CI (~45 min cold) and was the only e2e build
+ # without compiler-level caching. CARGO_INCREMENTAL=0 (set in the job
+ # env above) is required for sccache to cache rustc invocations.
+ - name: Setup sccache
+ uses: mozilla-actions/[email protected]
+
+ - name: Configure sccache
+ shell: pwsh
+ run: |
+ echo "SCCACHE_GHA_ENABLED=true" >> $env:GITHUB_ENV
+ echo "RUSTC_WRAPPER=sccache" >> $env:GITHUB_ENV
+
- name: Rust cache
# cache restore/save is an optimization only; a transient GHA cache
# service error must never fail the job (skipped build+tests, red CI)