|
| 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