Repository navigation
138 lines (133 loc) · 5.66 KB
/
Copy pathhotpath-benchmark.yml
File metadata and controls
138 lines (133 loc) · 5.66 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Benchmark
# Fail closed: both jobs below declare the exact scopes they need, so a future
# job that forgets `permissions:` inherits nothing instead of the repo default.
permissions: {}
# Selection narrows PR feedback: instruction counts of the tui_hotpath example
# can only move when vtcode-ui, its workspace dependency surface
# (vtcode-commons, vtcode-config, vtcode-diff — hence crates/common/**), the
# manifest graph, the hotpath policy, or this workflow changes. Other PRs skip
# a multi-minute build they cannot affect; the push-to-main run stays
# unfiltered so the main baseline is always current.
on:
push:
branches: [main]
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/codegen/vtcode-ui/**"
- "crates/codegen/vtcode-config/**"
- "crates/common/**"
- "hotpath/**"
- ".github/workflows/hotpath-benchmark.yml"
# Merged hotpath Cloud benchmark of the `tui_hotpath` example: native timing
# plus Callgrind instruction counts in one report. Built with the `x-prod`
# profile because `[profile.release]` (and `bench`, which inherits it) sets
# `strip = true`, and Callgrind attribution needs the symbol table.
# Docs: https://hotpath.rs/ci_integration
jobs:
upload:
name: benchmark (push)
if: github.event_name == 'push'
# Instruction counts only compare within one Valgrind build and Rust
# toolchain, so the image, the package and the toolchain are pinned.
runs-on: ubuntu-26.04
timeout-minutes: 30
permissions:
contents: read
id-token: write # the upload authenticates with the job's OIDC token
# Shared by both runs, so their reports describe one benchmark. Static
# values: job-level `env` cannot read the `runner` context.
env:
HOTPATH_BENCHMARK: tui_hotpath
HOTPATH_USER_METADATA: runner=Linux-X64,toolchain=1.100.0,profile=x-prod,valgrind=3.26.0
HOTPATH_OUTPUT_FORMAT: json
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.100.0"
- uses: Swatinem/rust-cache@eedcf2fb1c22f010a0eb66b92f378c110977f266 # v2
- name: Install valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind=1:3.26.0-0ubuntu1
valgrind --version
- name: Build benchmark
run: |
cargo build -q --locked --profile x-prod -p vtcode-ui --example tui_hotpath \
--features profiling,hotpath-cloud,hotpath-callgrind
- name: Run benchmark natively
env:
HOTPATH_OUTPUT_PATH: ${{ runner.temp }}/native.json
run: target/x-prod/examples/tui_hotpath
- name: Run benchmark under Callgrind and upload the merged report
env:
HOTPATH_UPLOAD: fail-on-error
HOTPATH_UPLOAD_RESPONSE_PATH: ${{ github.workspace }}/upload.json
HOTPATH_OUTPUT_PATH: ${{ runner.temp }}/merged.json
HOTPATH_MERGE_REPORT: ${{ runner.temp }}/native.json
HOTPATH_CALLGRIND_OUT_FILE: ${{ runner.temp }}/callgrind.out.%p
run: |
valgrind -q --tool=callgrind --instr-atstart=no \
--callgrind-out-file="$HOTPATH_CALLGRIND_OUT_FILE" \
target/x-prod/examples/tui_hotpath
test -s "$HOTPATH_UPLOAD_RESPONSE_PATH"
jq -e '.meta.run == "merged" and (.functions_icount.data | length > 0) and (.functions_timing.data | length > 0)' \
"$HOTPATH_OUTPUT_PATH" > /dev/null
# Runs pull request code (forks included): no `id-token`, no upload. The
# merged report is stored as an artifact that `hotpath-relay.yml` uploads.
report:
name: benchmark (pull request)
if: github.event_name == 'pull_request'
runs-on: ubuntu-26.04
timeout-minutes: 30
permissions:
contents: read
env:
HOTPATH_BENCHMARK: tui_hotpath
HOTPATH_USER_METADATA: runner=Linux-X64,toolchain=1.100.0,profile=x-prod,valgrind=3.26.0
HOTPATH_OUTPUT_FORMAT: json
steps:
- uses: actions/checkout@v7.0.1
with:
# The pull request's head commit, not the default merge commit.
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.100.0"
- uses: Swatinem/rust-cache@eedcf2fb1c22f010a0eb66b92f378c110977f266 # v2
- name: Install valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind=1:3.26.0-0ubuntu1
valgrind --version
- name: Build benchmark
run: |
cargo build -q --locked --profile x-prod -p vtcode-ui --example tui_hotpath \
--features profiling,hotpath-cloud,hotpath-callgrind
- name: Run benchmark natively
env:
HOTPATH_OUTPUT_PATH: ${{ runner.temp }}/native.json
run: target/x-prod/examples/tui_hotpath
- name: Run benchmark under Callgrind and write the merged report
env:
HOTPATH_OUTPUT_PATH: report.json
HOTPATH_MERGE_REPORT: ${{ runner.temp }}/native.json
HOTPATH_CALLGRIND_OUT_FILE: ${{ runner.temp }}/callgrind.out.%p
run: |
valgrind -q --tool=callgrind --instr-atstart=no \
--callgrind-out-file="$HOTPATH_CALLGRIND_OUT_FILE" \
target/x-prod/examples/tui_hotpath
test -s report.json
jq -e '.meta.run == "merged" and (.functions_icount.data | length > 0) and (.functions_timing.data | length > 0)' \
report.json > /dev/null
- uses: actions/upload-artifact@v7.0.2
with:
name: hotpath-report
path: report.json
retention-days: 1
if-no-files-found: error