Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(ci): hit turbo caches more often and prune them (#17199)

Nimar9e1eea3f9a81
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 085bdfbe24..deb537ffe2 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -180,15 +180,15 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- - name: Setup Turbo cache
+ - name: Setup Turbo remote cache
if: env.CI_CACHE_ALLOWED == 'true'
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] lint cache only; publish jobs rebuild artifacts and do not restore this cache
+ continue-on-error: true
+ uses: rharkor/caching-for-turbo@2238fae6eb9a9936f92356f54cb3660200d105e7 # v2.5.1
with:
- path: .turbo
- key: ${{ runner.os }}-turbo-lint-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-turbo-lint-
- ${{ runner.os }}-turbo-
+ provider: github
+ cache-prefix: ${{ runner.os }}-${{ runner.arch }}-node${{ env.NODE_VERSION }}-turbo-ci-
+ use-relative-cache-path: true
+ server-port: "0"
- name: install dependencies
run: |
pnpm i
@@ -728,14 +728,15 @@ jobs:
# phase below reapplies the mode-specific config and prerendering.
write_test_env .env.dev.example .env
write_test_env .env.dev${{ matrix.deploy-mode }}.example .env.runtime
- - name: Setup Turbo cache
+ - name: Setup Turbo remote cache
if: env.CI_CACHE_ALLOWED == 'true'
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] test job cache only; publish jobs rebuild artifacts and do not restore this cache
+ continue-on-error: true
+ uses: rharkor/caching-for-turbo@2238fae6eb9a9936f92356f54cb3660200d105e7 # v2.5.1
with:
- path: .turbo
- key: ${{ runner.os }}-turbo-tests-web-compile-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-turbo-tests-web-compile-
+ provider: github
+ cache-prefix: ${{ runner.os }}-${{ runner.arch }}-node${{ env.NODE_VERSION }}-turbo-ci-
+ use-relative-cache-path: true
+ server-port: "0"
# No Next.js build cache here on purpose: its ~30s/job restore+save cost
# roughly cancels the build speedup, and the Turbo cache above already
# replays unchanged builds.
@@ -811,11 +812,6 @@ jobs:
env:
NODE_COMPILE_CACHE: /tmp/node-compile-cache
run: npx dotenv -e ../.env.test -e ../.env -- vitest run --project server --project server-isolated --project server-shared-source --project server-unit --project server-shared-source-unit --maxWorkers="${VITEST_MAX_WORKERS:-8}"
- - name: Prune stale turbo cache entries
- if: env.CI_CACHE_ALLOWED == 'true'
- # Each run saves the restored archive plus new entries, so the cache
- # grows without bound unless old entries are dropped before the save.
- run: find .turbo/cache -type f -mtime +3 -delete 2>/dev/null || true
tests-web-client:
timeout-minutes: 10
@@ -1080,15 +1076,15 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME_READ }}
password: ${{ secrets.DOCKERHUB_TOKEN_READ }}
- - name: Setup Turbo cache
+ - name: Setup Turbo remote cache
if: env.CI_CACHE_ALLOWED == 'true'
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] e2e cache only; no published artifact path restores this cache
+ continue-on-error: true
+ uses: rharkor/caching-for-turbo@2238fae6eb9a9936f92356f54cb3660200d105e7 # v2.5.1
with:
- path: .turbo
- key: ${{ runner.os }}-turbo-e2e-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-turbo-e2e-
- ${{ runner.os }}-turbo-
+ provider: github
+ cache-prefix: ${{ runner.os }}-${{ runner.arch }}-node${{ env.NODE_VERSION }}-turbo-ci-
+ use-relative-cache-path: true
+ server-port: "0"
- name: Cache Next.js builds
if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] e2e-only Next.js cache; not part of any artifact build or publishing flow
@@ -1211,14 +1207,15 @@ jobs:
- name: Load default env
run: |
cp .env.dev.example .env
- - name: Setup Turbo cache
+ - name: Setup Turbo remote cache
if: env.CI_CACHE_ALLOWED == 'true'
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] server e2e build cache only; publish jobs rebuild artifacts without restoring this cache
+ continue-on-error: true
+ uses: rharkor/caching-for-turbo@2238fae6eb9a9936f92356f54cb3660200d105e7 # v2.5.1
with:
- path: .turbo
- key: ${{ runner.os }}-turbo-server-e2e-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-turbo-server-e2e-
+ provider: github
+ cache-prefix: ${{ runner.os }}-${{ runner.arch }}-node${{ env.NODE_VERSION }}-turbo-ci-
+ use-relative-cache-path: true
+ server-port: "0"
# The next two downloads/startups have no dependency on the build, so
# they run in the background and the build overlaps them. Later steps
# wait on their marker files.
@@ -1267,9 +1264,6 @@ jobs:
timeout 10 bash -c 'until curl -f http://localhost:3000/api/public/health; do sleep 2; done'
- name: Run e2e tests
run: pnpm --filter=web run test:e2e:server
- - name: Prune stale turbo cache entries
- if: env.CI_CACHE_ALLOWED == 'true'
- run: find .turbo/cache -type f -mtime +3 -delete 2>/dev/null || true
all-ci-passed:
# This allows us to have a branch protection rule for tests and deploys with matrix
diff --git a/.github/workflows/warm-caches.yml b/.github/workflows/warm-caches.yml
index cee381ef1a..18936a008c 100644
--- a/.github/workflows/warm-caches.yml
+++ b/.github/workflows/warm-caches.yml
@@ -1,18 +1,8 @@
name: Warm CI caches
-# Cross-branch cache reuse flows exclusively through caches saved on the
-# default branch: Actions caches are scoped per ref, and PR / merge-queue /
-# branch runs may only restore their own ref's caches plus main's. Full
-# pipeline runs on main are sparse (pre-job skips pushes whose tree the merge
-# queue already tested; none happen on weekends), which was fine while cache
-# retention was days — but since the Blacksmith cache-store resets of
-# 2026-07-02/03, saved caches have been observed to vanish within ~a day
-# (contradicting their documented 7-day LRU eviction), so most branch runs
-# find nothing and pay a cold pnpm install plus a cold turbo build (~+2min on
-# the tests-web critical path). This workflow re-saves the pnpm store and the
-# task-scoped Turbo caches from main every few hours so branch runs keep
-# hitting them. Once Blacksmith retention is back to days, drop the schedule
-# to daily or delete the workflow — it is purely compensatory.
+# Main-branch cache entries can be restored by other refs. Since the main
+# pipeline skips commits already tested by the merge queue, build these
+# profiles periodically so other branches can reuse their task artifacts.
on:
schedule:
# Every 6 hours, offset from the top of the hour to dodge runner-pool
@@ -33,10 +23,7 @@ env:
jobs:
warm:
- # Must run on Blacksmith runners: their runners store Actions caches in
- # Blacksmith's own cache backend, which is the store the pipeline jobs
- # restore from. A GitHub-hosted warmer would write to GitHub's store and
- # warm nothing.
+ # Match the pipeline's runner provider for cache compatibility.
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 20
name: warm (${{ matrix.cache_scope }})
@@ -96,15 +83,14 @@ jobs:
else
cp .env.dev${{ matrix.deploy-mode }}.example .env
fi
- - name: Setup Turbo cache
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] scheduled cache warmer for test-job turbo caches only; runs on main, publish jobs rebuild artifacts and do not restore this cache
+ - name: Setup Turbo remote cache
+ continue-on-error: true
+ uses: rharkor/caching-for-turbo@2238fae6eb9a9936f92356f54cb3660200d105e7 # v2.5.1
with:
- path: .turbo
- # Same key shape as the consuming pipeline job so branch runs restore
- # these archives via their restore-keys prefix.
- key: ${{ runner.os }}-turbo-${{ matrix.cache_scope }}-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-turbo-${{ matrix.cache_scope }}-
+ provider: github
+ cache-prefix: ${{ runner.os }}-${{ runner.arch }}-node${{ env.NODE_VERSION }}-turbo-ci-
+ use-relative-cache-path: true
+ server-port: "0"
- name: Build
# dev containers / Postgres are not needed: the build task only
# depends on db:generate, which is offline.
@@ -119,7 +105,3 @@ jobs:
# TypeScript is checked explicitly in the lint job; skip duplicate
# Next.js type checks to keep the warmer cheap (mirrors tests-web).
NEXT_IGNORE_BUILD_ERRORS: "true"
- - name: Prune stale turbo cache entries
- # Each run saves the restored archive plus new entries, so the cache
- # grows without bound unless old entries are dropped before the save.
- run: find .turbo/cache -type f -mtime +3 -delete 2>/dev/null || true