diff --git a/.github/scripts/bench-history-summary.sh b/.github/scripts/bench-history-summary.sh new file mode 100755 index 0000000..3dff3a1 --- /dev/null +++ b/.github/scripts/bench-history-summary.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +# bench-history-summary.sh — emits the markdown body of the release-bench +# step summary (see `.github/workflows/bench.yml`). One big table per event +# shape (source-update, self-heal, ns-flip), keyed by profile, with one row +# per profile whether or not it actually exercised that shape (em-dash for +# missing). +# +# Args: +# $1: path to bench.json — a JSON array of per-profile reports (from +# `jq -s` over the harness's stdout). +# $2: label string used in the run header and the bench-history link. +# +# Output: markdown to stdout. +# +# Notes: +# - The script reads bench.json once into a single jq pass per metric. This +# avoids the O(profiles * metrics) re-reads that would happen with +# per-row jq invocations. +# - LC_ALL=C pins printf's number formatting so "1.5ms" doesn't render as +# "1,5ms" on a comma-decimal locale (lesson from bench-comment.sh). +# - Em-dash represents missing/zero values uniformly: a profile that +# doesn't exercise a shape, or a shape that recorded zero samples. + +set -euo pipefail +export LC_ALL=C + +if [ "$#" -lt 2 ]; then + echo "usage: $0