test(ci): add plugin prerelease suite to CI (#73741)

* test(ci): route plugin prerelease coverage to plugin shard

* test(ci): add plugin prerelease suite to CI

* fix(ci): preserve pnpm path in plugin prerelease shard

* fix(ci): avoid inheriting secrets for plugin prerelease suite
This commit is contained in:
Vincent Koc
2026-04-28 14:52:03 -07:00
committed by GitHub
parent 69fb7455c6
commit e7947948b6
8 changed files with 498 additions and 2 deletions

View File

@@ -1,7 +1,21 @@
import { existsSync, readdirSync } from "node:fs";
import { join } from "node:path";
import { join, relative, resolve } from "node:path";
import fg from "fast-glob";
import { describe, expect, it } from "vitest";
import { createNodeTestShards } from "../../scripts/lib/ci-node-test-plan.mjs";
import { createPluginsVitestConfig } from "../vitest/vitest.plugins.config.ts";
type VitestTestConfig = {
dir?: string;
exclude?: string[];
include?: string[];
};
type VitestConfig = {
test?: VitestTestConfig;
};
const PLUGIN_PRERELEASE_NPM_SPEC_TEST = "src/plugins/install.npm-spec.test.ts";
function listTestFiles(rootDir: string): string[] {
if (!existsSync(rootDir)) {
@@ -24,6 +38,20 @@ function listTestFiles(rootDir: string): string[] {
return files.toSorted((a, b) => a.localeCompare(b));
}
function listMatchedTestFiles(config: VitestConfig): string[] {
const testConfig = config.test ?? {};
const cwd = testConfig.dir ? resolve(testConfig.dir) : process.cwd();
return fg
.sync(testConfig.include ?? [], {
absolute: false,
cwd,
dot: false,
ignore: testConfig.exclude ?? [],
})
.map((file) => relative(process.cwd(), resolve(cwd, file)).replaceAll("\\", "/"))
.toSorted((a, b) => a.localeCompare(b));
}
describe("scripts/lib/ci-node-test-plan.mjs", () => {
it("combines the small core unit shards to reduce CI runner fanout", () => {
const coreUnitShards = createNodeTestShards()
@@ -155,7 +183,6 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
configs: ["test/vitest/vitest.gateway-server.config.ts"],
runner: "blacksmith-4vcpu-ubuntu-2404",
requiresDist: false,
runner: "blacksmith-4vcpu-ubuntu-2404",
});
expect(commandsShard).toEqual({
checkName: "checks-node-agentic-commands",
@@ -199,6 +226,22 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
});
});
it("keeps plugin prerelease npm install coverage on the agentic plugin CI shard", () => {
const pluginsShard = createNodeTestShards().find(
(shard) => shard.shardName === "agentic-plugins",
);
expect(pluginsShard).toMatchObject({
checkName: "checks-node-agentic-plugins",
configs: ["test/vitest/vitest.plugins.config.ts"],
requiresDist: false,
shardName: "agentic-plugins",
});
expect(listMatchedTestFiles(createPluginsVitestConfig({}))).toContain(
PLUGIN_PRERELEASE_NPM_SPEC_TEST,
);
});
it("splits auto-reply into balanced core/top-level and reply subtree shards", () => {
const shards = createNodeTestShards();
const autoReplyShards = shards