mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
CI: cover skill and extension tests
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user