Skip to content

Commit ccc3ac3

Browse files
Capture profile for keynote bench in nightly job
1 parent 0922704 commit ccc3ac3

2 files changed

Lines changed: 175 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ jobs:
272272
timeout-minutes: 60
273273
env:
274274
CARGO_TARGET_DIR: ${{ github.workspace }}/target
275+
CARGO_PROFILE_RELEASE_DEBUG: line-tables-only
276+
KEYNOTE_PROFILE_DIR: ${{ github.workspace }}/keynote-profile
277+
STDB_V8_FLAGS: "--perf-basic-prof --perf-basic-prof-only-functions --interpreted-frames-native-stack"
275278
steps:
276279
- name: Find Git ref
277280
env:
@@ -303,7 +306,14 @@ jobs:
303306
prefix-key: v1
304307

305308
- name: Build keynote benchmark binaries
306-
run: cargo build --release -p spacetimedb-cli -p spacetimedb-standalone
309+
run: >
310+
cargo
311+
--config 'build.rustflags = ["-C", "force-frame-pointers=yes"]'
312+
build
313+
--release
314+
-p spacetimedb-cli
315+
-p spacetimedb-standalone
316+
--features spacetimedb-standalone/perfmap
307317
308318
# Node 24 is the current Active LTS line.
309319
- name: Set up Node.js
@@ -319,8 +329,54 @@ jobs:
319329
run: pnpm build
320330
working-directory: crates/bindings-typescript
321331

332+
- name: Install samply
333+
env:
334+
CARGO_PROFILE_RELEASE_DEBUG: "false"
335+
run: |
336+
if ! command -v samply >/dev/null 2>&1; then
337+
cargo install --locked --version 0.13.1 samply
338+
fi
339+
samply --version
340+
322341
- name: Run keynote-2 benchmark regression check
323-
run: cargo ci keynote-bench
342+
id: keynote_bench
343+
run: |
344+
mkdir -p "$KEYNOTE_PROFILE_DIR"
345+
set +e
346+
samply record \
347+
--save-only \
348+
--unstable-presymbolicate \
349+
--profile-name keynote-bench \
350+
-o "$KEYNOTE_PROFILE_DIR/profile.json.gz" \
351+
-- cargo ci keynote-bench
352+
status=$?
353+
ls -lh "$KEYNOTE_PROFILE_DIR" || true
354+
exit "$status"
355+
356+
- name: Upload keynote benchmark profile
357+
if: failure() && steps.keynote_bench.outcome == 'failure'
358+
uses: actions/upload-artifact@v4
359+
with:
360+
name: keynote-bench-profile
361+
path: ${{ env.KEYNOTE_PROFILE_DIR }}
362+
if-no-files-found: warn
363+
retention-days: 14
364+
365+
- name: Report keynote benchmark profile instructions
366+
if: failure() && steps.keynote_bench.outcome == 'failure'
367+
run: |
368+
{
369+
echo "## Keynote benchmark profile"
370+
echo
371+
echo "The keynote benchmark failed after recording a Samply/Firefox profile."
372+
echo
373+
echo "1. Open this run's Summary page: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
374+
echo "2. Download the artifact named \`keynote-bench-profile\`."
375+
echo "3. Open <https://profiler.firefox.com/> and load \`profile.json.gz\`."
376+
echo "4. Compare hot frames against a recent nightly \`keynote-bench-nightly-profile\` artifact."
377+
} >> "$GITHUB_STEP_SUMMARY"
378+
379+
echo "::error title=Keynote benchmark profile uploaded::Download the keynote-bench-profile artifact from this run and open profile.json.gz in https://profiler.firefox.com/."
324380
325381
lints:
326382
name: Lints
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Keynote Bench Nightly
2+
3+
on:
4+
schedule:
5+
# Nightly at 3 AM UTC.
6+
- cron: '0 3 * * *'
7+
workflow_dispatch:
8+
inputs:
9+
ref:
10+
description: "Git ref to benchmark"
11+
required: false
12+
default: master
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: keynote-bench-nightly
19+
cancel-in-progress: true
20+
21+
jobs:
22+
keynote_bench:
23+
name: Keynote Bench
24+
runs-on: spacetimedb-benchmark-runner
25+
timeout-minutes: 60
26+
env:
27+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
28+
CARGO_PROFILE_RELEASE_DEBUG: line-tables-only
29+
KEYNOTE_PROFILE_DIR: ${{ github.workspace }}/keynote-profile
30+
STDB_V8_FLAGS: "--perf-basic-prof --perf-basic-prof-only-functions --interpreted-frames-native-stack"
31+
steps:
32+
- name: Checkout sources
33+
uses: actions/checkout@v4
34+
with:
35+
ref: ${{ github.event.inputs.ref || 'master' }}
36+
37+
- uses: dsherret/rust-toolchain-file@v1
38+
- name: Set default rust toolchain
39+
run: rustup default $(rustup show active-toolchain | cut -d' ' -f1)
40+
41+
- name: Cache Rust dependencies
42+
uses: Swatinem/rust-cache@v2
43+
with:
44+
workspaces: ${{ github.workspace }}
45+
shared-key: spacetimedb
46+
save-if: false
47+
prefix-key: v1
48+
49+
- name: Build keynote benchmark binaries
50+
run: >
51+
cargo
52+
--config 'build.rustflags = ["-C", "force-frame-pointers=yes"]'
53+
build
54+
--release
55+
-p spacetimedb-cli
56+
-p spacetimedb-standalone
57+
--features spacetimedb-standalone/perfmap
58+
59+
# Node 24 is the current Active LTS line.
60+
- name: Set up Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: 24
64+
65+
- uses: ./.github/actions/setup-pnpm
66+
with:
67+
run_install: true
68+
69+
- name: Build TypeScript SDK
70+
run: pnpm build
71+
working-directory: crates/bindings-typescript
72+
73+
- name: Install samply
74+
env:
75+
CARGO_PROFILE_RELEASE_DEBUG: "false"
76+
run: |
77+
if ! command -v samply >/dev/null 2>&1; then
78+
cargo install --locked --version 0.13.1 samply
79+
fi
80+
samply --version
81+
82+
- name: Run keynote-2 benchmark regression check
83+
id: keynote_bench
84+
run: |
85+
mkdir -p "$KEYNOTE_PROFILE_DIR"
86+
samply record \
87+
--save-only \
88+
--unstable-presymbolicate \
89+
--profile-name keynote-bench-nightly \
90+
-o "$KEYNOTE_PROFILE_DIR/profile.json.gz" \
91+
-- cargo ci keynote-bench
92+
ls -lh "$KEYNOTE_PROFILE_DIR" || true
93+
94+
- name: Upload keynote benchmark profile
95+
if: always()
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: keynote-bench-nightly-profile
99+
path: ${{ env.KEYNOTE_PROFILE_DIR }}
100+
if-no-files-found: warn
101+
retention-days: 90
102+
103+
- name: Report keynote benchmark profile instructions
104+
if: failure() && steps.keynote_bench.outcome == 'failure'
105+
run: |
106+
{
107+
echo "## Keynote benchmark profile"
108+
echo
109+
echo "The nightly keynote benchmark failed after recording a Samply/Firefox profile."
110+
echo
111+
echo "1. Open this run's Summary page: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
112+
echo "2. Download the artifact named \`keynote-bench-nightly-profile\`."
113+
echo "3. Open <https://profiler.firefox.com/> and load \`profile.json.gz\`."
114+
echo "4. Compare hot frames against earlier nightly \`keynote-bench-nightly-profile\` artifacts."
115+
} >> "$GITHUB_STEP_SUMMARY"
116+
117+
echo "::error title=Keynote benchmark profile uploaded::Download the keynote-bench-nightly-profile artifact from this run and open profile.json.gz in https://profiler.firefox.com/."

0 commit comments

Comments
 (0)