:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(devex): cache the VR CLI install and give it a real budget (#94980)
Julian Bez83201a925704
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex eef50bdce732..19b41a384a92 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -966,6 +966,16 @@ jobs:# Visual Review: create run + upload snapshots directly from the test job.# Completion happens in handle-screenshots so the baseline lands in the same commit as PNGs.+ # Shares the entry ci-storybook.yml writes, keyed on the same lockfile. A miss+ # only means the install downloads the tree, which is what it does today.+ - name: Restore VR CLI npm cache+ if: always() && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push')+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ~/.npm+ key: npm-vr-cli-${{ runner.os }}-${{ hashFiles('**/products/visual_review/cli/package-lock.json') }}+ restore-keys: npm-vr-cli-${{ runner.os }}-+- name: Install VR CLIif: always() && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push')run: cd products/visual_review/cli && npm ci && npm run build && npm link@@ -1255,6 +1265,14 @@ jobs:node-version-file: .nvmrctoken: ${{ steps.setup-gh-token.outputs.token || github.token }}+ # Shares the entry ci-storybook.yml writes, keyed on the same lockfile.+ - name: Restore VR CLI npm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ~/.npm+ key: npm-vr-cli-${{ runner.os }}-${{ hashFiles('**/products/visual_review/cli/package-lock.json') }}+ restore-keys: npm-vr-cli-${{ runner.os }}-+- name: Install VR CLIrun: cd products/visual_review/cli && npm ci && npm run build && npm linkdiff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.ymlindex adcd731f81cf..bc4d6cd13511 100644--- a/.github/workflows/ci-storybook.yml+++ b/.github/workflows/ci-storybook.yml@@ -308,7 +308,10 @@ jobs:vr-setup:name: Create Visual Review runruns-on: ubuntu-latest- timeout-minutes: 5+ # The VR CLI install dominates this job, and it runs against a cold npm cache+ # whenever the restore misses. vr-complete allows the same budget for the same+ # install.+ timeout-minutes: 15needs: [changes, build-storybook, select-stories]# A status function is required because select-stories is skipped on forced-full# PRs and master pushes, and GitHub would otherwise cascade that skip to this job.@@ -365,9 +368,31 @@ jobs:node-version-file: .nvmrctoken: ${{ steps.setup-gh-token.outputs.token || github.token }}+ # The CLI is a standalone npm package outside the pnpm workspace, so no other+ # job warms its tarballs. Without this cache, every run downloads the whole+ # dependency tree, which includes the sharp binaries and the test toolchain+ # that the build never uses.+ - name: Restore VR CLI npm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ~/.npm+ key: npm-vr-cli-${{ runner.os }}-${{ hashFiles('**/products/visual_review/cli/package-lock.json') }}+ restore-keys: npm-vr-cli-${{ runner.os }}-+- name: Install VR CLIrun: cd vr-cli/products/visual_review/cli && npm ci && npm run build+ - name: Save VR CLI npm cache+ # The only writer for every VR CLI install, here and in+ # ci-e2e-playwright.yml. They key on the same lockfile, so one entry serves+ # them all and no two jobs save the same content at once. A job that finds+ # no entry downloads the dependency tree instead.+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ~/.npm+ key: npm-vr-cli-${{ runner.os }}-${{ hashFiles('**/products/visual_review/cli/package-lock.json') }}+- name: Create VR runid: createenv:@@ -577,6 +602,18 @@ jobs:products/visual_review/frontend/generated/api.schemas.tssparse-checkout-cone-mode: false+ # Every shard installs the CLI, so this is the highest-volume reader of the+ # entry vr-setup writes. Restore only: a save here would race the other+ # shards for one key. npm stores its cache by content, so the entry moves+ # between the runner home and the container home without a rewrite.+ - name: Restore VR CLI npm cache+ if: always() && needs.vr-setup.outputs.run_id != ''+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ~/.npm+ key: npm-vr-cli-${{ runner.os }}-${{ hashFiles('**/products/visual_review/cli/package-lock.json') }}+ restore-keys: npm-vr-cli-${{ runner.os }}-+- name: Install VR CLIif: always() && needs.vr-setup.outputs.run_id != ''run: cd vr-cli/products/visual_review/cli && npm ci && npm run build@@ -828,6 +865,14 @@ jobs:node-version-file: .nvmrctoken: ${{ steps.setup-gh-token.outputs.token || github.token }}+ # Reads the cache that vr-setup writes. This job never saves it.+ - name: Restore VR CLI npm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ~/.npm+ key: npm-vr-cli-${{ runner.os }}-${{ hashFiles('**/products/visual_review/cli/package-lock.json') }}+ restore-keys: npm-vr-cli-${{ runner.os }}-+- name: Install VR CLIrun: cd vr-cli/products/visual_review/cli && npm ci && npm run build