devops: use Playwright Docker image for unit test job #13

Closed
opened 2026-03-19 17:10:32 +01:00 by marcel · 0 comments
Owner

Problem

The unit test job runs on ubuntu-latest and always pays the cost of installing Playwright system packages via apt (npx playwright install-deps chromium), even on a cache hit. OS packages can't be cached — so every run downloads and installs libglib, libnss, libatk, and friends regardless.

This makes the unit test job consistently slow and adds unnecessary network I/O on every push.

Solution

Switch the unit-tests job to run inside the official Playwright Docker container image. The image ships with Chromium and all system dependencies pre-installed — no install or cache steps needed at all.

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    container:
      image: mcr.microsoft.com/playwright:v1.51.1-noble

Changes required

  • Add container: directive to the unit-tests job pointing to a pinned Playwright image version
  • Remove the Install Playwright Chromium + system deps step
  • Remove the Install Playwright system deps (browser binary already cached) step
  • Remove the Cache Playwright browsers step (no longer needed)
  • Keep the Cache node_modules step (still useful)
  • Remove actions/setup-node — the Playwright image already ships with Node.js
  • Pin the image version to match the Playwright version in package.json to avoid browser/driver mismatches

Notes

  • The E2E job is unaffected — it needs Docker socket access which conflicts with running inside a container
  • Image pulls are cached by the Docker daemon on the runner host, so the first pull is slow but subsequent runs are fast
  • Check frontend/package.json for the exact Playwright version to match the image tag

Acceptance criteria

  • Unit test job no longer runs any playwright install or install-deps commands
  • Unit tests still pass
  • Job runtime is measurably shorter than before
## Problem The unit test job runs on `ubuntu-latest` and always pays the cost of installing Playwright system packages via apt (`npx playwright install-deps chromium`), even on a cache hit. OS packages can't be cached — so every run downloads and installs libglib, libnss, libatk, and friends regardless. This makes the unit test job consistently slow and adds unnecessary network I/O on every push. ## Solution Switch the `unit-tests` job to run inside the official Playwright Docker container image. The image ships with Chromium and all system dependencies pre-installed — no install or cache steps needed at all. ```yaml jobs: unit-tests: runs-on: ubuntu-latest container: image: mcr.microsoft.com/playwright:v1.51.1-noble ``` ## Changes required - Add `container:` directive to the `unit-tests` job pointing to a pinned Playwright image version - Remove the `Install Playwright Chromium + system deps` step - Remove the `Install Playwright system deps (browser binary already cached)` step - Remove the `Cache Playwright browsers` step (no longer needed) - Keep the `Cache node_modules` step (still useful) - Remove `actions/setup-node` — the Playwright image already ships with Node.js - Pin the image version to match the Playwright version in `package.json` to avoid browser/driver mismatches ## Notes - The E2E job is unaffected — it needs Docker socket access which conflicts with running inside a container - Image pulls are cached by the Docker daemon on the runner host, so the first pull is slow but subsequent runs are fast - Check `frontend/package.json` for the exact Playwright version to match the image tag ## Acceptance criteria - [ ] Unit test job no longer runs any `playwright install` or `install-deps` commands - [ ] Unit tests still pass - [ ] Job runtime is measurably shorter than before
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#13