Skip to content

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

ci(perf): warm e2e server build cache (#15892)

Tobias Wochingereab871a05efb
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 5a00501d88..978bdf3897 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -1028,6 +1028,14 @@ jobs:
- name: Load default env
run: |
cp .env.dev.example .env
+ - name: Setup Turbo 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
+ with:
+ path: .turbo
+ key: ${{ runner.os }}-turbo-server-e2e-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-turbo-server-e2e-
# 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.
@@ -1076,6 +1084,9 @@ 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 3186afc151..7ca3ab1320 100644
--- a/.github/workflows/warm-caches.yml
+++ b/.github/workflows/warm-caches.yml
@@ -39,16 +39,28 @@ jobs:
# warm nothing.
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 20
- name: warm (mode${{ matrix.deploy-mode }})
+ name: warm (${{ matrix.cache_scope }})
env:
- # Mirror the tests-web job env so turbo task hashes match.
+ # Mirror the consuming test jobs so Turbo task hashes match.
NODE_ENV: test
strategy:
# One mode failing must not cancel the other warmers — a partially
# warmed pool still helps.
fail-fast: false
matrix:
- deploy-mode: ["", "-azure", "-redis-cluster"]
+ include:
+ - cache_scope: mode-default
+ deploy-mode: ""
+ env_profile: tests-web
+ - cache_scope: mode-azure
+ deploy-mode: -azure
+ env_profile: tests-web
+ - cache_scope: mode-redis-cluster
+ deploy-mode: -redis-cluster
+ env_profile: tests-web
+ - cache_scope: server-e2e
+ deploy-mode: ""
+ env_profile: e2e-server
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -68,31 +80,34 @@ jobs:
run: |
pnpm install
- name: Load default env
- # Must stay byte-identical to the tests-web "Load default env" step in
- # pipeline.yml: turbo hashes the whole .env (turbo.json
- # globalDependencies), so any drift makes the warmed build hashes
- # useless to tests-web.
+ # Must stay byte-identical to the matching pipeline job: Turbo hashes
+ # the whole .env, so even test-only differences invalidate the build.
run: |
- cp .env.dev${{ matrix.deploy-mode }}.example .env
- grep -v -e '^LANGFUSE_S3_BATCH_EXPORT_ENABLED=' -e '^NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=' .env.dev${{ matrix.deploy-mode }}.example > .env
- echo "LANGFUSE_INGESTION_QUEUE_DELAY_MS=1" >> .env
- echo "LANGFUSE_CACHE_PROMPT_ENABLED=false" >> .env
- echo "LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS=1" >> .env
- echo "LANGFUSE_TRACE_DELETE_DELAY_MS=1" >> .env
- echo "LANGFUSE_TRACE_DELETE_CONCURRENCY=100" >> .env
- echo "ADMIN_API_KEY=admin-api-key" >> .env
- echo "LANGFUSE_EE_LICENSE_KEY=langfuse_ee_test" >> .env
- echo "LANGFUSE_SKIP_EVALUATOR_MODEL_CALL_VALIDATION=true" >> .env
- echo "LANGFUSE_ENABLE_SCORES_V3_API=true" >> .env
+ if [ "${{ matrix.env_profile }}" = "tests-web" ]; then
+ {
+ grep -v -e '^LANGFUSE_S3_BATCH_EXPORT_ENABLED=' -e '^NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=' .env.dev${{ matrix.deploy-mode }}.example
+ echo "LANGFUSE_INGESTION_QUEUE_DELAY_MS=1"
+ echo "LANGFUSE_CACHE_PROMPT_ENABLED=false"
+ echo "LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS=1"
+ echo "LANGFUSE_TRACE_DELETE_DELAY_MS=1"
+ echo "LANGFUSE_TRACE_DELETE_CONCURRENCY=100"
+ echo "ADMIN_API_KEY=admin-api-key"
+ echo "LANGFUSE_EE_LICENSE_KEY=langfuse_ee_test"
+ echo "LANGFUSE_SKIP_EVALUATOR_MODEL_CALL_VALIDATION=true"
+ echo "LANGFUSE_ENABLE_SCORES_V3_API=true"
+ } > .env
+ 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
with:
path: .turbo
- # Same key shape as the tests-web "Setup Turbo cache" step so branch
- # runs restore these archives via their restore-keys prefix.
- key: ${{ runner.os }}-turbo-mode${{ matrix.deploy-mode == '' && '-default' || matrix.deploy-mode }}-${{ github.sha }}
+ # 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-mode${{ matrix.deploy-mode == '' && '-default' || matrix.deploy-mode }}-
+ ${{ runner.os }}-turbo-${{ matrix.cache_scope }}-
- name: Build
# dev containers / Postgres are not needed: the build task only
# depends on db:generate, which is offline.