Repository navigation
Add an optional BenchmarkDotNet project to the templates - #138
Merged
Merged
Conversation
Adds a --benchmarks template option that generates a MyPackage.Benchmarks project with an example benchmark and a RunBenchmarks build target. The target is never part of Default, because benchmarks are slow and their results are not reliable on shared CI agents. Closes #118 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves conflicts with the new Dependabot/Renovate option: the benchmarks modifier and symbol apply to all templates, the dependency updater ones only to the GitHub templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #118
What changed
All six templates now have a
--benchmarksoption (default:false):When it is on, the generated solution gets:
MyPackage.Benchmarksproject (net10.0, BenchmarkDotNet 0.15.8) with one example benchmark (string.JoinvsStringBuilder). The example does not useMyClass, because in source-only packages that class is not visible to other assemblies..editorconfigfor that project. BenchmarkDotNet needs public, non-sealed classes and instance methods, which the analyzers would otherwise report as errors.RunBenchmarksbuild target. It is never part ofDefault, because benchmarks are slow and their results are not reliable on shared CI agents. It always runs in Release, takes a--benchmark-filterparameter (default*) and writes results toArtifacts/Benchmarks.How it works
template.jsonhas a newbenchmarksbool symbol. When it is false, a source modifier leaves out theMyPackage.Benchmarksfolder.SpecialCustomOperationsturn on<!--#if (benchmarks) -->blocks in.slnxand.mdfiles.Build.csthe target is wrapped in//#if (benchmarks)instead of#if. This way the code still compiles when this repo's ownTestTemplateBuildbuilds the rendered templates.TestPackageInstallationtarget now also builds both OSS templates with--benchmarks true. I added:nqso Fallout does not put quotes around the template name plus options.Testing
TestPackageInstallationpasses for all six variants, including both--benchmarks trueruns.build.ps1 Packon the rendered Normal template passes: InspectCode, tests, PackageGuard (BenchmarkDotNet's dependencies pass the license check) and API checks.build.ps1 RunBenchmarkson a generated solution produced the markdown, CSV and HTML reports.Notes for reviewers
🤖 Generated with Claude Code