From 789ece866b0480f57a365f6c1509a51c8b90b005 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Nov 2025 18:30:06 +0300 Subject: [PATCH] ci: initial benchmarking workflows Signed-off-by: NotAShelf Change-Id: I367444097eafbd1020c02707c42351bf6a6a6964 --- .github/workflows/hotpath-comment.yml | 57 ++++++++++++++++++++++++ .github/workflows/hotpath-profile.yml | 63 +++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 .github/workflows/hotpath-comment.yml create mode 100644 .github/workflows/hotpath-profile.yml diff --git a/.github/workflows/hotpath-comment.yml b/.github/workflows/hotpath-comment.yml new file mode 100644 index 0000000..395a533 --- /dev/null +++ b/.github/workflows/hotpath-comment.yml @@ -0,0 +1,57 @@ +name: Hotpath Comment + +on: + workflow_run: + workflows: ["Hotpath Profile"] + types: + - completed + +permissions: + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - name: Download profiling results + uses: actions/download-artifact@v4 + with: + name: hotpath-results + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + + - name: Read PR number + id: pr + run: echo "number=$(cat pr_number.txt)" >> $GITHUB_OUTPUT + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Install hotpath CLI + run: cargo install hotpath + + - name: Post timing comparison comment + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + hotpath profile-pr \ + --repo ${{ github.repository }} \ + --pr-number ${{ steps.pr.outputs.number }} \ + --head-json head-timing.json \ + --base-json base-timing.json \ + --mode timing \ + --title "⏱️ Hotpath Timing Profile" + + - name: Post allocation comparison comment + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + hotpath profile-pr \ + --repo ${{ github.repository }} \ + --pr-number ${{ steps.pr.outputs.number }} \ + --head-json head-alloc.json \ + --base-json base-alloc.json \ + --mode alloc \ + --title "📊 Hotpath Allocation Profile" diff --git a/.github/workflows/hotpath-profile.yml b/.github/workflows/hotpath-profile.yml new file mode 100644 index 0000000..b367ca2 --- /dev/null +++ b/.github/workflows/hotpath-profile.yml @@ -0,0 +1,63 @@ +name: Hotpath Profile + +on: + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + profile: + runs-on: ubuntu-latest + + steps: + - name: Checkout PR HEAD + uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Run timing profiling on HEAD + env: + HOTPATH_JSON: "true" + run: | + cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-timing.json + + - name: Run allocation profiling on HEAD + env: + HOTPATH_JSON: "true" + run: | + cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-alloc.json + + - name: Checkout base branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.sha }} + + - name: Run timing profiling on base + env: + HOTPATH_JSON: "true" + run: | + cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-timing.json + + - name: Run allocation profiling on base + env: + HOTPATH_JSON: "true" + run: | + cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-alloc.json + + - name: Save PR number + run: echo "${{ github.event.number }}" > pr_number.txt + + - name: Upload profiling results + uses: actions/upload-artifact@v4 + with: + name: hotpath-results + path: | + head-timing.json + head-alloc.json + base-timing.json + base-alloc.json + pr_number.txt + retention-days: 1