-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (55 loc) · 2.02 KB
/
benchmarks.yml
File metadata and controls
67 lines (55 loc) · 2.02 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
name: Benchmarks
on:
push:
branches: [ main ]
paths:
- 'src/**'
- 'test/FunctionalStateMachine.Benchmarks/**'
pull_request:
branches: [ main ]
paths:
- 'src/**'
- 'test/FunctionalStateMachine.Benchmarks/**'
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "9.0.x"
- name: Restore
run: dotnet restore test/FunctionalStateMachine.Benchmarks/FunctionalStateMachine.Benchmarks.csproj
- name: Build
run: dotnet build test/FunctionalStateMachine.Benchmarks/FunctionalStateMachine.Benchmarks.csproj --configuration Release --no-restore
- name: Run Benchmarks
run: dotnet run --project test/FunctionalStateMachine.Benchmarks/FunctionalStateMachine.Benchmarks.csproj --configuration Release --no-build
- name: Upload Results
uses: actions/upload-artifact@v6
if: always()
with:
name: benchmark-results
path: test/FunctionalStateMachine.Benchmarks/BenchmarkDotNet.Artifacts/results/
retention-days: 30
- name: Comment PR with Results
if: github.event_name == 'pull_request'
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const markdownPath = 'test/FunctionalStateMachine.Benchmarks/BenchmarkDotNet.Artifacts/results/StateMachineBenchmarks-report-github.md';
if (fs.existsSync(markdownPath)) {
const markdown = fs.readFileSync(markdownPath, 'utf8');
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## 🚀 Benchmark Results\n\n${markdown}`
});
}