新增发布 readiness artifact SDK 校验 workflow
This commit is contained in:
@@ -47,6 +47,7 @@ import {
|
||||
createMachineSessionPersistenceRenderState,
|
||||
createMachineSessionPersistenceSummary,
|
||||
createMachineSessionSnapshotPayload,
|
||||
createProjectReleaseReadinessArtifactValidation,
|
||||
createProjectReleaseReadinessReport,
|
||||
createSessionSnapshot,
|
||||
defaultMachinePaths,
|
||||
@@ -69,6 +70,7 @@ import {
|
||||
mountIniPanelShellWorkflowOverviewEmbeddingMountState,
|
||||
normalizeOpfsPath,
|
||||
parameterFilePath,
|
||||
parseProjectReleaseReadinessArtifactJson,
|
||||
planIniFileContextStaging,
|
||||
planSimConfigStaging,
|
||||
readMachineSessionReadiness,
|
||||
@@ -194,7 +196,10 @@ and `../PROJECT_COMPLETION_TRACKER.md`.
|
||||
The executable release gate uses the same helper to write
|
||||
`build/project-release-readiness.json` after all project checks pass, then
|
||||
validates that artifact with
|
||||
`tests/host/verify_project_release_readiness_artifact.sh`.
|
||||
`tests/host/verify_project_release_readiness_artifact.sh`. External tools can
|
||||
load that JSON with `parseProjectReleaseReadinessArtifactJson()` and validate
|
||||
it with `createProjectReleaseReadinessArtifactValidation()` without copying the
|
||||
host test assertions.
|
||||
|
||||
## OPFS/session persistence exports
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export { createLinuxCncIniSdk } from "./linuxcnc-ini.js";
|
||||
export { createLinuxCncInterpSdk } from "./linuxcnc-interp.js";
|
||||
export { createProjectReleaseReadinessReport } from "./project-release-readiness.js";
|
||||
export {
|
||||
createProjectReleaseReadinessArtifactValidation,
|
||||
createProjectReleaseReadinessReport,
|
||||
parseProjectReleaseReadinessArtifactJson,
|
||||
} from "./project-release-readiness.js";
|
||||
export {
|
||||
analyzeIniRuntimeBoundaries,
|
||||
planIniFileContextStaging,
|
||||
|
||||
@@ -67,6 +67,9 @@ const BLOCKED_RUNTIME_FAMILIES = [
|
||||
"L4-PYTHON-REMAP",
|
||||
];
|
||||
|
||||
const PROJECT_RELEASE_READINESS_ARTIFACT_API = "project-release-readiness-report";
|
||||
const PROJECT_RELEASE_READINESS_ARTIFACT_VERSION = 1;
|
||||
|
||||
function outputContains(observedOutputs, expectedOutput) {
|
||||
return observedOutputs.some((output) => String(output).includes(expectedOutput));
|
||||
}
|
||||
@@ -81,6 +84,14 @@ function readGatePassed({ gate, gateResults, observedOutputs }) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function objectOrEmpty(value) {
|
||||
return value && typeof value === "object" ? value : {};
|
||||
}
|
||||
|
||||
function arrayOrEmpty(value) {
|
||||
return Array.isArray(value) ? value : [];
|
||||
}
|
||||
|
||||
export function createProjectReleaseReadinessReport({
|
||||
gateResults = {},
|
||||
observedOutputs = [],
|
||||
@@ -118,8 +129,8 @@ export function createProjectReleaseReadinessReport({
|
||||
];
|
||||
|
||||
return {
|
||||
apiName: "project-release-readiness-report",
|
||||
reportVersion: 1,
|
||||
apiName: PROJECT_RELEASE_READINESS_ARTIFACT_API,
|
||||
reportVersion: PROJECT_RELEASE_READINESS_ARTIFACT_VERSION,
|
||||
phase: ready ? "ready" : "waiting",
|
||||
ready,
|
||||
missing,
|
||||
@@ -152,3 +163,69 @@ export function createProjectReleaseReadinessReport({
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function parseProjectReleaseReadinessArtifactJson(text) {
|
||||
return JSON.parse(String(text));
|
||||
}
|
||||
|
||||
export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
|
||||
const artifactObject = objectOrEmpty(artifact);
|
||||
const releaseGate = objectOrEmpty(artifactObject.releaseGate);
|
||||
const simConfigInventory = objectOrEmpty(artifactObject.simConfigInventory);
|
||||
const gates = arrayOrEmpty(artifactObject.gates);
|
||||
const rows = arrayOrEmpty(artifactObject.rows);
|
||||
const gateCountReady = gates.length === REQUIRED_RELEASE_GATES.length;
|
||||
const gatesPassed = gateCountReady && gates.every(({ passed }) => passed === true);
|
||||
const missing = [
|
||||
...(artifactObject.apiName === PROJECT_RELEASE_READINESS_ARTIFACT_API ? [] : ["apiName"]),
|
||||
...(artifactObject.reportVersion === PROJECT_RELEASE_READINESS_ARTIFACT_VERSION ? [] : ["reportVersion"]),
|
||||
...(artifactObject.phase === "ready" ? [] : ["phase"]),
|
||||
...(artifactObject.ready === true ? [] : ["ready"]),
|
||||
...(Array.isArray(artifactObject.missing) && artifactObject.missing.length === 0 ? [] : ["missing"]),
|
||||
...(releaseGate.command === "wasm-port/tests/host/verify_project_release_gate.sh" ? [] : ["releaseGate.command"]),
|
||||
...(releaseGate.passed === true ? [] : ["releaseGate.passed"]),
|
||||
...(releaseGate.expectedOutput === "project_release_gate=ok" ? [] : ["releaseGate.expectedOutput"]),
|
||||
...(simConfigInventory.executed === 28 ? [] : ["simConfigInventory.executed"]),
|
||||
...(simConfigInventory.passed === 28 ? [] : ["simConfigInventory.passed"]),
|
||||
...(simConfigInventory.skipped === 131 ? [] : ["simConfigInventory.skipped"]),
|
||||
...(simConfigInventory.unexpectedFail === 0 ? [] : ["simConfigInventory.unexpectedFail"]),
|
||||
...(arrayOrEmpty(artifactObject.blockedRuntimeFamilies).join(",") === BLOCKED_RUNTIME_FAMILIES.join(",")
|
||||
? []
|
||||
: ["blockedRuntimeFamilies"]),
|
||||
...(arrayOrEmpty(artifactObject.promotedBlockedFamilies).length === 0 ? [] : ["promotedBlockedFamilies"]),
|
||||
...(gateCountReady ? [] : ["gates.length"]),
|
||||
...(gatesPassed ? [] : ["gates.passed"]),
|
||||
...(rows.find(({ id, value }) => id === "project-release-gate" && value === "passed")
|
||||
? []
|
||||
: ["rows.project-release-gate"]),
|
||||
];
|
||||
|
||||
return {
|
||||
apiName: "project-release-readiness-artifact-validation",
|
||||
validationVersion: 1,
|
||||
phase: missing.length === 0 ? "ready" : "blocked",
|
||||
ready: missing.length === 0,
|
||||
missing,
|
||||
artifactApiName: artifactObject.apiName ?? null,
|
||||
artifactVersion: artifactObject.reportVersion ?? null,
|
||||
gateCount: gates.length,
|
||||
blockedRuntimeFamilies: arrayOrEmpty(artifactObject.blockedRuntimeFamilies),
|
||||
rows: [
|
||||
{
|
||||
id: "artifact",
|
||||
label: "Readiness artifact",
|
||||
value: artifactObject.apiName ?? "missing",
|
||||
},
|
||||
{
|
||||
id: "project-release-gate",
|
||||
label: "Project release gate",
|
||||
value: releaseGate.passed === true ? "passed" : "missing",
|
||||
},
|
||||
{
|
||||
id: "validation",
|
||||
label: "Artifact validation",
|
||||
value: missing.length === 0 ? "ready" : missing.join(", "),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user