Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ concurrency:
jobs:
bun:
name: bun (lint + typecheck + test)
# GitHub-hosted runner.
runs-on: ubuntu-22.04
# GitHub-hosted runner. The 22.04 image is deprecated (actions/runner-images#14254:
# deprecation 2026-09-17, retirement 2027-04-17) and the mitigation it names is
# 24.04/26.04/latest, so pin the explicit 24.04 image, not ubuntu-latest.
runs-on: ubuntu-24.04
# 10 was too tight (run 34577257568 was cancelled at 10m17s mid-install).
# 20 now exists for the retry's sake, not to accommodate a hang: three
# bounded attempts (3 × 300s) + backoff (20s + 40s) + ~30s for the rest of
Expand Down Expand Up @@ -63,15 +65,20 @@ jobs:
# No apt on any path. The install fetches the browser binaries from
# Playwright's CDN over HTTPS, or fills in what the cache above is missing
# — it never touches the Ubuntu mirrors, whose port-80 egress from these
# runners is what actually flakes (run 34580929047: one apt attempt
# crawled 11m before failing, the second was still crawling when the 20m
# ceiling killed the job).
# runners is what actually flakes (run 34580929047, on the then-default
# 22.04 image: one apt attempt crawled 11m before failing, the second was
# still crawling when the 20m ceiling killed the job).
# The system libraries `install-deps` would add are already on the stock
# image: apt's own plan in that run listed all 14 runtime libs (libnss3,
# libgbm1, libasound2, libcups2, …) as UPGRADES, not new installs, and the
# only NEW packages were fonts — which affect glyph rendering in
# screenshots, and no CI assertion reads rendered output. The launch check
# in the next step gates that claim at runtime.
# image. On 22.04 apt's own plan in that run listed all 14 runtime libs
# (libnss3, libgbm1, libasound2, libcups2, …) as UPGRADES, not new
# installs, and the only NEW packages were fonts — which affect glyph
# rendering in screenshots, and no CI assertion reads rendered output.
# Noble (the 24.04 image the jobs pin) renamed the two time_t-transition
# packages, so those names read differently: `libasound2` is only a
# virtual package there and `libcups2` does not exist — the real names
# are `libasound2t64` / `libcups2t64` (packages.ubuntu.com, suite=noble),
# which the stock image ships. The launch check in the next step gates
# that claim at runtime.
# The CLI is the repo-pinned playwright-core's own — NOT `bunx playwright`,
# which resolves an unpinned version: run 34583721201 had it exit 0 in
# 0.7s without fetching the headless shell the pinned version requires.
Expand Down Expand Up @@ -140,7 +147,10 @@ jobs:
# user installs from npm works on the node floor package.json declares, so
# this job packs the package, installs the tarball and runs the INSTALLED
# CLI with node — the floor, not the dev version.
runs-on: ubuntu-22.04
# Same runner evidence as the `bun` job above: the 22.04 image is deprecated
# (actions/runner-images#14254: 2026-09-17, retires 2027-04-17), so both jobs
# pin the explicit 24.04 image instead of the migrating ubuntu-latest.
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
Expand Down
47 changes: 41 additions & 6 deletions src/pack-smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ function packSmokeJob(workflow: string): Job | undefined {
return parseJobs(workflow).find((job) => job.key === 'pack-smoke');
}

function bunJob(workflow: string): Job | undefined {
return parseJobs(workflow).find((job) => job.key === 'bun');
}

function smokeStep(job: Job | undefined): Step | undefined {
return job?.steps.find((step) =>
executableLines(step.run).some((line) => line.trim() === SMOKE_COMMAND),
Expand All @@ -259,7 +263,19 @@ function smokeStep(job: Job | undefined): Step | undefined {
/** G1 — the job exists, on the runner the repo pins, with a bounded timeout. */
function hasPackSmokeJob(workflow: string): boolean {
const job = packSmokeJob(workflow);
return job !== undefined && job.runsOn === 'ubuntu-22.04' && job.timeoutMinutes === '15';
return job !== undefined && job.runsOn === 'ubuntu-24.04' && job.timeoutMinutes === '15';
}

/**
* G1b — the `bun` job pins the same runner.
*
* `hasPackSmokeJob` guards the second job only, so the label the first job runs
* on could drift back to the deprecated 22.04 image or to `ubuntu-latest` —
* which the workflow's own comment rejects (it migrates) — with every gate
* green. The label is asserted exactly: any other value is a fail.
*/
function hasPinnedBunJob(workflow: string): boolean {
return bunJob(workflow)?.runsOn === 'ubuntu-24.04';
}

/** G2 — setup-node is pinned to the floor the manifest declares. */
Expand Down Expand Up @@ -472,11 +488,11 @@ function jobText(workflow: string, key: string): string {
return lines.slice(start, end).join('\n');
}

/** Replace text inside the pack-smoke job only — the `bun` job has the same lines. */
function mutateJob(workflow: string, from: string, to: string): string {
const block = jobText(workflow, 'pack-smoke');
/** Replace text inside one job only — the jobs share lines like `runs-on:`. */
function mutateJob(workflow: string, from: string, to: string, key = 'pack-smoke'): string {
const block = jobText(workflow, key);
if (!block.includes(from)) {
throw new Error(`the pack-smoke job does not contain "${from}"`);
throw new Error(`the ${key} job does not contain "${from}"`);
}
return workflow.replace(block, block.replace(from, to));
}
Expand Down Expand Up @@ -724,14 +740,33 @@ test('the workflow has a pack-smoke job on the pinned runner', () => {
);
// Mutation: the job runs somewhere else.
expect(
hasPackSmokeJob(mutateJob(workflowText, 'runs-on: ubuntu-22.04', 'runs-on: macos-latest')),
hasPackSmokeJob(mutateJob(workflowText, 'runs-on: ubuntu-24.04', 'runs-on: macos-latest')),
).toBe(false);
// Mutation: the job loses its ceiling.
expect(
hasPackSmokeJob(mutateJob(workflowText, 'timeout-minutes: 15', 'timeout-minutes: 360')),
).toBe(false);
});

test('the bun job runs on the pinned runner as well', () => {
expect(hasPinnedBunJob(workflowText)).toBe(true);

// Mutation: the job drifts to the migrating label ci.yml explicitly rejects.
expect(
hasPinnedBunJob(
mutateJob(workflowText, 'runs-on: ubuntu-24.04', 'runs-on: ubuntu-latest', 'bun'),
),
).toBe(false);
// Mutation: the job drifts back to a deprecated image.
expect(
hasPinnedBunJob(
mutateJob(workflowText, 'runs-on: ubuntu-24.04', 'runs-on: macos-latest', 'bun'),
),
).toBe(false);
// Mutation: the job is renamed away — nothing is left on the pinned runner.
expect(hasPinnedBunJob(workflowText.replace(' bun:', ' bun-renamed:'))).toBe(false);
});

test('the pack-smoke job pins setup-node to the floor the manifest declares', () => {
expect(pinsNodeFloor(workflowText, FLOOR)).toBe(true);

Expand Down