-
Notifications
You must be signed in to change notification settings - Fork 81
106 lines (94 loc) · 3.32 KB
/
Copy pathbenchmark.yml
File metadata and controls
106 lines (94 loc) · 3.32 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
95
96
97
98
99
100
101
102
103
104
105
106
name: Benchmark
on:
push:
branches:
- main
pull_request:
branches:
- main
- release/*
workflow_dispatch:
inputs:
backfill_from:
description: "Backfill from: commit SHA or number of recent commits. Leave empty to run a normal benchmark."
required: false
type: string
branch:
description: "Data branch to store results (default: benchmark-data)"
required: false
type: string
default: "benchmark-data"
runner:
description: "Runner label (for stable runs prefer self-hosted or larger dedicated runner)"
required: false
type: string
default: "ubuntu-latest"
permissions:
contents: write
concurrency:
group: benchmark-${{ github.ref }}
cancel-in-progress: true
jobs:
benchmark:
name: Run Benchmarks
runs-on: ${{ github.event_name == 'workflow_dispatch' && inputs.runner || vars.BENCHMARK_RUNNER || 'ubuntu-latest' }}
env:
TYPESPEC_VS_CI_BUILD: true
TYPESPEC_SKIP_WEBSITE_BUILD: true
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: 24.15.0
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm -r --filter "@azure-tools/typespec-benchmark..." build
- name: Run backfill
if: ${{ github.event_name == 'workflow_dispatch' && inputs.backfill_from }}
run: |
node --max-old-space-size=6144 packages/benchmark/dist/src/cli.js backfill \
--from ${{ inputs.backfill_from }} \
--specs-dir packages/benchmark/specs \
--iterations 25 \
--warmup 3 \
--branch ${{ inputs.branch }} \
--push
- name: Run benchmarks
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.backfill_from }}
run: |
node --max-old-space-size=6144 packages/benchmark/dist/src/cli.js run \
--specs-dir packages/benchmark/specs \
--iterations 25 \
--warmup 3 \
--noise-cv-threshold 0.08 \
--max-reruns 1 \
--rerun-iterations 10 \
--commit ${{ github.sha }} \
--output /tmp/benchmark-results.json
# On push to main: store results to benchmark-data branch
- name: Store benchmark results
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
node packages/benchmark/dist/src/cli.js store-results \
--results /tmp/benchmark-results.json \
--commit ${{ github.sha }}
# On PR: fetch baseline, compare, and upload as artifact for the comment workflow
- name: Generate PR comment
if: github.event_name == 'pull_request'
run: |
node packages/benchmark/dist/src/cli.js upload-pr-comment \
--results /tmp/benchmark-results.json \
--pr-number ${{ github.event.number }} \
--baseline-window 20 \
--output-dir /tmp/benchmark-artifacts
- name: Upload benchmark comment
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: benchmark-comment
path: /tmp/benchmark-artifacts/
retention-days: 1