From be224d172a9428e04f1f8296d03980338bdc18d9 Mon Sep 17 00:00:00 2001 From: Arman2122 Date: Fri, 23 Oct 2026 16:07:38 +0330 Subject: [PATCH] ci: install the harness's browser without apt-getting fonts The Browser harness job ran `playwright install --with-deps`, and on 2026-10-23 it hit its ten-minute timeout three times in an hour, always inside that step. Playwright's dependency install always adds its "tools" group, xvfb and its font packages, on top of the browser's own libraries. On the ubuntu-24.04 image every one of those libraries is already installed: the passing run reports "already the newest version" for each. So what --with-deps actually did was apt-get about 26 MB, the fonts plus patch upgrades of libglib2.0, libnss3 and xvfb, from azure.archive.ubuntu.com. That mirror answered the index fetch in a second and then served the packages at about 40 KB/s; fonts-wqy-zenhei alone, 7.5 MB, took three minutes. The browser is now installed without system packages, and a new step finds out whether the runner can run it by running it: a launch fails if the binary cannot load a library it links against, and opening a page starts a renderer. Playwright's own host-dependency check does not help here; in 1.62.1 it runs ldd over chrome-linux/, and the x64 headless shell unpacks to chrome-headless-shell-linux64/, so it checks nothing. If the probe passes, nothing touches apt. If it fails, as it might on a later image while ubuntu-latest moves to a new Ubuntu release, the job falls back to `playwright install-deps` and says so in a warning, because that path brings the fonts and the slow-mirror exposure back. Playwright 1.62.1 has a dependency table for Ubuntu 26.04, so the fallback works there too. None of this touches what is tested. The harness forbids fonts in its own policy (font-src 'none') and takes no screenshots, and the test step, its MTG_REQUIRE_BROWSER_HARNESS and its command are unchanged: a browser that cannot start still fails the job. The browser download itself is not cached. The 114.7 MiB headless shell came from cdn.playwright.dev in about 3.5 s; restoring a cache of the same size would not be faster. --- .github/workflows/ci.yaml | 42 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6de50a5..0a5cbec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -86,9 +86,49 @@ jobs: # Only the headless shell: the harness never needs a headed browser, and # the full download is several times the size for nothing. + # + # And no --with-deps. Playwright's dependency install always adds its + # "tools" group, xvfb and its font packages, on top of the browser's own + # libraries, and on the ubuntu-24.04 image every one of those libraries + # is already installed. So what --with-deps did here was apt-get about + # 26 MB, mostly fonts, from the Azure Ubuntu mirror. On 2026-10-23 that + # mirror served them at 40 KB/s, and the job hit its timeout three times + # in an hour. The harness forbids fonts in its own policy (font-src + # 'none') and takes no screenshots, so the fonts were never part of what + # it tests. - name: Install Chromium working-directory: test/webbridge - run: npx playwright install --with-deps chromium-headless-shell + run: npx playwright install chromium-headless-shell + + # Find out whether this runner can run that browser by running it, + # without assuming an image. The launch fails if the binary cannot load + # a library it links against, and opening a page starts a renderer, so + # a library missing at that point shows too. Playwright's own + # host-dependency check is no help here: in 1.62.1 it looks in + # chrome-linux/, and the x64 headless shell unpacks to + # chrome-headless-shell-linux64/, so it finds nothing to check. + # + # If the probe passes, nothing is installed. If it fails, for example + # on an image that lacks a library as ubuntu-latest moves to a new + # release, fall back to Playwright's own dependency install. That + # brings the fonts back and with them the slow-mirror exposure, so it + # is a warning, not a quiet new normal. + - name: Check the browser's system libraries + working-directory: test/webbridge + run: | + if node --input-type=module <<'EOF' + import { chromium } from 'playwright'; + const browser = await chromium.launch({ timeout: 60_000 }); + const page = await browser.newPage(); + await page.setContent('probe'); + await browser.close(); + EOF + then + echo "The headless shell starts and renders a page on this runner as it is." + else + echo "::warning::The runner image lacks a library the headless shell needs. Installing Playwright's full dependency set, fonts included, which is the slow-mirror path this job normally avoids." + npx playwright install-deps chromium-headless-shell + fi # This variable, and not CI, is what turns the test's skips into # failures. Every job in a run has CI set, including the one that tests