Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move benchmark artifacts #1908

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmark-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:
gh-repository: 'github.com/${{ github.repository_owner }}/benchmarks'
github-token: ${{ secrets.BENCHMARKS_TOKEN }}
name: API Benchmarks
output-file-path: tests/API.Benchmarks/BenchmarkDotNet.Artifacts/results/MartinCostello.Api.Benchmarks.ApiBenchmarks-report-full-compressed.json
output-file-path: BenchmarkDotNet.Artifacts/results/MartinCostello.Api.Benchmarks.ApiBenchmarks-report-full-compressed.json
tool: 'benchmarkdotnet'

- name: Output summary
shell: pwsh
run: |
$repoName = ${env:GITHUB_REPOSITORY}.Split("/")[-1]
$summary = Get-Content -Path (Join-Path ${env:GITHUB_WORKSPACE} "tests" "API.Benchmarks" "BenchmarkDotNet.Artifacts" "results" "MartinCostello.Api.Benchmarks.ApiBenchmarks-report-github.md") -Raw
$summary = Get-Content -Path (Join-Path ${env:GITHUB_WORKSPACE} "BenchmarkDotNet.Artifacts" "results" "MartinCostello.Api.Benchmarks.ApiBenchmarks-report-github.md") -Raw
$summary += "`n`n"
$summary += "View benchmark results history [here](https://benchmarks.martincostello.com/${repoName})."
$summary >> ${env:GITHUB_STEP_SUMMARY}
5 changes: 4 additions & 1 deletion benchmark.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ $benchmarks = (Join-Path $solutionPath "tests" "API.Benchmarks" "API.Benchmarks.

Write-Host "Running benchmarks..." -ForegroundColor Green

$additionalArgs = @()
$additionalArgs = @(
"--artifacts",
(Join-Path $solutionPath "BenchmarkDotNet.Artifacts")
)

if (-Not [string]::IsNullOrEmpty($Filter)) {
$additionalArgs += "--filter"
Expand Down
8 changes: 3 additions & 5 deletions tests/API.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
using BenchmarkDotNet.Running;
using MartinCostello.Api.Benchmarks;

args ??= [];

if (args.Length == 1 && string.Equals(args[0], "--test", StringComparison.OrdinalIgnoreCase))
if (args.SequenceEqual(["--test"]))
{
await using var benchmark = new ApiBenchmarks();
await benchmark.StartServer();

await benchmark.Hash();
await benchmark.Time();
_ = await benchmark.Hash();
_ = await benchmark.Time();

await benchmark.StopServer();
}
Expand Down