Add BenchmarkDotNet support to Library template#318
Conversation
Co-authored-by: TheAngryByrd <1490044+TheAngryByrd@users.noreply.github.com>
|
@copilot as per https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#gh-pages-branch-required, since we use the |
…nchmarks link Co-authored-by: TheAngryByrd <1490044+TheAngryByrd@users.noreply.github.com>
Done in commit 1be20d8. The benchmark workflow now sets |
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 (targetingnet10.0) with sample benchmarks against the library's public API and aProgram.fsentry pointMyLib.slnx— benchmarks project added under a/benchmarks/solution folderDirectory.Packages.props—BenchmarkDotNet 0.14.0added.gitignore—BenchmarkDotNet.Artifacts/excludedBuild system
RunBenchmarksFAKE target runsdotnet run --configuration Releaseacross allbenchmarks/**/*.??projDotnetBuild; invocable standalone via./build.sh RunBenchmarksCI workflow (
.github/workflows/benchmark.yml)Runs on push to the release branch only, executes
RunBenchmarks, then stores JSON results indocs/benchmarks/on the release branch viagithub-action-benchmark. Configured withgh-pages-branch: MyReleaseBranchandbenchmark-data-dir-path: docs/benchmarkssince the project uses thedocs/folder (not a separategh-pagesbranch) for GitHub Pages. Includes regression alerting at 200% threshold.Docs
README.mddocuments theRunBenchmarkstarget alongside other build targetsdocsSrc/index.mdincludes 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 thatRunBenchmarksbuilds successfully. Non-library project tests are unaffected.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.