ci: narrow native-host lane selection and reuse build caches (#2131)

* ci: narrow native-host lane selection and reuse build caches

Unowned src/ and bridge/ files no longer fall back to the full baseline.
They run the Linux suite plus the Linux x64 installed-package/Inspector
baseline. New apple and package scopes own the Apple artifact lane, the
package matrix and the Windows curated lane, including the test files those
lanes invoke. Manual-only verifier entrypoints run static checks and the
Linux suite. CHANGELOG, SECURITY, GitHub templates and the native Windows
README are documentation-only.

Pull requests omit the macOS x64 package host unless labelled ci:full.
The Windows and Apple lanes restore the shared Turbo build cache, the
Windows lane drops its duplicate typecheck, and the Linux suite uses six
shards. Main pushes keep the full baseline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: match package script entrypoints against scope globs

Script-only package.json edits resolved their entrypoint with literal
equality, so glob-owned verifiers such as scripts/verify/apple/** and
scripts/verify/inspector/** fell back to the full baseline instead of
selecting their owning lane.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-12 06:07:22 -07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 5190843f8f
commit 4f46eac453
5 changed files with 413 additions and 45 deletions
+43 -15
View File
@@ -1,19 +1,24 @@
import { execFileSync } from "node:child_process";
import { appendFileSync } from "node:fs";
import { matchesGlob } from "node:path";
import { SCOPES } from "./scopes.mjs";
import { MANUAL_VERIFIERS, SCOPES } from "./scopes.mjs";
const flags = [
"code",
"runtime",
"package",
"apple",
"fixtures",
"readiness",
"docs",
"workflows",
...Object.keys(SCOPES),
...new Set([
"code",
"runtime",
"package",
"apple",
"fixtures",
"readiness",
"docs",
"workflows",
...Object.keys(SCOPES),
]),
];
// Test files select the native-host lanes that run them explicitly. Provider
// scopes remain implementation-owned, so test-only edits stay off those lanes.
const NATIVE_TEST_OWNERS = ["apple", "package"];
// Actionlint validates workflow syntax only. The semantic suite asserts these
// workflows' release, publication and self-hosted runner safeguards.
const GUARDED_WORKFLOWS = new Set([
@@ -87,11 +92,11 @@ function classifyPackage(base, head) {
const scriptOwners =
simple &&
entries.every((entry) =>
Object.values(SCOPES).some((patterns) => patterns.includes(entry)),
Object.values(SCOPES).some((patterns) => matchesAny(entry, patterns)),
)
? Object.entries(SCOPES)
.filter(([, patterns]) =>
entries.some((entry) => patterns.includes(entry)),
entries.some((entry) => matchesAny(entry, patterns)),
)
.map(([owner]) => owner)
: [];
@@ -119,14 +124,23 @@ if (
.filter(Boolean);
for (const file of files) {
if (
/^(README(?:_[^/]+)?\.md|AGENTS\.md|CONTRIBUTING\.md)$/.test(file) ||
file.startsWith("docs/")
/^(README(?:_[^/]+)?\.md|AGENTS\.md|CONTRIBUTING\.md|CHANGELOG\.md|SECURITY\.md|native\/windows\/README\.md|\.github\/pull_request_template\.md)$/.test(
file,
) ||
file.startsWith("docs/") ||
file.startsWith(".github/ISSUE_TEMPLATE/")
) {
selected.docs = true;
selected.website ||= matchesAny(file, SCOPES.website);
continue;
}
if (/^(src|tests)\/.*\.(?:test|spec)\.[cm]?[jt]sx?$/.test(file)) {
selected.code = true;
for (const owner of NATIVE_TEST_OWNERS)
selected[owner] ||= matchesAny(file, SCOPES[owner]);
continue;
}
if (matchesAny(file, MANUAL_VERIFIERS)) {
selected.code = true;
continue;
}
@@ -166,6 +180,14 @@ if (
} else if (owners.length) {
if (file.startsWith("src/") || file.startsWith("bridge/"))
selected.runtime = true;
} else if (/^(src|bridge)\//.test(file)) {
// Unowned runtime sources keep the Linux x64 installed-package baseline;
// ci:full, main pushes and manual dispatch retain every native host.
selected.runtime = true;
reasons.push(`Unowned runtime source: ${file}`);
} else if (file.startsWith(".agents/skills/")) {
selected.runtime = true;
selected.docs = true;
} else {
full(`Unclassified input: ${file}`);
}
@@ -173,13 +195,19 @@ if (
} else throw new Error(`Unsupported CI event: ${event}`);
selected.runtime ||= selected.package;
const linux = { os: "ubuntu-latest", platform: "linux", architecture: "x64" };
// macOS x64 is the slowest package host. Pull requests run it only with ci:full;
// main pushes, schedules and manual dispatch always include it.
const intel =
event !== "pull_request" || process.env.CI_FULL === "true"
? [{ os: "macos-15-intel", platform: "darwin", architecture: "x64" }]
: [];
const matrix = {
include: selected.package
? [
linux,
{ os: "ubuntu-24.04-arm", platform: "linux", architecture: "arm64" },
{ os: "macos-15", platform: "darwin", architecture: "arm64" },
{ os: "macos-15-intel", platform: "darwin", architecture: "x64" },
...intel,
]
: [linux],
};
+104 -2
View File
@@ -1,6 +1,88 @@
// Ownership of the real-provider and website verification lanes. Shared build
// inputs are classified once in plan.mjs rather than repeated in every workflow.
// Ownership of the native-host, real-provider and website verification lanes.
// Shared build inputs are classified once in plan.mjs rather than repeated in
// every workflow.
export const SCOPES = {
// Apple artifact CLI/MCP lane on macOS, including its focused regressions.
apple: [
"src/native/Apple*",
"src/native/NativeMacOS*",
"src/native/NativeUi*",
"src/native/Lldb*",
"bridge/native/**",
"bridge/process/**",
"scripts/verify/apple/**",
"tests/boundary/filesystem/installScript.test.ts",
"tests/boundary/filesystem/nibNativeHierarchy.test.ts",
"tests/boundary/filesystem/interfaceBuilderBundle.test.ts",
"tests/boundary/cli/nativePlistCli.test.ts",
"tests/boundary/cli/nativePlistPrototypeKeyCli.test.ts",
"tests/boundary/cli/nativePlistSelectionFailureCli.test.ts",
"tests/boundary/cli/nativeDemangleCli.test.ts",
"tests/boundary/mcp/nativeDemangleMcp.test.ts",
"tests/boundary/providers/native/nativeSignatureTargetBinding.test.ts",
"tests/boundary/cli/nativeSignatureCli.test.ts",
"tests/boundary/mcp/nativeSignatureTargetBindingMcp.test.ts",
"src/process/capture/FilesystemSnapshot.test.ts",
"tests/boundary/process/darwinProcessRunTokenReader.test.ts",
"tests/boundary/process/directAnalysisSignals.test.ts",
"tests/boundary/process/processCaptureLifecycle.test.ts",
"tests/boundary/process/processCli.test.ts",
"tests/boundary/mcp/sessionMcp.test.ts",
],
// Four-host installed-package matrix and the Windows curated lane.
package: [
"src/windows/**",
"native/windows/**",
"src/inspector/**",
"scripts/verify/inspector/**",
"scripts/verify-package.mjs",
"scripts/verify-package-*",
"scripts/verify-windows-*.mjs",
"scripts/build-windows-native.mjs",
"scripts/windows-capabilities.mjs",
"scripts/prepack.mjs",
"scripts/prepare.mjs",
"scripts/rea.mjs",
"install.sh",
"src/config/**",
"src/application/Setup*.ts",
"src/application/Uninstall*.ts",
"src/cli/interactiveSetup.ts",
"src/cli/setupCommands.ts",
"tests/boundary/filesystem/binaryTarget.test.ts",
"tests/boundary/filesystem/safeOutputTree.test.ts",
"tests/boundary/providers/native/artifactProvider.archiveSafety.test.ts",
"tests/boundary/providers/native/artifactProvider.extractionCompleteness.test.ts",
"tests/boundary/filesystem/setupUnavailableProvider.test.ts",
"tests/boundary/filesystem/windowsNpxRegistration.test.ts",
"tests/boundary/filesystem/webScriptManifestPaths.test.ts",
"tests/boundary/process/ProcessEvidence.host.test.ts",
"tests/acceptance/webModuleCli.test.ts",
"tests/acceptance/webSourceLocationCli.test.ts",
"tests/boundary/cli/referenceSourceImportStatus.test.ts",
"tests/boundary/filesystem/asarInventoryFreshness.test.ts",
"tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts",
"tests/conformance/providers/ghidra/windowsCapabilities.test.ts",
"src/ghidra/GhidraInstallation.test.ts",
"tests/boundary/providers/ghidra/ghidraTransport.test.ts",
"tests/boundary/providers/ghidra/ghidraTargetSnapshot.test.ts",
"tests/boundary/providers/ghidra/ghidraLauncher.test.ts",
"tests/boundary/providers/hopper/hopperClient.cleanupRetry.test.ts",
"src/windows/WindowsNativeLoader.test.ts",
"src/windows/WindowsOwnedProcess.test.ts",
"src/ghidra/GhidraLauncherEnvironment.test.ts",
"src/process/ProcessOwnership.test.ts",
"src/process/ProcessOwnership.part2.test.ts",
"src/process/ProcessOwnership.part3.test.ts",
"src/process/ProcessOwnership.validation.test.ts",
"src/application/Update.test.ts",
"tests/process-global/updateMaintenance.test.ts",
"tests/conformance/providers/ghidra/realGhidraWindowsWorkflow.test.ts",
"tests/boundary/filesystem/directoryArtifactReaderOpen.test.ts",
"tests/boundary/filesystem/javascriptPackagePrecedence.test.ts",
"tests/boundary/filesystem/javascriptArtifactContentIdentity.test.ts",
"tests/boundary/process/sourceMapUncHosts.test.ts",
],
browser: [
".github/workflows/real-browser.yml",
"scripts/verify-real-browser.mjs",
@@ -227,3 +309,23 @@ export const SCOPES = {
".github/workflows/website-pages.yml",
],
};
// Verifier entrypoints that only manual, licensed, or self-hosted workflows
// run. No selected CI lane executes them, so their edits need only the static
// checks and the source-test suite. Shared helpers under scripts/lib remain
// broad inputs.
export const MANUAL_VERIFIERS = [
"scripts/verify-real-electron.mjs",
"scripts/verify-real-ghidra*.mjs",
"scripts/verify-real-hopper*.mjs",
"scripts/verify-real-ida.mjs",
"scripts/verify-*-client.mjs",
"scripts/verify-native-agent-client.mjs",
"scripts/verify-jeb.mjs",
"scripts/verify-apktool.mjs",
"scripts/verify-adb.mjs",
"scripts/verify-agent-experience.mjs",
"scripts/verify-packaged-ghidra-windows.mjs",
"scripts/verify-wasm-artifact.mjs",
"scripts/verify-packaged-wasm-artifact.mjs",
];