Files
open-design/e2e/tests/packaged-smoke-workflow.test.ts
PerishFireandGitHub bb13eee765 chore: optimize CI and beta release runtime (#2231)
* chore(ci): add runtime trace summaries

* chore(ci): tighten measured workspace steps

* chore(release): tighten beta setup steps

* chore(release): slim beta windows smoke

* chore(ci): shard daemon tests

* chore(ci): harden runtime trace lookup

* chore(release): avoid mac pnpm cache in beta

* chore(ci): split critical playwright checks

* chore(release): publish beta platforms from builders

* test(e2e): update beta release workflow expectation

* chore(ci): stop gating PRs on nix check

* fix(release): keep beta latest complete
2026-05-19 18:06:28 +08:00

90 lines
4.9 KiB
TypeScript

import { readFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
const e2eRoot = dirname(dirname(fileURLToPath(import.meta.url)));
const workspaceRoot = dirname(e2eRoot);
const ciWorkflowPath = join(workspaceRoot, ".github", "workflows", "ci.yml");
const releaseBetaWorkflowPath = join(workspaceRoot, ".github", "workflows", "release-beta.yml");
const releaseStableWorkflowPath = join(workspaceRoot, ".github", "workflows", "release-stable.yml");
describe("packaged smoke workflow", () => {
it("keeps packaged smoke outside the main CI gate", async () => {
const workflow = await readFile(ciWorkflowPath, "utf8");
expect(workflow).not.toContain("packaged_smoke_");
expect(workflow).not.toContain("Build PR mac artifacts");
expect(workflow).not.toContain("Build PR windows artifacts");
expect(workflow).not.toContain("Build PR linux headless artifacts");
expect(workflow).not.toContain("Smoke PR mac packaged runtime");
expect(workflow).not.toContain("Smoke PR windows packaged runtime");
expect(workflow).not.toContain("Smoke PR linux headless packaged runtime");
expect(workflow).not.toContain("OD_PACKAGED_E2E_");
expect(workflow).not.toContain("actions/cache/save");
});
it("preserves beta linux AppImage smoke reports for platform publication", async () => {
const workflow = await readFile(releaseBetaWorkflowPath, "utf8");
const linuxBuildStep = workflow.match(
/- name: Build beta linux artifacts\n(?:.+\n)+?(?=\n - name: Smoke beta linux AppImage runtime)/m,
);
expect(linuxBuildStep?.[0]).toBeDefined();
expect(linuxBuildStep?.[0]).toContain(
'node -e \'const fs = require("node:fs"); JSON.parse(fs.readFileSync(process.argv[1], "utf8"));\' "$build_json_path"',
);
expect(workflow).toContain("Smoke beta linux AppImage runtime");
expect(workflow).toContain("manifest.json");
expect(workflow).toContain("tools-pack.json");
expect(workflow).toContain("Upload linux e2e spec report");
expect(workflow).toContain("open-design-beta-linux-e2e-report");
expect(workflow).toContain("Publish beta linux assets to R2");
expect(workflow).toContain("RELEASE_PLATFORM: linux");
expect(workflow).toContain("Upload linux publish manifest");
expect(workflow).toContain("open-design-beta-linux-publish-manifest");
expect(workflow).not.toContain("Download linux e2e spec report");
expectReleaseLinuxBuildPreservesEvidence(workflow, "Build beta linux artifacts");
expectReleaseLinuxSmokePreservesEvidenceBeforeApt(workflow, "Smoke beta linux AppImage runtime");
});
it("preserves stable linux AppImage smoke reports for release publication", async () => {
const workflow = await readFile(releaseStableWorkflowPath, "utf8");
const linuxBuildStep = workflow.match(
/- name: Build release linux artifacts\n(?:.+\n)+?(?=\n - name: Smoke release linux AppImage runtime)/m,
);
expect(linuxBuildStep?.[0]).toBeDefined();
expect(linuxBuildStep?.[0]).toContain(
'node -e \'const fs = require("node:fs"); JSON.parse(fs.readFileSync(process.argv[1], "utf8"));\' "$build_json_path"',
);
expect(workflow).toContain("Smoke release linux AppImage runtime");
expect(workflow).toContain("manifest.json");
expect(workflow).toContain("tools-pack.json");
expect(workflow).toContain("Upload linux e2e spec report");
expect(workflow).toContain("open-design-release-linux-e2e-report");
expect(workflow).toContain("Download linux e2e spec report");
expectReleaseLinuxBuildPreservesEvidence(workflow, "Build release linux artifacts");
expectReleaseLinuxSmokePreservesEvidenceBeforeApt(workflow, "Smoke release linux AppImage runtime");
});
});
function expectReleaseLinuxBuildPreservesEvidence(workflow: string, stepName: string): void {
const step = workflow.match(new RegExp(`- name: ${stepName}\\n(?:.+\\n)+?(?=\\n - name: Smoke .+ linux AppImage runtime)`, "m"))?.[0];
expect(step).toBeDefined();
expect(step).toContain('report_dir="$RUNNER_TEMP/release-report/linux"');
expect(step).toContain('mkdir -p "$report_dir"');
expect(step).toContain('build_json_path="$report_dir/tools-pack.json"');
expect(step).toContain('build_log_path="$report_dir/tools-pack.log"');
expect(step).toContain('printf \'%s\\n\' "$build_output" | tee "$build_json_path"');
}
function expectReleaseLinuxSmokePreservesEvidenceBeforeApt(workflow: string, stepName: string): void {
const step = workflow.match(new RegExp(`- name: ${stepName}\\n(?:.+\\n)+?(?=\\n - name: Upload linux e2e spec report)`, "m"))?.[0];
expect(step).toBeDefined();
const aptIndex = step?.indexOf("sudo apt-get update") ?? -1;
const reportDirIndex = step?.indexOf('report_dir="$RUNNER_TEMP/release-report/linux"') ?? -1;
expect(aptIndex).toBeGreaterThan(-1);
expect(reportDirIndex).toBeGreaterThan(-1);
expect(reportDirIndex).toBeLessThan(aptIndex);
}