生成项目发布 readiness gate artifact

This commit is contained in:
2026-06-16 09:17:37 +08:00
parent ae3adf2d13
commit f4f4b3c744
9 changed files with 181 additions and 5 deletions

View File

@@ -15,4 +15,7 @@ SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 "$ROOT_DIR/tests/browser/verify_ini_panel_b
"$ROOT_DIR/tests/ui/node/verify_ui_node_smokes.sh"
"$ROOT_DIR/tests/host/verify_host_smokes.sh"
node "$ROOT_DIR/tests/host/write_project_release_readiness_artifact.mjs"
"$ROOT_DIR/tests/host/verify_project_release_readiness_artifact.sh"
echo "project_release_gate=ok"

View File

@@ -0,0 +1,35 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, "../..");
const artifactPath = process.argv[2] ?? resolve(root, "build/project-release-readiness.json");
const artifact = JSON.parse(readFileSync(artifactPath, "utf8"));
assert.equal(artifact.apiName, "project-release-readiness-report");
assert.equal(artifact.reportVersion, 1);
assert.equal(artifact.phase, "ready");
assert.equal(artifact.ready, true);
assert.deepEqual(artifact.missing, []);
assert.equal(artifact.releaseGate.command, "wasm-port/tests/host/verify_project_release_gate.sh");
assert.equal(artifact.releaseGate.passed, true);
assert.equal(artifact.releaseGate.expectedOutput, "project_release_gate=ok");
assert.equal(artifact.simConfigInventory.executed, 28);
assert.equal(artifact.simConfigInventory.passed, 28);
assert.equal(artifact.simConfigInventory.skipped, 131);
assert.equal(artifact.simConfigInventory.unexpectedFail, 0);
assert.deepEqual(artifact.blockedRuntimeFamilies, [
"L4-USER-M-PROCESS",
"L4-TOOL-DB",
"L4-PYTHON-REMAP",
]);
assert.deepEqual(artifact.promotedBlockedFamilies, []);
assert.equal(artifact.gates.every(({ passed }) => passed === true), true);
assert.equal(
artifact.rows.find(({ id }) => id === "project-release-gate")?.value,
"passed",
);
console.log("project_release_readiness_artifact_node_smoke=ok");

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
node "$ROOT_DIR/tests/host/verify_project_release_readiness_artifact.mjs" "$@"

View File

@@ -0,0 +1,41 @@
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { createProjectReleaseReadinessReport } from "../../runtime/sdk/src/index.js";
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, "../..");
const outputPath = process.argv[2] ?? resolve(root, "build/project-release-readiness.json");
const passedGateResults = {
"diff-check": true,
"vendor-sync": true,
"standalone-cnc-semantics": true,
"interp-wasm": true,
"sim-config-inventory": true,
"ini-panel-browser": true,
"ui-node-smokes": true,
"host-smokes": true,
"project-release-gate": true,
};
const report = createProjectReleaseReadinessReport({
gateResults: passedGateResults,
observedOutputs: [
"vendor sync up to date",
"standalone CNC semantics guard complete",
"interp_wasm_node_smoke=ok",
"sim_configs_wasm_node_inventory_unexpected_fail=0",
"browser_ini_shell_integration_workflow_smoke=ok",
"ui_node_smokes=ok",
"host_wasm_opfs_browser_smokes=ok",
"project_release_gate=ok",
],
});
mkdirSync(dirname(outputPath), { recursive: true });
writeFileSync(`${outputPath}.tmp`, `${JSON.stringify(report, null, 2)}\n`);
renameSync(`${outputPath}.tmp`, outputPath);
console.log(`project_release_readiness_artifact=${outputPath}`);