
























@@ -19,6 +19,14 @@ function readRealBehaviorProofWorkflow() {
1919return parse(readFileSync(".github/workflows/real-behavior-proof.yml", "utf8"));
2020}
212122+function readMaturityScorecardWorkflow() {
23+return parse(readFileSync(".github/workflows/maturity-scorecard.yml", "utf8"));
24+}
25+26+function readQaProfileEvidenceWorkflow() {
27+return parse(readFileSync(".github/workflows/qa-profile-evidence.yml", "utf8"));
28+}
29+2230function readCriticalQualityWorkflow() {
2331return readFileSync(".github/workflows/codeql-critical-quality.yml", "utf8");
2432}
@@ -563,6 +571,75 @@ describe("ci workflow guards", () => {
563571});
564572});
565573574+it("keeps maturity scorecard generated QA evidence handoff strict", () => {
575+const maturityWorkflow = readMaturityScorecardWorkflow();
576+const qaEvidenceWorkflow = readQaProfileEvidenceWorkflow();
577+const generateJob = maturityWorkflow.jobs.generate_qa_evidence;
578+const publishJob = maturityWorkflow.jobs.publish;
579+const qaRunJob = qaEvidenceWorkflow.jobs.run_qa_profile;
580+581+expect(qaEvidenceWorkflow.on.workflow_dispatch.inputs.fail_on_qa_failure).toEqual({
582+description: "Fail the workflow when the QA profile command exits non-zero",
583+required: false,
584+default: true,
585+type: "boolean",
586+});
587+expect(qaEvidenceWorkflow.on.workflow_call.inputs.fail_on_qa_failure).toMatchObject({
588+default: false,
589+type: "boolean",
590+});
591+expect(generateJob.if).toBe("${{ inputs.qa_evidence_run_id == '' }}");
592+expect(generateJob.uses).toBe("./.github/workflows/qa-profile-evidence.yml");
593+expect(generateJob.with).toMatchObject({
594+ref: "${{ needs.validate_selected_ref.outputs.selected_revision }}",
595+qa_profile: "release",
596+fail_on_qa_failure: false,
597+});
598+599+const generatedDownloadStep = publishJob.steps.find(
600+(step) => step.name === "Download generated QA evidence artifact",
601+);
602+expect(generatedDownloadStep.if).toBe("${{ inputs.qa_evidence_run_id == '' }}");
603+expect(generatedDownloadStep.env.GENERATED_ARTIFACT_NAME).toBe(
604+"${{ needs.generate_qa_evidence.outputs.artifact_name }}",
605+);
606+expect(generatedDownloadStep.run).toContain('gh run download "$GITHUB_RUN_ID"');
607+expect(generatedDownloadStep.run).toContain('--name "$GENERATED_ARTIFACT_NAME"');
608+expect(generatedDownloadStep.run).not.toContain("--pattern");
609+610+const requireEvidenceStep = publishJob.steps.find(
611+(step) => step.name === "Require one QA evidence file",
612+);
613+expect(requireEvidenceStep.run).toContain("Expected exactly one qa-evidence.json file");
614+615+const validateManifestStep = publishJob.steps.find(
616+(step) => step.name === "Validate QA evidence manifest",
617+);
618+expect(validateManifestStep.run).toContain("qa-profile-evidence-manifest.json");
619+expect(validateManifestStep.run).toContain("manifest.targetSha !== targetSha");
620+621+expect(qaRunJob.outputs.artifact_name).toBe("${{ steps.evidence.outputs.artifact_name }}");
622+const qaEvidenceStep = qaRunJob.steps.find(
623+(step) => step.name === "Validate QA profile evidence",
624+);
625+expect(qaEvidenceStep.env.ARTIFACT_NAME).toBe(
626+"qa-profile-evidence-${{ steps.profile.outputs.profile }}-${{ needs.validate_selected_ref.outputs.selected_revision }}",
627+);
628+expect(qaEvidenceStep.run).toContain("qa-profile-evidence-manifest.json");
629+630+const qaUploadStep = qaRunJob.steps.find((step) => step.name === "Upload QA profile evidence");
631+expect(qaUploadStep.with).toMatchObject({
632+name: "qa-profile-evidence-${{ steps.profile.outputs.profile }}-${{ needs.validate_selected_ref.outputs.selected_revision }}",
633+path: "${{ steps.run_profile.outputs.output_dir }}",
634+"if-no-files-found": "error",
635+});
636+637+const qaFailStep = qaRunJob.steps.find(
638+(step) => step.name === "Fail if configured QA gate failed",
639+);
640+expect(qaFailStep.if).toBe("always() && inputs.fail_on_qa_failure");
641+});
642+566643it("keeps workflow guards in fast CI-routing checks", () => {
567644const workflow = readCiWorkflow();
568645const fastCoreJob = workflow.jobs["checks-fast-core"];
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。