From 3564f4f9f1cd85946131ff80723b95e6afc5cefe Mon Sep 17 00:00:00 2001 From: Agustin Delgado Date: Fri, 23 Oct 2026 21:13:24 -0300 Subject: [PATCH 1/3] ci: key the Playwright cache on the installed version --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58db4cf..12bf2b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,12 +62,19 @@ jobs: - run: pnpm install --frozen-lockfile + # The key is the installed Playwright version. `hashFiles` on the package in + # `node_modules` gave an empty hash (pnpm links it from outside the workspace), + # so the key never changed and the browsers were downloaded on every run. + - name: Read the Playwright version + id: playwright-version + run: echo "version=$(cd packages/ui && pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT" + - name: Cache Playwright browsers uses: actions/cache@v4 id: playwright-cache with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ hashFiles('packages/ui/node_modules/playwright/package.json') }} + key: playwright-${{ runner.os }}-${{ env.ImageOS }}-${{ steps.playwright-version.outputs.version }} - name: Install Playwright Chromium if: steps.playwright-cache.outputs.cache-hit != 'true' From 08cf920871d7ba590e30e21dbb47996c4c00eed5 Mon Sep 17 00:00:00 2001 From: Agustin Delgado Date: Fri, 23 Oct 2026 21:13:48 -0300 Subject: [PATCH 2/3] ci: run on main too, so the caches it saves reach every pull request --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12bf2b6..134619b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,13 @@ name: CI on: pull_request: branches: [main] + # Also on main: a cache saved by a pull request is visible only to that pull + # request, and one saved on main is visible to all of them. + push: + branches: [main] concurrency: - group: ci-${{ github.head_ref }} + group: ci-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: From 8eaa813daacea279ac4a16d1a3a76a1b46413e6f Mon Sep 17 00:00:00 2001 From: Agustin Delgado Date: Fri, 23 Oct 2026 21:18:47 -0300 Subject: [PATCH 3/3] ci: read ImageOS in the step that builds the cache key --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 134619b..000ddef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,14 +71,17 @@ jobs: # so the key never changed and the browsers were downloaded on every run. - name: Read the Playwright version id: playwright-version - run: echo "version=$(cd packages/ui && pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT" + # `ImageOS` is a variable of the runner, not of the `env` context, so it is read here. + run: | + echo "version=$(cd packages/ui && pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT" + echo "image=$ImageOS" >> "$GITHUB_OUTPUT" - name: Cache Playwright browsers uses: actions/cache@v4 id: playwright-cache with: path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ env.ImageOS }}-${{ steps.playwright-version.outputs.version }} + key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.image }}-${{ steps.playwright-version.outputs.version }} - name: Install Playwright Chromium if: steps.playwright-cache.outputs.cache-hit != 'true'