Skip to content

Add BenchmarkDotNet support to Library template#318

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/redo-pull-292
Draft

Add BenchmarkDotNet support to Library template#318
Copilot wants to merge 3 commits intomasterfrom
copilot/redo-pull-292

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Adds BenchmarkDotNet infrastructure to the Library template and a GitHub Actions workflow to track benchmark results over time via github-action-benchmark.

Template changes

  • benchmarks/MyLib.Benchmarks/ — new project (targeting net10.0) with sample benchmarks against the library's public API and a Program.fs entry point
  • MyLib.slnx — benchmarks project added under a /benchmarks/ solution folder
  • Directory.Packages.propsBenchmarkDotNet 0.14.0 added
  • .gitignoreBenchmarkDotNet.Artifacts/ excluded

Build system

  • New RunBenchmarks FAKE target runs dotnet run --configuration Release across all benchmarks/**/*.??proj
  • Depends on DotnetBuild; invocable standalone via ./build.sh RunBenchmarks

CI workflow (.github/workflows/benchmark.yml)

Runs on push to the release branch only, executes RunBenchmarks, then stores JSON results in docs/benchmarks/ on the release branch via github-action-benchmark. Configured with gh-pages-branch: MyReleaseBranch and benchmark-data-dir-path: docs/benchmarks since the project uses the docs/ folder (not a separate gh-pages branch) for GitHub Pages. Includes regression alerting at 200% threshold.

Docs

  • README.md documents the RunBenchmarks target alongside other build targets
  • docsSrc/index.md includes a "Benchmarks" card linking to the benchmark results page (benchmarks/index.html)

Tests

Integration tests for library projects (MyCoolLib, fsharp-data-sample) assert the benchmark files are generated and that RunBenchmarks builds successfully. Non-library project tests are unaffected.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: TheAngryByrd <1490044+TheAngryByrd@users.noreply.github.com>
Copilot AI changed the title [WIP] Redo changes from pull request 292 Add BenchmarkDotNet support to Library template Feb 28, 2026
@TheAngryByrd
Copy link
Owner

@copilot as per https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#gh-pages-branch-required, since we use the docs/ folder in the repo, we need to set gh-pages-branch to the default-branch and benchmark-data-dir-path. We should then create a link in the docs/ to that benchmark result.

…nchmarks link

Co-authored-by: TheAngryByrd <1490044+TheAngryByrd@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 28, 2026

@copilot as per https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#gh-pages-branch-required, since we use the docs/ folder in the repo, we need to set `...

Done in commit 1be20d8. The benchmark workflow now sets gh-pages-branch: MyReleaseBranch and benchmark-data-dir-path: docs/benchmarks so results are stored in the docs/ folder alongside the FSDocs-generated site. The workflow also only runs on push (not pull_request) with permissions: contents: write for the auto-push. A "Benchmarks" card linking to benchmarks/index.html was added to docsSrc/index.md.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants