-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathrun_performance_tests_windows.yml
More file actions
71 lines (58 loc) · 2.56 KB
/
run_performance_tests_windows.yml
File metadata and controls
71 lines (58 loc) · 2.56 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
name: run_performance_tests_windows
on:
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
run_performance_tests_windows:
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Checkout PR / push branch
uses: actions/checkout@v6
with:
path: branch-code
- name: Checkout main branch (for comparison)
if: github.event_name == 'pull_request'
uses: actions/checkout@v6
with:
ref: main
path: main-code
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.x
- name: Run benchmarks (PR branch)
run: dotnet run -c Release --framework net9.0 -- --filter "*"
working-directory: ./branch-code/csharp/PhoneNumbers.PerformanceTest
- name: Run benchmarks (main branch)
if: github.event_name == 'pull_request'
run: dotnet run -c Release --framework net9.0 -- --filter "*"
working-directory: ./main-code/csharp/PhoneNumbers.PerformanceTest
- name: Stage benchmark artifact
if: github.event_name == 'pull_request'
shell: pwsh
run: |
$stage = "benchmark-artifact"
New-Item -ItemType Directory -Force -Path "$stage/branch-results" | Out-Null
New-Item -ItemType Directory -Force -Path "$stage/main-results" | Out-Null
$prDir = "branch-code/csharp/PhoneNumbers.PerformanceTest/BenchmarkDotNet.Artifacts/results"
$mainDir = "main-code/csharp/PhoneNumbers.PerformanceTest/BenchmarkDotNet.Artifacts/results"
if (Test-Path $prDir) { Copy-Item "$prDir/*-report-github.md" "$stage/branch-results/" -ErrorAction SilentlyContinue }
if (Test-Path $mainDir) { Copy-Item "$mainDir/*-report-github.md" "$stage/main-results/" -ErrorAction SilentlyContinue }
# PR metadata for the follow-up workflow (use head SHA, not the merge SHA in GITHUB_SHA)
@{
pr_number = ${{ github.event.pull_request.number }}
head_sha = "${{ github.event.pull_request.head.sha }}"
} | ConvertTo-Json | Set-Content "$stage/pr-info.json"
Get-ChildItem -Recurse $stage | Select-Object FullName
- name: Upload benchmark artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: benchmark-results
path: benchmark-artifact/
retention-days: 7
if-no-files-found: error