Files
Netcatty/scripts/github-workflow-build.test.cjs
T
陈大猫 b6cdd602f1 fix: build Linux x64 packages on Debian Buster for glibc 2.28 (#2063)
* fix: build Linux x64 packages on Debian Buster for glibc 2.28

Rebuild node-pty (and serialport) inside debian:buster so x64 releases
load on RHEL 8 / CentOS 8 / UOS / Deepin instead of requiring glibc 2.35
from ubuntu-22.04. Mirrors the arm64 containerized build pattern (#2062).

* fix: run Buster build-deps step with bash

Container jobs default to /bin/sh; dash does not support [[ so the
archive.debian.org rewrite would be skipped and apt-get update would fail.

* fix: disable apt Valid-Until for archived Buster mirrors

archive.debian.org security metadata for Buster is expired; without
Acquire::Check-Valid-Until false, apt-get update fails in the container.

* fix: install Python 3.11 for node-gyp on Buster x64 builds

Buster ships Python 3.7; node-gyp 12 uses walrus syntax and fails during
npm ci when rebuilding node-pty. Keep the glibc 2.28 container and supply
a modern interpreter via actions/setup-python.

* fix: install Python 3.11 via uv inside Buster x64 builds

actions/setup-python is not reliable on glibc 2.28 containers. Install a
manylinux CPython with uv so node-gyp 12 can rebuild node-pty during npm ci.
2026-07-09 19:35:11 +08:00

98 lines
3.2 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 verifies RPM artifacts for both Linux architectures", () => {
assert.ok(
buildWorkflow.includes("bash scripts/verify-linux-rpm-artifact.sh x86_64"),
"Linux x64 package job must verify the RPM artifact",
);
assert.ok(
buildWorkflow.includes("bash scripts/verify-linux-rpm-artifact.sh aarch64"),
"Linux arm64 package job must verify the RPM artifact",
);
});
test("build workflow builds Linux x64 native modules in a glibc 2.28 container", () => {
// Keep x64 packages loadable on RHEL 8 / UOS / Deepin (see #2062).
// Buster (2.28) is stricter than the prior ubuntu-22.04 host (2.35) and
// slightly older than the arm64 Bullseye container (2.31).
const x64Job = buildWorkflow.match(
/build-linux-x64:[\s\S]*?(?=\n build-linux-arm64:)/,
);
assert.ok(x64Job, "build-linux-x64 job must be present before build-linux-arm64");
assert.match(
x64Job[0],
/container:\s*\n\s*image:\s*debian:buster/,
"Linux x64 package job must build inside debian:buster for glibc 2.28",
);
assert.equal(
x64Job[0].includes("ubuntu-22.04"),
false,
"Linux x64 package job must not build on the host ubuntu-22.04 glibc",
);
assert.equal(
x64Job[0].includes("actions/setup-node@"),
false,
"Linux x64 package job must install Node inside the container like arm64",
);
assert.match(
x64Job[0],
/name:\s*Install build dependencies[\s\S]*?\n\s+shell:\s*bash\n\s+run:/,
"Linux x64 install step must use bash so archive-mirror rewrite works under Buster",
);
assert.match(
x64Job[0],
/uv python install 3\.11/,
"Linux x64 job must install Python >=3.8 for node-gyp 12 on Buster",
);
assert.equal(
x64Job[0].includes("actions/setup-python@"),
false,
"Linux x64 job must not rely on actions/setup-python inside Buster",
);
});