pub fn render_markdown(compare: &CompareReceipt) -> StringExpand description
Render a CompareReceipt as a Markdown table for PR comments.
let compare = CompareReceipt {
schema: COMPARE_SCHEMA_V1.to_string(),
tool: ToolInfo { name: "perfgate".into(), version: "0.1.0".into() },
bench: BenchMeta {
name: "my-bench".into(), cwd: None,
command: vec!["echo".into()], repeat: 3, warmup: 0,
work_units: None, timeout_ms: None,
},
baseline_ref: CompareRef { path: None, run_id: None },
current_ref: CompareRef { path: None, run_id: None },
budgets: BTreeMap::from([(Metric::WallMs, Budget {
threshold: 0.20, warn_threshold: 0.18, direction: Direction::Lower,
})]),
deltas: BTreeMap::from([(Metric::WallMs, Delta {
baseline: 100.0, current: 110.0, ratio: 1.1, pct: 0.1,
regression: 0.1, statistic: MetricStatistic::Median,
significance: None, status: MetricStatus::Pass,
})]),
verdict: Verdict {
status: VerdictStatus::Pass,
counts: VerdictCounts { pass: 1, warn: 0, fail: 0 },
reasons: vec![],
},
};
let md = perfgate_render::render_markdown(&compare);
assert!(md.contains("✅ perfgate: pass"));
assert!(md.contains("wall_ms"));