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
2 changes: 1 addition & 1 deletion scripts/ci-nx-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ release_helper_script_tests_only() {
local file
for file in "${direct_vitest_files[@]}"; do
case "$file" in
test/scripts/install-smoke-utils.test.ts | test/scripts/release-context-deps.test.ts | test/scripts/workspace-utils.test.ts)
test/scripts/install-smoke-utils.test.ts | test/scripts/release-context-deps.test.ts | test/scripts/release-impact-filter.test.ts | test/scripts/workspace-utils.test.ts)
;;
*)
return 1
Expand Down
2 changes: 2 additions & 0 deletions scripts/plan-ci-checks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const RELEASE_HELPER_PACKAGE_FILES = new Set([
"scripts/configure-npm-trusted-publisher.mjs",
"scripts/deprecate-release.js",
"scripts/install-smoke-utils.js",
"scripts/release-impact-filter.mjs",
"scripts/release-readiness.js",
"scripts/smoke-packed-cli.js",
"scripts/smoke-published-replay-e2e.js",
Expand All @@ -111,6 +112,7 @@ const RELEASE_HELPER_PACKAGE_FILES = new Set([
const RELEASE_HELPER_TEST_FILES = new Set([
"test/scripts/install-smoke-utils.test.ts",
"test/scripts/release-context-deps.test.ts",
"test/scripts/release-impact-filter.test.ts",
"test/scripts/workspace-utils.test.ts",
]);

Expand Down
2 changes: 2 additions & 0 deletions scripts/plan-nx-test-command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const RELEASE_HELPER_PACKAGE_FILES = new Set([
"scripts/configure-npm-trusted-publisher.mjs",
"scripts/deprecate-release.js",
"scripts/install-smoke-utils.js",
"scripts/release-impact-filter.mjs",
"scripts/release-readiness.js",
"scripts/smoke-packed-cli.js",
"scripts/smoke-published-replay-e2e.js",
Expand All @@ -48,6 +49,7 @@ const RELEASE_HELPER_PACKAGE_FILES = new Set([
const RELEASE_HELPER_TEST_FILES = new Set([
"test/scripts/install-smoke-utils.test.ts",
"test/scripts/release-context-deps.test.ts",
"test/scripts/release-impact-filter.test.ts",
"test/scripts/workspace-utils.test.ts",
]);
const SMOKE_SCRIPT_PATTERN = /^scripts\/smoke-[^/]+\.[cm]?[jt]sx?$/;
Expand Down
40 changes: 29 additions & 11 deletions test/scripts/ci-guardrails.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ describe("planCiChecks", () => {
"scripts/ci-nx-tests.sh",
"scripts/install-smoke-utils.js",
"scripts/plan-nx-test-command.mjs",
"scripts/release-impact-filter.mjs",
"scripts/release-readiness.js",
"scripts/runtime-workspaces.mjs",
"scripts/summarize-nx-profile.mjs",
Expand Down Expand Up @@ -305,12 +306,14 @@ describe("planCiChecks", () => {
"scripts/ci-nx-tests.sh",
"scripts/plan-ci-checks.mjs",
"scripts/plan-nx-test-command.mjs",
"scripts/release-impact-filter.mjs",
"scripts/release-readiness.js",
"scripts/smoke-packed-cli.js",
"scripts/smoke-published-replay-e2e.js",
"scripts/smoke-registry-install.js",
"scripts/workspace-utils.js",
"test/scripts/ci-guardrails.test.ts",
"test/scripts/release-impact-filter.test.ts",
"test/scripts/workspace-utils.test.ts",
],
}),
Expand Down Expand Up @@ -631,6 +634,7 @@ describe("ci workflow guardrails", () => {
"Release helper script tests are handled directly by Vitest.",
);
expect(script).toContain("node ./scripts/run-vitest.js --run");
expect(script).toContain("test/scripts/release-impact-filter.test.ts");
expect(script).toContain("test/scripts/workspace-utils.test.ts");
});

Expand Down Expand Up @@ -803,11 +807,14 @@ describe("ci workflow guardrails", () => {
expect(helperSmokeStep?.run).toContain(
"node --check scripts/deprecate-release.js",
);
expect(helperSmokeStep?.run).toContain(
"node --check scripts/release-impact-filter.mjs",
);
expect(helperSmokeStep?.run).toContain(
"node --check scripts/configure-npm-trusted-publisher.mjs",
);
expect(helperSmokeStep?.run).toContain(
"node ./scripts/run-vitest.js --run test/scripts/install-smoke-utils.test.ts test/scripts/smoke-published-replay-e2e.test.ts test/scripts/workspace-utils.test.ts",
"node ./scripts/run-vitest.js --run test/scripts/install-smoke-utils.test.ts test/scripts/release-impact-filter.test.ts test/scripts/smoke-published-replay-e2e.test.ts test/scripts/workspace-utils.test.ts",
);
expect(helperSmokeStep?.run).toContain(
"MAESTRO_SKIP_INSTALL_AUDIT=1 MAESTRO_SKIP_BUN_INSTALL_SMOKE=1",
Expand Down Expand Up @@ -935,6 +942,10 @@ describe("ci workflow guardrails", () => {
{ encoding: "utf8" },
),
) as Workflow;
const releaseImpactFilter = readFileSync(
new URL("../../scripts/release-impact-filter.mjs", import.meta.url),
{ encoding: "utf8" },
);
const contextStep = action.runs?.steps?.find(
(step) => step.id === "context",
);
Expand All @@ -947,15 +958,17 @@ describe("ci workflow guardrails", () => {
expect(action.outputs).toHaveProperty("package_changed_since_tag");
expect(contextStep?.run).toContain('["rev-parse", "HEAD"]');
expect(contextStep?.run).toContain("^{commit}");
expect(contextStep?.run).toContain('"diff", "--name-only"');
expect(contextStep?.run).toContain('path.startsWith("src/")');
expect(contextStep?.run).toContain('path.startsWith("packages/")');
expect(contextStep?.run).toContain('path.startsWith("proto/")');
expect(contextStep?.run).toContain('path.startsWith("types/")');
expect(contextStep?.run).toContain('"tsconfig.base.json"');
expect(contextStep?.run).toContain('"scripts/codegen-utils.mjs"');
expect(contextStep?.run).toContain('"scripts/runtime-workspaces.mjs"');
expect(contextStep?.run).toContain('"scripts/workspace-utils.js"');
expect(contextStep?.run).toContain("scripts/release-impact-filter.mjs");
expect(contextStep?.run).toContain("packageChangedSinceReleaseTag");
expect(releaseImpactFilter).toContain('"diff", "--name-only"');
expect(releaseImpactFilter).toContain('path.startsWith("src/")');
expect(releaseImpactFilter).toContain('path.startsWith("packages/")');
expect(releaseImpactFilter).toContain('path.startsWith("proto/")');
expect(releaseImpactFilter).toContain('path.startsWith("types/")');
expect(releaseImpactFilter).toContain('"tsconfig.base.json"');
expect(releaseImpactFilter).toContain('"scripts/codegen-utils.mjs"');
expect(releaseImpactFilter).toContain('"scripts/runtime-workspaces.mjs"');
expect(releaseImpactFilter).toContain('"scripts/workspace-utils.js"');
expect(mismatchGuard?.if).toContain("steps.release.outputs.tag_exists");
expect(mismatchGuard?.if).toContain(
"steps.release.outputs.tag_matches_head != 'true'",
Expand Down Expand Up @@ -1905,6 +1918,7 @@ describe("planNxTestCommand", () => {
"scripts/deprecate-release.js",
"scripts/install-smoke-utils.js",
"scripts/plan-ci-checks.mjs",
"scripts/release-impact-filter.mjs",
"scripts/release-readiness.js",
"scripts/smoke-packed-cli.js",
"scripts/smoke-published-replay-e2e.js",
Expand All @@ -1924,12 +1938,16 @@ describe("planNxTestCommand", () => {
changedFiles: [
"scripts/install-smoke-utils.js",
"scripts/workspace-utils.js",
"test/scripts/release-impact-filter.test.ts",
"test/scripts/workspace-utils.test.ts",
],
headPackage: basePackage,
}),
).toEqual({
files: ["test/scripts/workspace-utils.test.ts"],
files: [
"test/scripts/release-impact-filter.test.ts",
"test/scripts/workspace-utils.test.ts",
],
mode: "affected-files",
});
});
Expand Down
Loading
Loading