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
50 changes: 8 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,6 @@ jobs:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
# To read the tests set aside (open flaky-test issues, scripts/flaky-tests.ts).
issues: read
env:
PLAYWRIGHT_IMAGE: mcr.microsoft.com/playwright:v1.62.1-noble@sha256:dcc5531e97840b9b5e794f2814476b21571c5124a3fca2267d73041f56e7580e
steps:
Expand Down Expand Up @@ -502,9 +500,6 @@ jobs:
# onboarding frame reads the generated app config, which `bun test` alone doesn't write (the
# test script's pretest does).
- run: bun run generate:app-config
# Under scripts/flaky-tests.ts, like every real-browser list and the suite's shards: a test
# that fails runs once more, one that then passes is flaky and named in the run's notes, and a
# test set aside (an open flaky-test issue) still runs but does not fail the job.
- run: |
# One file per line, sorted: pull requests that each add a file then merge cleanly.
files=(
Expand Down Expand Up @@ -554,15 +549,12 @@ jobs:
extension/tests/idle-worker.browser.test.ts
extension/tests/recording-mark.browser.test.ts
)
bun scripts/flaky-tests.ts run -- \
docker run --rm --ipc=host \
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE" \
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
--env OPENBOT_APP_BROWSER=1 \
"$PLAYWRIGHT_IMAGE" \
bun test --parallel --retry=1 "${files[@]}"
env:
GH_TOKEN: ${{ github.token }}
bun test --parallel "${files[@]}"
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure
Expand Down Expand Up @@ -716,8 +708,6 @@ jobs:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
# To read the tests set aside (open flaky-test issues, scripts/flaky-tests.ts).
issues: read
env:
PLAYWRIGHT_IMAGE: mcr.microsoft.com/playwright:v1.62.1-noble@sha256:dcc5531e97840b9b5e794f2814476b21571c5124a3fca2267d73041f56e7580e
TEST_WORKERS: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && '2' || '8' }}
Expand Down Expand Up @@ -880,15 +870,12 @@ jobs:
app/tests/work-folded-layout.test.tsx
app/tests/workspace-snapshots-layout.test.tsx
)
bun scripts/flaky-tests.ts run -- \
docker run --rm --ipc=host \
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE" \
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
--env OPENBOT_APP_BROWSER=1 --env OPENBOT_APP_ENGINES="$BROWSER_ENGINE" \
"$PLAYWRIGHT_IMAGE" \
bun test --parallel="$TEST_WORKERS" --timeout="$TEST_TIMEOUT_MS" --retry=1 --shard="$TEST_SHARD" --timings="scripts/browser-timings/$BROWSER_ENGINE.json" --update-timings "${files[@]}"
env:
GH_TOKEN: ${{ github.token }}
bun test --parallel="$TEST_WORKERS" --timeout="$TEST_TIMEOUT_MS" --shard="$TEST_SHARD" --timings="scripts/browser-timings/$BROWSER_ENGINE.json" --update-timings "${files[@]}"
# This shard's own durations, which the run wrote over the engine's record: download every
# shard's and merge them to refresh it (scripts/browser-timings.ts).
- if: ${{ !cancelled() }}
Expand All @@ -901,16 +888,13 @@ jobs:
# Connect your AI's sign-in code, copied with one press and read back from WebKit's clipboard.
# Only that test: the rest of the file runs in Chromium in the job above. Once, on the first shard.
- if: matrix.engine == 'WebKit' && matrix.shard == 1
env:
GH_TOKEN: ${{ github.token }}
run: |
bun scripts/flaky-tests.ts run -- \
docker run --rm --ipc=host \
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE" \
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
--env OPENBOT_APP_BROWSER=1 --env OPENBOT_APP_ENGINES=webkit \
"$PLAYWRIGHT_IMAGE" \
bun test --retry=1 app/tests/connect-your-ai.test.tsx -t "copies with one press"
bun test app/tests/connect-your-ai.test.tsx -t "copies with one press"
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure
Expand All @@ -930,8 +914,6 @@ jobs:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
# To read the tests set aside (open flaky-test issues, scripts/flaky-tests.ts).
issues: read
env:
PLAYWRIGHT_IMAGE: mcr.microsoft.com/playwright:v1.62.1-noble@sha256:dcc5531e97840b9b5e794f2814476b21571c5124a3fca2267d73041f56e7580e
steps:
Expand All @@ -946,34 +928,27 @@ jobs:
working-directory: desktop
# A list, as in the jobs above, so scripts/ci-changes.ts can tell this job covers the file and a
# change to it does not run it a second time in `tests (changed files)`. Paths from desktop/.
# Under scripts/flaky-tests.ts, as the lists above.
- env:
GH_TOKEN: ${{ github.token }}
run: |
- run: |
files=(
src/setupLayout.approved.browser.test.ts
src/setupLayout.browser.test.ts
src/setupLayout.moveToCloud.browser.test.ts
)
bun scripts/flaky-tests.ts run --root desktop -- \
docker run --rm --ipc=host \
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE/desktop" \
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
--env OPENBOT_APP_BROWSER=1 \
"$PLAYWRIGHT_IMAGE" \
bun test --parallel --retry=1 "${files[@]}"
bun test --parallel "${files[@]}"
# Connect your AI's key field and tab row, in WebKit, the engine the Mac window draws with.
# Only those tests: the rest of the file runs in Chromium in the step above.
- env:
GH_TOKEN: ${{ github.token }}
run: |
bun scripts/flaky-tests.ts run --root desktop -- \
- run: |
docker run --rm --ipc=host \
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE/desktop" \
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
--env OPENBOT_APP_BROWSER=1 --env OPENBOT_APP_ENGINE=webkit \
"$PLAYWRIGHT_IMAGE" \
bun test --retry=1 src/setupLayout.browser.test.ts -t "the key field and the tab row"
bun test src/setupLayout.browser.test.ts -t "the key field and the tab row"
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
uses: $/.github/actions/stop-on-failure
Expand All @@ -997,8 +972,6 @@ jobs:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
# To read the tests set aside (open flaky-test issues, scripts/flaky-tests.ts).
issues: read
strategy:
# Every shard runs to the end, so one red run names every failing test, not just the first
# shard's. On a pull request the first failure anywhere stops the whole run instead
Expand Down Expand Up @@ -1027,11 +1000,8 @@ jobs:
- run: bun install --frozen-lockfile
working-directory: desktop
# This shard's tests, failing on a failed test or on a count it cannot read. The floor under the
# count is the suite's, so the `tests` job checks it on the sum of the shards. A failed test
# runs once more, and a test set aside does not fail the shard (scripts/flaky-tests.ts).
# count is the suite's, so the `tests` job checks it on the sum of the shards.
- run: bun run test:ci
env:
GH_TOKEN: ${{ github.token }}
# The shard's count, and how long each of its files took.
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand Down Expand Up @@ -1105,8 +1075,6 @@ jobs:
contents: read
# To cancel this run at its first failure (.github/actions/stop-on-failure).
actions: write
# To read the tests set aside (open flaky-test issues, scripts/flaky-tests.ts).
issues: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -1136,8 +1104,6 @@ jobs:
BROWSER_TESTS: ${{ needs.changes.outputs.browser_tests }}
WEBKIT_TESTS: ${{ needs.changes.outputs.webkit_tests }}
DESKTOP_BROWSER_TESTS: ${{ needs.changes.outputs.desktop_browser_tests }}
# The tests set aside, read from the open flaky-test issues (scripts/flaky-tests.ts).
GH_TOKEN: ${{ github.token }}
run: bun scripts/ci-run-tests.ts
# On a failure, cancels the run at once (.github/actions/stop-on-failure).
- if: failure()
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/flaky-tests.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,6 @@ jobs:
# CI's `release note` asks for it, to read a pull request's description. It runs on a pull
# request only, so on this push it is skipped and reads nothing.
pull-requests: read
# CI's test jobs ask for it, to read the tests set aside (open flaky-test issues,
# scripts/flaky-tests.ts).
issues: read

# The images, built once from the commit that passed the checks above, and tagged with this
# release's version and `latest`, with the server, computer and supervisor pinned at the tag this
Expand Down
6 changes: 1 addition & 5 deletions .github/zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ rules:
# nothing from the run, and leaves runs from forks alone (scripts/ci-watch.ts). Contributor CI
# needs it to look as soon as a run of CI or Desktop starts or finishes, rather than polling on a
# timer. It checks out only scripts/contributor-ci.ts from the default branch, never the run's
# code, downloads no artifact, and acts on runs through the API alone. Flaky tests needs it to
# read the notes CI's test steps left once a run finishes. It checks out only the default branch's
# own code, downloads no artifact, runs nothing from the run, and leaves runs from forks alone
# (scripts/flaky-tests-watch.ts).
# code, downloads no artifact, and acts on runs through the API alone.
dangerous-triggers:
ignore:
- ci-watch.yml
- contributor-ci.yml
- flaky-tests.yml
2 changes: 0 additions & 2 deletions scripts/ci-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,6 @@ function fullBrowserFiles(
flag,
) ||
/^--timeout=(?:[1-9]\d*|"\$[A-Z_][A-Z0-9_]*")$/.test(flag) ||
// A failed test run once more still runs every file (scripts/flaky-tests.ts).
/^--retry=[1-9]\d*$/.test(flag) ||
(completeShards && flag === '--shard="$TEST_SHARD"') ||
// Recorded durations move a file between shards, never out of them, as long
// as every shard of an engine reads the same record: a fixed path, or one named
Expand Down
3 changes: 0 additions & 3 deletions scripts/ci-run-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ describe("changed desktop browser tests", () => {
"desktop/src/other.browser.test.ts",
]);
expect(result.status).toBe(0);
// Each run retries a failed test once (scripts/flaky-tests.ts).
expect(result.calls).toEqual([
{
args: [
"test",
"--retry=1",
"./src/setupLayout.browser.test.ts",
"./src/other.browser.test.ts",
],
Expand All @@ -145,7 +143,6 @@ describe("changed desktop browser tests", () => {
"test",
"-t",
"the key field and the tab row",
"--retry=1",
"./src/setupLayout.browser.test.ts",
],
cwd: result.cwd,
Expand Down
28 changes: 4 additions & 24 deletions scripts/ci-run-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
*/
import { existsSync, lstatSync } from "node:fs";
import { isBunTest, unusualPath } from "./ci-changes";
import {
judge,
parseBunOutput,
type Quarantine,
readableBunEnv,
readQuarantine,
report,
} from "./flaky-tests";
import { testsRan } from "./test-floor";

/** A path from the changes job, held to being a test file inside this checkout. */
Expand Down Expand Up @@ -47,9 +39,6 @@ export function testPaths(json: string | undefined, name: string): string[] {
});
}

/** The tests set aside (open flaky-test issues), read once for every group. */
let quarantine: Promise<Quarantine> | undefined;

async function runGroup(
label: string,
command: string[],
Expand All @@ -58,25 +47,16 @@ async function runGroup(
): Promise<boolean> {
if (files.length === 0) return true;
console.log(`\n${label}: ${files.join(" ")}`);
quarantine ??= readQuarantine();
// A failed test runs once more; one that then passes is flaky, and named in the run's notes, and
// a test set aside does not fail the group (scripts/flaky-tests.ts).
const proc = Bun.spawn([...command, "--retry=1", ...files], {
const proc = Bun.spawn([...command, ...files], {
cwd: options.cwd,
env: readableBunEnv({ ...process.env, ...options.env }),
env: { ...process.env, ...options.env },
stdout: "inherit",
stderr: "pipe",
});
const stderr = await new Response(proc.stderr).text();
process.stderr.write(stderr);
const setAside = await quarantine;
const verdict = judge(
parseBunOutput(stderr, options.cwd ?? ""),
await proc.exited,
setAside.tests,
);
process.stdout.write(report(verdict, setAside));
if (verdict.blocking) return false;
const status = await proc.exited;
if (status !== 0) return false;
const count = testsRan(stderr);
if (!count) {
console.error(
Expand Down
8 changes: 0 additions & 8 deletions scripts/ci-watch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ describe("the tests a failed job's log names", () => {
]);
});

test("leave out the go a retry adds, as the notes of a run name a test", () => {
expect(
failingTests(
"2026-12-04T10:00:00.0000000Z (fail) a group > a test (attempt 2) [12.00ms]\n",
),
).toEqual(["a group > a test"]);
});

test("are none in a log with no failed test", () => {
expect(
failingTests(
Expand Down
9 changes: 1 addition & 8 deletions scripts/ci-watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,7 @@ export function failingTests(log: string): string[] {
line,
);
const cargo = /^test (\S+) \.\.\. FAILED$/.exec(line);
// Named as scripts/flaky-tests.ts names a test, so both write to one issue: without the go a
// retry adds.
const name = (
bun?.[1] ??
pytest?.[1] ??
playwright?.[1] ??
cargo?.[1]
)?.replace(/ \((?:attempt \d+|retry #\d+)\)$/, "");
const name = bun?.[1] ?? pytest?.[1] ?? playwright?.[1] ?? cargo?.[1];
if (name) found.add(name.trim());
}
return [...found];
Expand Down
Loading
Loading