Skip to content

Commit 035a555

Browse files
Fail benchmarks if any errors (#384)
Fail the benchmarks if any errors are encountered during execution.
1 parent fb8d338 commit 035a555

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
{
2020
await benchmarks.StopServer();
2121
}
22+
23+
return 0;
2224
}
2325
else
2426
{
25-
BenchmarkRunner.Run<OpenApiBenchmarks>(args: args);
27+
var summary = BenchmarkRunner.Run<OpenApiBenchmarks>(args: args);
28+
return summary.Reports.Any((p) => !p.Success) ? 1 : 0;
2629
}

0 commit comments

Comments
 (0)