Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .changeset/dox-sunshine-inset-click-at-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

No release. The Sunshine Protection Act inset-click test presses each frame once the drawing's arrival fade has ended. PR browser tests run in Chromium only, and WebKit runs them in the weekly sweep. That sweep now keeps one rolling `dox-gate` issue: a failing run rewrites it and a clean run closes it.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ jobs:
# The checks that open the built site in a browser, on the artifact `dox-site` uploaded. A failed
# `dox-site` skips this job, so its failure shows once, on `dox-site`.
dox-browser:
name: Dox browser tests (Chromium, WebKit)
name: Dox browser tests (Chromium)
runs-on: ubuntu-latest
needs: [determine-affected, dox-site]
if: contains(fromJSON(needs.determine-affected.outputs.checks), 'dox-dist') || contains(fromJSON(needs.determine-affected.outputs.checks), 'dox-tables')
Expand Down Expand Up @@ -446,17 +446,18 @@ jobs:
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-chromium-webkit
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.os }}-${{ steps.pw.outputs.version }}-chromium

# WebKit too: the industry tag test checks where Safari's engine places the tag definition.
- name: Install Chromium and WebKit
# Chromium only: WebKit runs these tests once a week (dox-gates-weekly.yml, the webkit-1 leg's
# step Browser tests, in WebKit).
- name: Install Chromium
if: contains(fromJSON(env.CHECKS), 'dox-tables')
run: pnpm --filter @gmt/dox exec playwright install --with-deps chromium webkit
run: pnpm --filter @gmt/dox exec playwright install --with-deps chromium

# The tests that launch a browser (`*.browser.test.ts`, left out of the Tests job, which
# installs none): the industry tag definitions. The built
# site is there, so a test that needs it fails rather than skips.
- name: Browser tests, in Chromium and WebKit
- name: Browser tests, in Chromium
if: contains(fromJSON(env.CHECKS), 'dox-tables')
env:
DOX_DIST_REQUIRED: "1"
Expand Down
62 changes: 45 additions & 17 deletions .github/workflows/dox-gates-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ name: Dox gates weekly
# Pulse check: dox-gates
#
# The PR job (ci.yml, `dox-gates`) checks the changed pages in Chromium. This sweep checks every page
# in three browsers and both themes, once a week, and files what fails as a `dox-gate` issue, one
# open issue per finding (apps/dox/scripts/gates/issue-plan.mjs). A failing gate fails its leg; the
# report job still runs and files. `force_finding` on a manual dispatch also files one [dry run]
# issue for a synthetic finding, to prove the filing path without a real failure.
# in three browsers and both themes, once a week, and files what fails in one rolling `dox-gate`
# issue (apps/dox/scripts/gates/issue-plan.mjs): each failing run rewrites it, a clean run closes it.
# A failing gate fails its leg; the report job still runs and files. `force_finding` on a manual
# dispatch also files one [dry run] rolling issue for a synthetic finding, to prove the filing path.
#
# Legs: --shard i/n splits each gate's page list so the legs of one browser share the work: by name,
# round-robin starting at the gate's registry index (so the one-page gates spread over the legs).
# 4 Chromium legs, one Firefox and one WebKit leg leave about 10 minutes of headroom under the
# 40-minute deadline. Adding or removing a leg means changing the matrix and the LEGS list of the
# report job, which names every leg so one that crashed without uploading is still filed.
# Legs: one per browser. Chromium runs every page of `a11y-axe` in both themes, about 100 minutes;
# nobody waits on a weekly run, so it is one long leg rather than shards. --shard i/n can split a
# browser's pages over more legs again: by name, round-robin from the gate's registry index. Adding
# or removing a leg means changing the matrix and the LEGS list of the report job, which names every
# leg so one that crashed without uploading is still filed.
#
# A leg whose summary never reaches the report is sorted by its job (apps/dox/scripts/gates/
# issue-plan.mjs, `missingSummary`): if its "Check the summary was written" step passed, the runner
Expand All @@ -24,7 +24,7 @@ on:
workflow_dispatch:
inputs:
force_finding:
description: "Dry run: file one [dry run] issue for a synthetic finding"
description: "Dry run: also file one rolling [dry run] issue for a synthetic finding"
type: boolean
required: false
default: false
Expand All @@ -46,15 +46,12 @@ jobs:
sweep:
name: Sweep (${{ matrix.leg }})
runs-on: ubuntu-latest
timeout-minutes: 50
timeout-minutes: 150
strategy:
fail-fast: false
matrix:
include:
- { leg: chromium-1, browser: chromium, shard: "1/4" }
- { leg: chromium-2, browser: chromium, shard: "2/4" }
- { leg: chromium-3, browser: chromium, shard: "3/4" }
- { leg: chromium-4, browser: chromium, shard: "4/4" }
- { leg: chromium-1, browser: chromium, shard: "1/1" }
- { leg: firefox-1, browser: firefox, shard: "1/1" }
- { leg: webkit-1, browser: webkit, shard: "1/1" }
steps:
Expand Down Expand Up @@ -98,7 +95,38 @@ jobs:
- name: Gates, every page (shard ${{ matrix.shard }})
run: >
pnpm --filter dox gates --all --browsers ${{ matrix.browser }}
--themes dark,light --retries 1 --shard ${{ matrix.shard }} --deadline 40
--themes dark,light --retries 1 --shard ${{ matrix.shard }} --deadline 140

# WebKit runs the browser tests here, once a week; every PR runs them in Chromium (ci.yml,
# `dox-browser`). This leg already has WebKit and the site the gates built. The result joins
# the leg's summary as a `browser-tests` row, so a failure lands in the rolling issue with the
# failing tests' lines.
- name: Browser tests, in WebKit
Comment thread
baldurpan marked this conversation as resolved.
Resolved
if: ${{ !cancelled() && matrix.browser == 'webkit' }}
env:
DOX_BROWSERS: webkit
DOX_DIST_REQUIRED: "1"
run: |
set +e
pnpm --filter dox exec vitest run --config vitest.browser.config.ts 2>&1 | tee "$RUNNER_TEMP/browser-tests.log"
code=${PIPESTATUS[0]}
node -e '
const fs = require("node:fs");
const [code, log] = process.argv.slice(1);
const file = "apps/dox/.gates/summary.json";
if (!fs.existsSync(file)) process.exit(0);
const summary = JSON.parse(fs.readFileSync(file, "utf8"));
const lines = fs.readFileSync(log, "utf8").replace(/\x1b\[[0-9;]*m/g, "").split("\n");
const failing = lines.filter((l) => / FAIL |Error/.test(l));
summary.rows.push({
id: "browser-tests",
status: code === "0" ? "PASS" : "FAIL",
detail: "*.browser.test.ts in WebKit",
logTail: (failing.length > 0 ? failing : lines).slice(-10),
});
fs.writeFileSync(file, JSON.stringify(summary, null, 2));
' "$code" "$RUNNER_TEMP/browser-tests.log"
exit "$code"

# Passes only when the runner left a summary the report can read. The report reads this
# step's result from the jobs API to tell a leg that lost its upload from one that never
Expand Down Expand Up @@ -177,7 +205,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
FORCE_FINDING: ${{ inputs.force_finding }}
# Every leg of the sweep job's matrix.
LEGS: chromium-1,chromium-2,chromium-3,chromium-4,firefox-1,webkit-1
LEGS: chromium-1,firefox-1,webkit-1
run: |
args=(--legs "$LEGS")
if [ "$FORCE_FINDING" = "true" ]; then args+=(--dry-run-finding); fi
Expand Down
14 changes: 3 additions & 11 deletions apps/dox/scripts/ccsds-time-code-decoder-holds.browser.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import type { Server } from "node:http";
import type { AddressInfo } from "node:net";
import { resolve } from "node:path";
import {
chromium,
webkit,
type Browser,
type BrowserType,
type Page,
} from "@playwright/test";
import { type Browser, type Page } from "@playwright/test";
import { testEngines } from "./lib/browser-launch.mjs";
import { distDirOrSkip } from "./dist-dir";
import { serveStatic } from "./lib/static-server.mjs";

Expand All @@ -24,10 +19,7 @@ const EPSILON = 0.5;
const WIDTHS = [300, 1280];
/** The widths the page is loaded at. */
const LOAD_WIDTHS = [390, 1440];
const ENGINES: [string, BrowserType][] = [
["chromium", chromium],
["webkit", webkit],
];
const ENGINES = testEngines();
/**
* The boxes whose size the reader must never see change. A hold's live content (the code frame
* inside the calls hold) may be shorter than the hold, so only the hold itself is measured.
Expand Down
13 changes: 3 additions & 10 deletions apps/dox/scripts/clock-row-height.browser.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { Server } from "node:http";
import type { AddressInfo } from "node:net";
import { resolve } from "node:path";
import {
chromium,
webkit,
type Browser,
type BrowserType,
} from "@playwright/test";
import { type Browser } from "@playwright/test";
import { testEngines } from "./lib/browser-launch.mjs";
import { distDirOrSkip } from "./dist-dir";
import { serveStatic } from "./lib/static-server.mjs";

Expand All @@ -18,10 +14,7 @@ import { serveStatic } from "./lib/static-server.mjs";
*/

const dist = distDirOrSkip();
const ENGINES: [string, BrowserType][] = [
["chromium", chromium],
["webkit", webkit],
];
const ENGINES = testEngines();

let server: Server | undefined;

Expand Down
15 changes: 3 additions & 12 deletions apps/dox/scripts/code-b-day-ruler-holds.browser.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import type { Server } from "node:http";
import type { AddressInfo } from "node:net";
import { resolve } from "node:path";
import {
chromium,
webkit,
type Browser,
type ElementHandle,
type BrowserType,
type Page,
} from "@playwright/test";
import { type Browser, type ElementHandle, type Page } from "@playwright/test";
import { testEngines } from "./lib/browser-launch.mjs";
import type { ExpectStatic } from "vitest";
import { distDirOrSkip } from "./dist-dir";
import { serveStatic } from "./lib/static-server.mjs";
Expand All @@ -31,10 +25,7 @@ const dist = distDirOrSkip();
const EPSILON = 0.5;
const WIDTHS = [300, 390, 1280, 1440];
const THEMES = ["light", "dark"] as const;
const ENGINES: [string, BrowserType][] = [
["chromium", chromium],
["webkit", webkit],
];
const ENGINES = testEngines();
const GATES = ["hold", "hero", "drawn"];
const PRESETS = ["after-leap-day", "day-366", "century"];

Expand Down
13 changes: 3 additions & 10 deletions apps/dox/scripts/first-paint-layout.browser.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { Server } from "node:http";
import type { AddressInfo } from "node:net";
import { resolve } from "node:path";
import {
chromium,
webkit,
type Browser,
type BrowserType,
} from "@playwright/test";
import { type Browser } from "@playwright/test";
import { testEngines } from "./lib/browser-launch.mjs";
import { distDirOrSkip } from "./dist-dir";
import { serveStatic } from "./lib/static-server.mjs";

Expand All @@ -25,10 +21,7 @@ import { serveStatic } from "./lib/static-server.mjs";
*/

const dist = distDirOrSkip();
const ENGINES: [string, BrowserType][] = [
["chromium", chromium],
["webkit", webkit],
];
const ENGINES = testEngines();

/** The issue's window, a laptop, and a phone held upright. */
const VIEWPORTS = [
Expand Down
14 changes: 3 additions & 11 deletions apps/dox/scripts/fix-timestamp-reader-holds.browser.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import type { Server } from "node:http";
import type { AddressInfo } from "node:net";
import { resolve } from "node:path";
import {
chromium,
webkit,
type Browser,
type BrowserType,
type Page,
} from "@playwright/test";
import { type Browser, type Page } from "@playwright/test";
import { testEngines } from "./lib/browser-launch.mjs";
import { distDirOrSkip } from "./dist-dir";
import { serveStatic } from "./lib/static-server.mjs";

Expand All @@ -24,10 +19,7 @@ const EPSILON = 0.5;
const WIDTHS = [300, 1280];
/** The widths the page is loaded at. */
const LOAD_WIDTHS = [390, 1440];
const ENGINES: [string, BrowserType][] = [
["chromium", chromium],
["webkit", webkit],
];
const ENGINES = testEngines();
/**
* The boxes whose size the reader must never see change. A hold's live content (the code frame
* inside the calls hold) may be shorter than the hold, so only the hold itself is measured.
Expand Down
6 changes: 3 additions & 3 deletions apps/dox/scripts/gates/ci-legs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ describe("the Dox gates job in ci.yml", () => {
});

describe("the weekly sweep legs", () => {
it("run 4 Chromium legs, one Firefox leg and one WebKit leg", () => {
it("run one leg per browser", () => {
const matrix = (weekly.jobs.sweep?.strategy?.matrix?.include ??
[]) as unknown as { browser: string }[];
const count = (browser: string) =>
matrix.filter((m) => m.browser === browser).length;
expect([count("chromium"), count("firefox"), count("webkit")]).toEqual([
4, 1, 1,
1, 1, 1,
]);
expect(matrix).toHaveLength(6);
expect(matrix).toHaveLength(3);
});

it("stop their runner at least 10 minutes inside the job's timeout", () => {
Expand Down
38 changes: 30 additions & 8 deletions apps/dox/scripts/gates/file-issues.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env node
/**
* Files the weekly gate sweep's findings as `dox-gate` issues. A thin shell around the pure decision
* Files the weekly gate sweep's findings as one rolling `dox-gate` issue. A thin shell around the pure decision
* in `./issue-plan.mjs`, shaped like `scripts/canary-report.mjs`: it reads the `summary.json` each
* sweep leg wrote, asks the planner what to do against the open `dox-gate` issues and runs that
* through the GitHub CLI.
* sweep leg wrote, asks the planner what to do against the open `dox-gate` issues (open, edit or
* comment on the rolling issue, close it when clean, close the old per-finding issues) and runs
* that through the GitHub CLI.
*
* node apps/dox/scripts/gates/file-issues.mjs [--print] [--offline] [--dry-run-finding]
* [--legs <leg,...>] <summary.json ...>
Expand All @@ -18,7 +19,7 @@
* action, then a count); with `$GITHUB_STEP_SUMMARY` set it also appends the plan there.
* `--offline` plans with no `gh` call at all: no open issue is assumed and no job list is read, so
* it runs anywhere and implies `--print`. Every action line shows its body's length; no body or
* comment may pass `BODY_LIMIT`, checked before the first write. `--dry-run-finding` adds one synthetic `[dry run]` finding under the `dox-gate-dry-run` label.
* comment may pass `BODY_LIMIT`, checked before the first write. `--dry-run-finding` adds one synthetic `[dry run]` finding in its own rolling issue under the `dox-gate-dry-run` label.
*
* Exit 0 when the actions were carried out (findings do not change it; the sweep legs already
* fail), 1 when a `gh` call failed, 2 for usage (including a summary path with no leg or no
Expand Down Expand Up @@ -130,7 +131,7 @@ export function listOpenGateIssues(gh) {
"--limit",
"1000",
"--json",
"number,body,labels",
"number,title,body,labels",
]),
);
}
Expand All @@ -153,6 +154,25 @@ export function runActions(gh, actions) {
);
return { action, ok: true };
}
if (action.kind === "edit") {
gh(
[
"issue",
"edit",
String(action.issue),
"--title",
action.title,
"--body-file",
"-",
],
action.body,
);
return { action, ok: true };
}
if (action.kind === "close") {
gh(["issue", "close", String(action.issue), "--comment", action.body]);
return { action, ok: true };
}
gh(
[
"issue",
Expand Down Expand Up @@ -260,16 +280,18 @@ export function readLegs(files, legs) {

const actionLine = (a) =>
a.kind === "open"
? `open ${a.key} ${a.title}${a.groups === undefined ? "" : ` ${a.groups} groups`} body ${a.body.length} chars`
: `comment #${a.issue} ${a.key} body ${a.body.length} chars`;
? `open ${a.group} ${a.title} body ${a.body.length} chars`
: a.kind === "edit"
? `edit #${a.issue} ${a.group} ${a.title} body ${a.body.length} chars`
: `${a.kind} #${a.issue} ${a.group} body ${a.body.length} chars`;

/** The actions whose body is longer than GitHub accepts, as error lines. */
const oversize = (actions) =>
actions
.filter((a) => a.body.length > BODY_LIMIT)
.map(
(a) =>
`file-issues: the ${a.kind === "open" ? "issue" : "comment"} for ${a.key} is ${a.body.length} characters, over GitHub's ${BODY_LIMIT}`,
`file-issues: the ${a.kind} for ${a.group} is ${a.body.length} characters, over GitHub's ${BODY_LIMIT}`,
);

/**
Expand Down
Loading
Loading