-
-
Notifications
You must be signed in to change notification settings - Fork 210
94 lines (82 loc) · 3.27 KB
/
benchmark.yaml
File metadata and controls
94 lines (82 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Benchmark
run-name: Benchmark(${{ inputs.config }})
on:
workflow_dispatch:
inputs:
config:
type: choice
description: Specify benchmark config key
default: Default
options:
- Default
- Test
- TargetFrameworks
- NuGetVersions
- SystemLinq
filter:
type: string
description: Specify benchmark filter text (e,g. Benchmark.ReadMeBenchmark*)
default: '*'
framework:
type: choice
description: Specify target framework for benchmark
default: net10.0
options:
- net9.0
- net10.0
jobs:
benchmark:
permissions:
contents: write
runs-on: ubuntu-24.04
timeout-minutes: 360 # Default: 360 minutes
steps:
- uses: Cysharp/Actions/.github/actions/checkout@main
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
10.0.x
- run: dotnet build -c Release
- name: Run Benchmarks
working-directory: sandbox/Benchmark
run: dotnet run -c Release --framework ${{ inputs.framework }} --no-build --no-launch-profile -- --filter "${{ inputs.filter }}" -- ${{ inputs.config }}
- name: Upload artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
with:
name: BenchmarkDotNet.Artifacts
path: sandbox/Benchmark/BenchmarkDotNet.Artifacts/
if-no-files-found: error
- name: Output results to JobSummary
working-directory: sandbox/Benchmark
shell: pwsh
run: |
$items = Get-ChildItem "BenchmarkDotNet.Artifacts/results/*.md" | where Name -ne 'reports.md'
foreach($item in $items) {
$title = $item.Name
$title = $title.Replace('-report-console.md', '')
$title = $title.Replace('_Int32_' , '<int>')
$title = $title.Replace('_String_', '<string>')
$title = $title.Replace('_Double_', '<double>')
$content = Get-Content $item.FullName -Raw
$tableContent = $content.Substring($content.IndexOf('|'))
$tableContent.Replace('<', '<').Replace('>', '>')
Write-Output ('## {0}' -f $title) >> $env:GITHUB_STEP_SUMMARY
Write-Output $tableContent >> $env:GITHUB_STEP_SUMMARY
}
- name: Update README.md benchmark report link
if: ${{ github.repository_owner == 'Cysharp' && github.ref_name == 'main' && inputs.config == 'Default' && inputs.filter == '*' }}
shell: pwsh
run: |
$PSNativeCommandUseErrorActionPreference = $true
$md = Get-Content README.md -Raw
$md = [regex]::Replace($md, 'https://github.com/Cysharp/ZLinq/actions/runs/([\d]+)',
'https://github.com/Cysharp/ZLinq/actions/runs/${{ github.run_id }}')
Set-Content -Path README.md -Value $md -Encoding utf8NoBOM
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m 'ci: update benchmark report link'
git push