File tree Expand file tree Collapse file tree 3 files changed +78
-1
lines changed Expand file tree Collapse file tree 3 files changed +78
-1
lines changed Original file line number Diff line number Diff line change 1+ name : benchmark
2+
3+ env :
4+ DOTNET_CLI_TELEMETRY_OPTOUT : true
5+ DOTNET_NOLOGO : true
6+ DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION : 1
7+ NUGET_XMLDOC_MODE : skip
8+ TERM : xterm
9+
10+ on :
11+ push :
12+ branches :
13+ - main
14+ - dotnet-vnext
15+ - dotnet-nightly
16+ paths-ignore :
17+ - ' **/*.gitattributes'
18+ - ' **/*.gitignore'
19+ - ' **/*.md'
20+ workflow_dispatch :
21+
22+ permissions :
23+ contents : read
24+
25+ jobs :
26+ benchmark :
27+ name : benchmark
28+ runs-on : ubuntu-latest
29+
30+ steps :
31+
32+ - name : Checkout code
33+ uses : actions/checkout@v4
34+
35+ - name : Setup .NET SDK
36+ uses : actions/setup-dotnet@v4
37+
38+ - name : Run benchmarks
39+ shell : pwsh
40+ run : ./benchmark.ps1
41+
42+ - name : Get repository name
43+ id : get-repo-name
44+ shell : pwsh
45+ run : |
46+ $repoName = ${env:GITHUB_REPOSITORY}.Split("/")[-1]
47+ "repo-name=${repoName}" >> ${env:GITHUB_OUTPUT}
48+
49+ - name : Publish results
50+ uses : benchmark-action/github-action-benchmark@v1
51+ with :
52+ auto-push : true
53+ alert-comment-cc-users : ' @${{ github.repository_owner }}'
54+ benchmark-data-dir-path : ${{ steps.get-repo-name.outputs.repo-name }}
55+ comment-on-alert : true
56+ fail-on-alert : true
57+ gh-pages-branch : ${{ github.ref_name }}
58+ gh-repository : ' github.com/${{ github.repository_owner }}/benchmarks'
59+ github-token : ${{ secrets.BENCHMARKS_TOKEN }}
60+ name : ' ASP.NET Core OpenAPI'
61+ output-file-path : BenchmarkDotNet.Artifacts/results/TodoApp.OpenApiBenchmarks-report-full-compressed.json
62+ tool : benchmarkdotnet
63+
64+ - name : Output summary
65+ shell : pwsh
66+ env :
67+ REPO_NAME : ${{ steps.get-repo-name.outputs.repo-name }}
68+ run : |
69+ $summary = Get-Content -Path (Join-Path ${env:GITHUB_WORKSPACE} "BenchmarkDotNet.Artifacts" "results" "TodoApp.OpenApiBenchmarks-report-github.md") -Raw
70+ $summary += "`n`n"
71+ $summary += "View benchmark results history [here](https://benchmarks.martincostello.com/${env:REPO_NAME}?branch=${env:GITHUB_REF_NAME})."
72+ $summary >> ${env:GITHUB_STEP_SUMMARY}
Original file line number Diff line number Diff line change @@ -85,4 +85,9 @@ if (-Not [string]::IsNullOrEmpty($Job)) {
8585 $additionalArgs += $Job
8686}
8787
88+ if (-Not [string ]::IsNullOrEmpty(${env: GITHUB_SHA} )) {
89+ $additionalArgs += " --exporters"
90+ $additionalArgs += " json"
91+ }
92+
8893& $dotnet run -- project $benchmarks -- configuration " Release" -- $additionalArgs
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ namespace TodoApp;
1414
1515[ EventPipeProfiler ( EventPipeProfile . CpuSampling ) ]
1616[ MemoryDiagnoser ]
17- [ ShortRunJob ]
17+ [ ShortRunJob ] // TODO Remove once https://github.com/dotnet/aspnetcore/issues/56990 is resolved
1818public class OpenApiBenchmarks : IAsyncDisposable
1919{
2020 private WebApplication ? _app ;
You can’t perform that action at this time.
0 commit comments