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

Add Action to run performance benchmarks #4285

Merged
merged 39 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d15d957
Pass console args to BDN.
pmaytak Aug 1, 2023
3045a65
Comment tests temporarily.
pmaytak Aug 1, 2023
ad1cb85
Add perf benchmark.
pmaytak Aug 2, 2023
3d79808
Merge remote-tracking branch 'origin/main' into pmaytak/perf-benchmar…
pmaytak Aug 2, 2023
a43b954
Update perf project to net6.0
pmaytak Aug 2, 2023
6e72818
Trigger action.
pmaytak Aug 2, 2023
665201b
Fix path
pmaytak Aug 2, 2023
73f8bd2
Trigger.
pmaytak Aug 2, 2023
b24d06f
Fix artifact path. Use .NET Core 3.1.
pmaytak Aug 3, 2023
989f3ee
Comment out build path temporarily.
pmaytak Aug 3, 2023
d9c8dcb
Install .NET.
pmaytak Aug 3, 2023
468a049
Fix
pmaytak Aug 3, 2023
63b2750
Fix warnings.
pmaytak Aug 3, 2023
d8fab7e
Enable graphs.
pmaytak Aug 3, 2023
18f4f6f
Fix push gh pages
pmaytak Aug 3, 2023
8143422
Fix graphs.
pmaytak Aug 3, 2023
1e0ca94
Added tests.
pmaytak Aug 3, 2023
1ca13f3
Add all tests to benchmark action. Remove (1, 1000) test case.
pmaytak Aug 4, 2023
9e3f077
Merge remote-tracking branch 'origin/main' into pmaytak/perf-benchmar…
pmaytak Aug 4, 2023
48ae66a
Fix test naming.
pmaytak Aug 4, 2023
e044b41
Update run command in ADO perf yml.
pmaytak Aug 4, 2023
211046c
Change threshold.
pmaytak Aug 5, 2023
9c2a7d1
Update path.
pmaytak Aug 5, 2023
2bff4cf
Temporary change.
pmaytak Aug 5, 2023
0e274e1
Update yml, trigger on pull request, but don't publish the charts.
pmaytak Aug 5, 2023
88d1707
Test trigger.
pmaytak Aug 5, 2023
c6cb555
Test.
pmaytak Aug 5, 2023
8883379
Test3. Fix ADO perf yml.
pmaytak Aug 5, 2023
82b9f54
Fix push GH pages.
pmaytak Aug 5, 2023
3f0ceb4
Revert.
pmaytak Aug 7, 2023
0f55b34
Revert ADO yml.
pmaytak Aug 7, 2023
4ad7732
Update perf alert threshold.
pmaytak Aug 7, 2023
a9549d3
Cleanup.
pmaytak Aug 9, 2023
2331cd0
Try upload to GH pages.
pmaytak Aug 10, 2023
3833728
Fix for testing.
pmaytak Aug 10, 2023
93c86f0
Fix for test.
pmaytak Aug 10, 2023
f9a16bc
Fix for tests.
pmaytak Aug 10, 2023
62021f8
Revert.
pmaytak Aug 10, 2023
ab2de17
Merge branch 'main' into pmaytak/perf-benchmark-action
pmaytak Aug 10, 2023
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
112 changes: 112 additions & 0 deletions .github/workflows/benchmark-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Run performance benchmarks
on:
workflow_dispatch: # Allows manual triggering of workflow
push:
branches:
- main
paths:
- src/client/Microsoft.Identity.Client/**/*.cs
#pull_request: # Will re-enable once the code to not push to gh-pages is fixed
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
# types: [opened, reopened, synchronize, ready_for_review]
# paths:
# - src/client/Microsoft.Identity.Client/**/*.cs

permissions:
# Deployments permission to deploy GitHub pages website
deployments: write
# Contents permission to update benchmark contents in gh-pages branch
contents: write

jobs:
benchmark:
name: Run performance benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.426'
- name: Run benchmark
run: cd tests/Microsoft.Identity.Test.Performance && dotnet run -c release -f netcoreapp3.1 --exporters json

- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Store AcquireTokenNoCacheTests result
uses: benchmark-action/github-action-benchmark@v1
with:
name: AcquireTokenNoCache
tool: 'benchmarkdotnet'
output-file-path: tests/Microsoft.Identity.Test.Performance/BenchmarkDotNet.Artifacts/results/Microsoft.Identity.Test.Performance.AcquireTokenNoCacheTests-report-full-compressed.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
#external-data-json-path: ./cache/benchmark-data.json
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '140%'
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@pmaytak'
summary-always: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: benchmarks

- name: Store AcquireTokenForClientCacheTests result
uses: benchmark-action/github-action-benchmark@v1
with:
name: AcquireTokenForClientWithCache
tool: 'benchmarkdotnet'
output-file-path: tests/Microsoft.Identity.Test.Performance/BenchmarkDotNet.Artifacts/results/Microsoft.Identity.Test.Performance.AcquireTokenForClientCacheTests-report-full-compressed.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
#external-data-json-path: ./cache/benchmark-data.json
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '140%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@pmaytak'
summary-always: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: benchmarks
pmaytak marked this conversation as resolved.
Show resolved Hide resolved

- name: Store AcquireTokenForOboCacheTests result
uses: benchmark-action/github-action-benchmark@v1
with:
name: AcquireTokenForOboWithCache
tool: 'benchmarkdotnet'
output-file-path: tests/Microsoft.Identity.Test.Performance/BenchmarkDotNet.Artifacts/results/Microsoft.Identity.Test.Performance.AcquireTokenForOboCacheTests-report-full-compressed.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
#external-data-json-path: ./cache/benchmark-data.json
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '140%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@pmaytak'
summary-always: true
gh-pages-branch: gh-pages
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
benchmark-data-dir-path: benchmarks

- name: Store TokenCacheTests result
uses: benchmark-action/github-action-benchmark@v1
with:
name: TokenCacheTestsWithCache
tool: 'benchmarkdotnet'
output-file-path: tests/Microsoft.Identity.Test.Performance/BenchmarkDotNet.Artifacts/results/Microsoft.Identity.Test.Performance.TokenCacheTests-report-full-compressed.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
#external-data-json-path: ./cache/benchmark-data.json
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '140%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@pmaytak'
summary-always: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: benchmarks

#- name: Publish GibHub Pages
# run: git push origin gh-pages:gh-pages
# if: github.event_name != 'pull_request'
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class AcquireTokenForClientCacheTests
// This is a workaround to specify the exact param combinations to be used.
public IEnumerable<(int, int)> CacheSizeSource => new[] {
(1, 10),
(1, 1000),
(10000, 10),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class AcquireTokenForOboCacheTests
// This is a workaround to specify the exact param combinations to be used.
public IEnumerable<(int, int)> CacheSizeSource => new[] {
(1, 10),
(1, 1000),
(10000, 10),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<ItemGroup Condition="'$(UseIdentityWeb)' == 'true'">
<PackageReference Include="Microsoft.Identity.Web.TokenCache" Version="*" />
<PackageReference Include="Microsoft.Identity.Client" Version="*" />
<PackageReference Include="Microsoft.Identity.Client.Desktop" Version="*" />
</ItemGroup>

<ItemGroup Condition="'$(UseIdentityWeb)' != 'true'">
Expand Down
4 changes: 2 additions & 2 deletions tests/Microsoft.Identity.Test.Performance/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public static void Main(string[] args)
#endif
.WithOptions(ConfigOptions.DisableLogFile)
.WithOptions(ConfigOptions.StopOnFirstError)
.WithOptions(ConfigOptions.JoinSummary)
//.WithOptions(ConfigOptions.JoinSummary)
.WithOrderer(new DefaultOrderer(SummaryOrderPolicy.Method))
.HideColumns(Column.UnrollFactor, Column.Type, Column.InvocationCount, Column.Error, Column.StdDev, Column.Median, Column.Job)
.AddDiagnoser(MemoryDiagnoser.Default) // https://benchmarkdotnet.org/articles/configs/diagnosers.html
//.AddDiagnoser(new EtwProfiler()) // https://adamsitnik.com/ETW-Profiler/
.AddJob(
Job.Default
.WithId("Job-PerfTests")));
.WithId("Job-PerfTests")), args);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class TokenCacheTests
// This is a workaround to specify the exact param combinations to be used.
public IEnumerable<(int, int)> CacheSizeSource => new[] {
(1, 10),
(1, 1000),
(10000, 10),
};

Expand Down
Loading