CI: cover skill and extension tests

This commit is contained in:
Vincent Koc
2026-03-06 11:20:28 -05:00
parent 9aceb51379
commit 6a9deb21b8
3 changed files with 55 additions and 6 deletions

View File

@@ -1,9 +1,10 @@
import { execFileSync } from "node:child_process";
import { appendFileSync } from "node:fs";
/** @typedef {{ runNode: boolean; runMacos: boolean; runAndroid: boolean; runWindows: boolean }} ChangedScope */
/** @typedef {{ runNode: boolean; runMacos: boolean; runAndroid: boolean; runWindows: boolean; runSkillsPython: boolean }} ChangedScope */
const DOCS_PATH_RE = /^(docs\/|.*\.mdx?$)/;
const SKILLS_PYTHON_SCOPE_RE = /^skills\//;
const MACOS_PROTOCOL_GEN_RE =
/^(apps\/macos\/Sources\/OpenClawProtocol\/|apps\/shared\/OpenClawKit\/Sources\/OpenClawProtocol\/)/;
const MACOS_NATIVE_RE = /^(apps\/macos\/|apps\/ios\/|apps\/shared\/|Swabble\/)/;
@@ -21,13 +22,20 @@ const NATIVE_ONLY_RE =
*/
export function detectChangedScope(changedPaths) {
if (!Array.isArray(changedPaths) || changedPaths.length === 0) {
return { runNode: true, runMacos: true, runAndroid: true, runWindows: true };
return {
runNode: true,
runMacos: true,
runAndroid: true,
runWindows: true,
runSkillsPython: true,
};
}
let runNode = false;
let runMacos = false;
let runAndroid = false;
let runWindows = false;
let runSkillsPython = false;
let hasNonDocs = false;
let hasNonNativeNonDocs = false;
@@ -43,6 +51,10 @@ export function detectChangedScope(changedPaths) {
hasNonDocs = true;
if (SKILLS_PYTHON_SCOPE_RE.test(path)) {
runSkillsPython = true;
}
if (!MACOS_PROTOCOL_GEN_RE.test(path) && MACOS_NATIVE_RE.test(path)) {
runMacos = true;
}
@@ -68,7 +80,7 @@ export function detectChangedScope(changedPaths) {
runNode = true;
}
return { runNode, runMacos, runAndroid, runWindows };
return { runNode, runMacos, runAndroid, runWindows, runSkillsPython };
}
/**
@@ -102,6 +114,7 @@ export function writeGitHubOutput(scope, outputPath = process.env.GITHUB_OUTPUT)
appendFileSync(outputPath, `run_macos=${scope.runMacos}\n`, "utf8");
appendFileSync(outputPath, `run_android=${scope.runAndroid}\n`, "utf8");
appendFileSync(outputPath, `run_windows=${scope.runWindows}\n`, "utf8");
appendFileSync(outputPath, `run_skills_python=${scope.runSkillsPython}\n`, "utf8");
}
function isDirectRun() {
@@ -131,11 +144,23 @@ if (isDirectRun()) {
try {
const changedPaths = listChangedPaths(args.base, args.head);
if (changedPaths.length === 0) {
writeGitHubOutput({ runNode: true, runMacos: true, runAndroid: true, runWindows: true });
writeGitHubOutput({
runNode: true,
runMacos: true,
runAndroid: true,
runWindows: true,
runSkillsPython: true,
});
process.exit(0);
}
writeGitHubOutput(detectChangedScope(changedPaths));
} catch {
writeGitHubOutput({ runNode: true, runMacos: true, runAndroid: true, runWindows: true });
writeGitHubOutput({
runNode: true,
runMacos: true,
runAndroid: true,
runWindows: true,
runSkillsPython: true,
});
}
}