Skip to content

Commit 789ece8

Browse files
committed
ci: initial benchmarking workflows
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I367444097eafbd1020c02707c42351bf6a6a6964
1 parent f4f3385 commit 789ece8

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Hotpath Comment
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Hotpath Profile"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
pull-requests: write
11+
12+
jobs:
13+
comment:
14+
runs-on: ubuntu-latest
15+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
16+
17+
steps:
18+
- name: Download profiling results
19+
uses: actions/download-artifact@v4
20+
with:
21+
name: hotpath-results
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
run-id: ${{ github.event.workflow_run.id }}
24+
25+
- name: Read PR number
26+
id: pr
27+
run: echo "number=$(cat pr_number.txt)" >> $GITHUB_OUTPUT
28+
29+
- name: Setup Rust
30+
uses: actions-rust-lang/setup-rust-toolchain@v1
31+
32+
- name: Install hotpath CLI
33+
run: cargo install hotpath
34+
35+
- name: Post timing comparison comment
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: |
39+
hotpath profile-pr \
40+
--repo ${{ github.repository }} \
41+
--pr-number ${{ steps.pr.outputs.number }} \
42+
--head-json head-timing.json \
43+
--base-json base-timing.json \
44+
--mode timing \
45+
--title "⏱️ Hotpath Timing Profile"
46+
47+
- name: Post allocation comparison comment
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
hotpath profile-pr \
52+
--repo ${{ github.repository }} \
53+
--pr-number ${{ steps.pr.outputs.number }} \
54+
--head-json head-alloc.json \
55+
--base-json base-alloc.json \
56+
--mode alloc \
57+
--title "📊 Hotpath Allocation Profile"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Hotpath Profile
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
profile:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout PR HEAD
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Rust
19+
uses: actions-rust-lang/setup-rust-toolchain@v1
20+
21+
- name: Run timing profiling on HEAD
22+
env:
23+
HOTPATH_JSON: "true"
24+
run: |
25+
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-timing.json
26+
27+
- name: Run allocation profiling on HEAD
28+
env:
29+
HOTPATH_JSON: "true"
30+
run: |
31+
cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-alloc.json
32+
33+
- name: Checkout base branch
34+
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ github.event.pull_request.base.sha }}
37+
38+
- name: Run timing profiling on base
39+
env:
40+
HOTPATH_JSON: "true"
41+
run: |
42+
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-timing.json
43+
44+
- name: Run allocation profiling on base
45+
env:
46+
HOTPATH_JSON: "true"
47+
run: |
48+
cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-alloc.json
49+
50+
- name: Save PR number
51+
run: echo "${{ github.event.number }}" > pr_number.txt
52+
53+
- name: Upload profiling results
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: hotpath-results
57+
path: |
58+
head-timing.json
59+
head-alloc.json
60+
base-timing.json
61+
base-alloc.json
62+
pr_number.txt
63+
retention-days: 1

0 commit comments

Comments
 (0)