Skip to content

Commit 776af48

Browse files
Fail benchmarks if any errors
Fail the benchmarks if any errors are encountered during execution.
1 parent fb8d338 commit 776af48

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

benchmark.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,8 @@ if (-Not [string]::IsNullOrEmpty(${env:GITHUB_SHA})) {
9191
}
9292

9393
& $dotnet run --project $benchmarks --configuration "Release" -- $additionalArgs
94+
95+
if ($LASTEXITCODE -ne 0) {
96+
Write-Error "Benchmarks failed with exit code $LASTEXITCODE."
97+
exit $LASTEXITCODE
98+
}

perf/TodoApp.Benchmarks/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
}
2323
else
2424
{
25-
BenchmarkRunner.Run<OpenApiBenchmarks>(args: args);
25+
var summary = BenchmarkRunner.Run<OpenApiBenchmarks>(args: args);
26+
return summary.Reports.Any((p) => !p.Success) ? 1 : 0;
2627
}

0 commit comments

Comments
 (0)