Skip to content

benchmark workflow: render a pretty summary in the GitHub Actions job summary #50

Description

@matthewdevenny

Problem

The benchmark workflow (.github/workflows/benchmark.yml, added in #47) runs the serialized-size report and the BenchmarkDotNet timings, but results only land in the raw job log:

- name: Serialized size report
  run: dotnet run -c Release --project util/Benchmarks -f net10.0 -- --sizes
- name: Benchmarks (net10.0)
  run: dotnet run -c Release --project util/Benchmarks -f net10.0 -- --filter "${FILTER:-*}"
- name: Benchmarks (net8.0)
  run: dotnet run -c Release --project util/Benchmarks -f net8.0 -- --filter "${FILTER:-*}"

To read the numbers you have to open the log and scroll. Since this is a manual, on-demand workflow whose entire purpose is to eyeball results, they should render as formatted markdown tables on the run's Summary page ($GITHUB_STEP_SUMMARY).

Proposal

Write the results to $GITHUB_STEP_SUMMARY as GitHub-flavored markdown:

  • BenchmarkDotNet timings — BenchmarkDotNet already emits a GitHub-markdown artifact per run at BenchmarkDotNet.Artifacts/results/*-report-github.md (or force it with --exporters github). After each run step, append those files to the summary, e.g.:
    {
      echo "### Benchmarks (net10.0)"
      cat BenchmarkDotNet.Artifacts/results/*-report-github.md
    } >> "$GITHUB_STEP_SUMMARY"
    Tag each net10.0 / net8.0 section with a heading so both TFMs are distinguishable, and clear/segregate the artifacts dir between the two runs so they don't clobber or double-append.
  • Serialized-size report — SizeReport.Print() currently writes a fixed-width plaintext table to the console. Either (a) add a markdown-table output mode (e.g. --sizes --md) that the workflow redirects into the summary, or (b) wrap the existing output in a fenced code block when appending. Option (a) is nicer since the size/ratio table is the headline result.

Acceptance criteria

  • After a benchmark run, the GitHub Actions Summary page shows the size-comparison table and the net10.0 + net8.0 BenchmarkDotNet tables as rendered markdown, without opening the raw log.
  • net8.0 and net10.0 results are clearly labeled and not intermixed.
  • Raw-log output is preserved (the summary is additive, not a replacement).

Notes

No new dependencies needed — BenchmarkDotNet ships the GitHub markdown exporter. Keep the FILTER env-var indirection (shell-injection guard) intact when touching the run steps.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions