Files
Netcatty/scripts/github-workflow-build.test.cjs
T
2026-06-29 20:18:52 +08:00

56 lines
1.8 KiB
JavaScript

const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const buildWorkflow = fs.readFileSync(
path.join(__dirname, "..", ".github", "workflows", "build.yml"),
"utf8",
);
test("build workflow no longer installs removed legacy agent binaries", () => {
for (const stale of [
"@agentclientprotocol/claude-agent-acp",
"@agentclientprotocol/sdk",
"@zed-industries/codex-acp",
"codex-acp",
]) {
assert.equal(
buildWorkflow.includes(stale),
false,
`build workflow must not reference removed legacy package: ${stale}`,
);
}
});
test("build workflow uploads and releases Arch pacman artifacts", () => {
const releaseUploadPatterns = buildWorkflow.match(/release\/\*\.pacman/g) ?? [];
assert.equal(
releaseUploadPatterns.length,
3,
"mac/windows aggregate upload plus both Linux jobs must include release/*.pacman",
);
assert.ok(
buildWorkflow.includes("artifacts/*.pacman"),
"GitHub release file list must include downloaded pacman artifacts",
);
});
test("build workflow installs bsdtar for Arch pacman packaging", () => {
const installMentions = buildWorkflow.match(/libarchive-tools/g) ?? [];
assert.equal(
installMentions.length,
2,
"both Linux package jobs must install libarchive-tools for pacman metadata generation",
);
});
test("build workflow initializes MSVC before Windows packaging", () => {
const msvcStep = /name:\s*Set up MSVC developer command prompt[\s\S]*?if:\s*matrix\.name == 'windows'[\s\S]*?uses:\s*ilammy\/msvc-dev-cmd@v1[\s\S]*?arch:\s*x64/;
assert.match(
buildWorkflow,
msvcStep,
"Windows package builds must initialize the MSVC developer prompt so cl.exe is available for the Windows Hello helper",
);
});