refactor: generate CI workflow from gate contracts
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
type HttpScenarioReceipt,
|
||||
} from "./lib/http-scenario-evidence.ts";
|
||||
import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts";
|
||||
import { testEvidenceReportSchema } from "./lib/test-evidence-artifact.ts";
|
||||
|
||||
const scenarioContributionSchema = z
|
||||
.object({
|
||||
@@ -40,24 +41,6 @@ const policySchema = z
|
||||
})
|
||||
.strict();
|
||||
|
||||
const reportSchema = z
|
||||
.object({
|
||||
schemaVersion: z.literal(2),
|
||||
sourceRoot: z.string().min(1),
|
||||
status: z.enum(["PASS", "FAIL"]),
|
||||
facts: z
|
||||
.object({
|
||||
scannedFiles: z.number().int().nonnegative(),
|
||||
visualBaselines: z.number().int().nonnegative(),
|
||||
sharedScenarios: z.number().int().nonnegative(),
|
||||
declaredScenarioExecutions: z.number().int().nonnegative(),
|
||||
executedScenarioExecutions: z.number().int().nonnegative(),
|
||||
})
|
||||
.strict(),
|
||||
failures: z.array(z.string()),
|
||||
})
|
||||
.strict();
|
||||
|
||||
function argumentValue(name: string, fallback: string): string {
|
||||
const index = process.argv.indexOf(name);
|
||||
return index >= 0 && process.argv[index + 1]
|
||||
@@ -455,7 +438,7 @@ const report = {
|
||||
await mkdir(path.dirname(artifactPath), { recursive: true });
|
||||
await writeValidatedJsonArtifact({
|
||||
path: artifactPath,
|
||||
schema: reportSchema,
|
||||
schema: testEvidenceReportSchema,
|
||||
value: report,
|
||||
});
|
||||
if (failures.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user