Skip to content

Commit f5f76bd

Browse files
committed
handle multiple benchmark files
1 parent 884569e commit f5f76bd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/benchmarks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ jobs:
6767
echo "## 🚀 Benchmark Summary" > benchmark_summary.md
6868
echo '| Method | Mean | Error | StdDev |' >> benchmark_summary.md
6969
echo '|--------|------|-------|--------|' >> benchmark_summary.md
70+
7071
for file in BenchmarkDotNet.Artifacts/results/*.json; do
7172
jq -r '.Benchmarks[] | "| \(.Method) | \(.Mean.Nanoseconds) ns | ±\(.StandardError.Nanoseconds) ns | \(.StandardDeviation.Nanoseconds) ns |"' "$file" >> benchmark_summary.md
7273
done
74+
7375
cat benchmark_summary.md >> $GITHUB_STEP_SUMMARY
7476
7577
# Upload benchmark results as artifact

Benchmarks/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using BenchmarkDotNet.Configs;
22
using BenchmarkDotNet.Exporters.Json;
3+
using BenchmarkDotNet.Reports;
34
using BenchmarkDotNet.Running;
45

56
namespace Benchmarks
@@ -8,9 +9,11 @@ internal class Program
89
{
910
static void Main(string[] args)
1011
{
11-
var config = DefaultConfig.Instance.AddExporter(JsonExporter.Brief);
12+
ManualConfig config = DefaultConfig.Instance.AddExporter(JsonExporter.Brief);
1213

13-
var results = BenchmarkRunner.Run<DivisionBenchmarks>(config);
14+
IEnumerable<Summary> summaries = BenchmarkSwitcher
15+
.FromAssembly(typeof(Program).Assembly)
16+
.Run(args, config);
1417
}
1518
}
1619
}

0 commit comments

Comments
 (0)