14 lines
1.6 KiB
JavaScript
14 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
import crypto from "node:crypto";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
|
|
const docsRoot = path.join(root, "docs");
|
|
const artifacts = { C: "p6/bim-action-03-kernel.json", D: "p6/bim-action-03-recovery.json", E: "p6/bim-action-03-facade.json", F: "p6/bim-action-03-chrome.json", G: "p6/bim-action-03-persistence.json" };
|
|
const reports = Object.fromEntries(Object.entries(artifacts).map(([step, file]) => { const report = JSON.parse(fs.readFileSync(path.join(docsRoot, file), "utf8")); return [step, { result: report.result, artifact: `docs/${file}`, sha256: crypto.createHash("sha256").update(fs.readFileSync(path.join(docsRoot, file))).digest("hex") }]; }));
|
|
const kernel = JSON.parse(fs.readFileSync(path.join(docsRoot, "p6/bim-action-03-kernel.json"), "utf8"));
|
|
const report = { schema: "freecad-web-p6-bim-action-03-summary/v1", result: Object.values(reports).every((item) => item.result === "pass") ? "pass" : "fail", action: "python-api", sourceRevision: kernel.fixture.sourceRevision, contracts: reports, coverage: { sourceEntry: kernel.fixture.entry, apiCount: kernel.replay.success.result.apiCount, kindCounts: kernel.replay.success.result.kindCounts, readOnly: true }, moduleStatus: "pending_until_action_gate" };
|
|
fs.writeFileSync(path.join(docsRoot, "p6/bim-action-03-python-api.json"), `${JSON.stringify(report, null, 2)}\n`);
|
|
console.log(JSON.stringify({ result: report.result, contracts: Object.keys(reports).length, artifact: "docs/p6/bim-action-03-python-api.json" }));
|