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

@@ -39,6 +39,7 @@ jobs:
run_node: ${{ steps.scope.outputs.run_node }} run_node: ${{ steps.scope.outputs.run_node }}
run_macos: ${{ steps.scope.outputs.run_macos }} run_macos: ${{ steps.scope.outputs.run_macos }}
run_android: ${{ steps.scope.outputs.run_android }} run_android: ${{ steps.scope.outputs.run_android }}
run_skills_python: ${{ steps.scope.outputs.run_skills_python }}
run_windows: ${{ steps.scope.outputs.run_windows }} run_windows: ${{ steps.scope.outputs.run_windows }}
steps: steps:
- name: Checkout - name: Checkout
@@ -125,6 +126,9 @@ jobs:
- runtime: node - runtime: node
task: test task: test
command: pnpm canvas:a2ui:bundle && pnpm test command: pnpm canvas:a2ui:bundle && pnpm test
- runtime: node
task: extensions
command: pnpm test:extensions
- runtime: node - runtime: node
task: protocol task: protocol
command: pnpm protocol:check command: pnpm protocol:check
@@ -250,7 +254,7 @@ jobs:
skills-python: skills-python:
needs: [docs-scope, changed-scope] needs: [docs-scope, changed-scope]
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true') if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true' || needs.changed-scope.outputs.run_skills_python == 'true')
runs-on: blacksmith-16vcpu-ubuntu-2404 runs-on: blacksmith-16vcpu-ubuntu-2404
steps: steps:
- name: Checkout - name: Checkout

View File

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

View File

@@ -10,6 +10,7 @@ const { detectChangedScope, listChangedPaths } =
runMacos: boolean; runMacos: boolean;
runAndroid: boolean; runAndroid: boolean;
runWindows: boolean; runWindows: boolean;
runSkillsPython: boolean;
}; };
listChangedPaths: (base: string, head?: string) => string[]; listChangedPaths: (base: string, head?: string) => string[];
}; };
@@ -32,6 +33,7 @@ describe("detectChangedScope", () => {
runMacos: true, runMacos: true,
runAndroid: true, runAndroid: true,
runWindows: true, runWindows: true,
runSkillsPython: true,
}); });
}); });
@@ -41,6 +43,7 @@ describe("detectChangedScope", () => {
runMacos: false, runMacos: false,
runAndroid: false, runAndroid: false,
runWindows: false, runWindows: false,
runSkillsPython: false,
}); });
}); });
@@ -50,6 +53,7 @@ describe("detectChangedScope", () => {
runMacos: false, runMacos: false,
runAndroid: false, runAndroid: false,
runWindows: true, runWindows: true,
runSkillsPython: false,
}); });
}); });
@@ -59,12 +63,14 @@ describe("detectChangedScope", () => {
runMacos: true, runMacos: true,
runAndroid: false, runAndroid: false,
runWindows: false, runWindows: false,
runSkillsPython: false,
}); });
expect(detectChangedScope(["apps/shared/OpenClawKit/Sources/Foo.swift"])).toEqual({ expect(detectChangedScope(["apps/shared/OpenClawKit/Sources/Foo.swift"])).toEqual({
runNode: false, runNode: false,
runMacos: true, runMacos: true,
runAndroid: true, runAndroid: true,
runWindows: false, runWindows: false,
runSkillsPython: false,
}); });
}); });
@@ -75,6 +81,7 @@ describe("detectChangedScope", () => {
runMacos: false, runMacos: false,
runAndroid: false, runAndroid: false,
runWindows: false, runWindows: false,
runSkillsPython: false,
}, },
); );
}); });
@@ -85,6 +92,7 @@ describe("detectChangedScope", () => {
runMacos: false, runMacos: false,
runAndroid: false, runAndroid: false,
runWindows: false, runWindows: false,
runSkillsPython: false,
}); });
expect(detectChangedScope(["assets/icon.png"])).toEqual({ expect(detectChangedScope(["assets/icon.png"])).toEqual({
@@ -92,6 +100,7 @@ describe("detectChangedScope", () => {
runMacos: false, runMacos: false,
runAndroid: false, runAndroid: false,
runWindows: false, runWindows: false,
runSkillsPython: false,
}); });
}); });
@@ -101,6 +110,17 @@ describe("detectChangedScope", () => {
runMacos: false, runMacos: false,
runAndroid: false, runAndroid: false,
runWindows: false, runWindows: false,
runSkillsPython: false,
});
});
it("runs Python skill tests when skills change", () => {
expect(detectChangedScope(["skills/openai-image-gen/scripts/test_gen.py"])).toEqual({
runNode: true,
runMacos: false,
runAndroid: false,
runWindows: false,
runSkillsPython: true,
}); });
}); });