Skip to content

Commit 1cc39d1

Browse files
authored
Merge pull request #488 from os2display/feature/playwright-ci-parallel
ci(playwright): run E2E in parallel and drop redundant browser install
2 parents 770df91 + 14b0d97 commit 1cc39d1

4 files changed

Lines changed: 35 additions & 6 deletions

File tree

.github/workflows/playwright.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ jobs:
4242
- name: Setup network
4343
run: docker network create frontend
4444

45+
- name: Pull container images
46+
# Pull all images this job uses up front, in parallel (compose pulls
47+
# services concurrently). Otherwise each image is pulled on demand inside
48+
# the first step that uses it — serially across steps (~90s total:
49+
# mariadb+phpfpm in Composer install, node in Build assets,
50+
# nginx+playwright in Run playwright). Pulling concurrently overlaps the
51+
# smaller images under the large playwright pull.
52+
run: docker compose pull --quiet phpfpm node playwright nginx mariadb
53+
4554
- name: Composer install
4655
run: |
4756
docker compose run --rm phpfpm composer install
@@ -56,11 +65,18 @@ jobs:
5665
docker compose run --rm node npm run build
5766
5867
- name: Run playwright
59-
env:
60-
CI: "true"
68+
# `-e CI=true` propagates CI *into* the container — `docker compose run`
69+
# does not forward host env by default, so without it playwright.config.ts
70+
# sees no CI and falls back to its defaults (50% of cores ≈ 2 workers,
71+
# retries 0). The explicit flag is what actually enables workers: 3 and
72+
# retries: 2 on the runner.
73+
#
74+
# The mcr.microsoft.com/playwright image already bundles the browsers for
75+
# its version, kept in lockstep with @playwright/test in package.json, so
76+
# `playwright install --with-deps` only re-runs apt for libraries that are
77+
# already present. Run the tests directly.
6178
run: |
62-
docker compose run --rm playwright npx playwright install --with-deps
63-
docker compose run --rm playwright npx playwright test
79+
docker compose run --rm -e CI=true playwright npx playwright test
6480
6581
- uses: actions/upload-artifact@v7
6682
if: always()

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- Sped up the Playwright CI job: it now runs in parallel (3 workers, sized to the 4-vCPU public
8+
GitHub runner) instead of the default 2, added `ipc: host` to the `playwright` Compose
9+
service so parallel Chromium does not exhaust Docker's default 64 MB `/dev/shm`, pulls the
10+
container images once up front in parallel instead of on demand serially across steps
11+
(~90s of pulls overlapped), and dropped the redundant `playwright install --with-deps` step
12+
(the pinned Playwright image already ships the matching browsers).
713
- Removed a dead statement in `MediaRepository::getPaginator()` that referenced the undefined
814
variables `$page` and `$itemsPerPage`; the computed value was never used.
915
- Fixed inverted user-type guard in `UserService::activateExternalUser()`: the "user is not of

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ services:
162162
# https://playwright.dev/docs/docker
163163
# Version should match the one in `package.json`.
164164
image: mcr.microsoft.com/playwright:v1.57.0
165+
# Chromium needs more than Docker's default 64 MB /dev/shm once tests run in
166+
# parallel; sharing the host IPC namespace avoids renderer crashes
167+
# ("Target closed"). See the Playwright Docker docs.
168+
ipc: host
165169
networks:
166170
- app
167171
depends_on:

playwright.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ export default defineConfig({
2020
forbidOnly: !!process.env.CI,
2121
/* Retry on CI only */
2222
retries: process.env.CI ? 2 : 0,
23-
/* Opt out of parallel tests on CI. */
24-
workers: process.env.CI ? 1 : undefined,
23+
/* CI runs on a 4-vCPU GitHub-hosted runner (public repo); use 3 workers and
24+
* leave one core for the browser/system. Tests mock every network call per
25+
* page (see assets/tests/**\/test-helper.js), so they are isolated and safe
26+
* to run in parallel. Locally, Playwright's default (50% of cores) applies. */
27+
workers: process.env.CI ? 3 : undefined,
2528
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2629
// Open never added to avoid the CI pipeline to get stuck in a html-reporter-mode.
2730
reporter: [['html', { open: 'never' }]],

0 commit comments

Comments
 (0)