mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-04-13 05:13:50 +00:00
ci: use hotpath-utils for benchmark workflows
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Iaae187e8320a3642c813ca2095a616056a6a6964
This commit is contained in:
parent
35d0f67812
commit
26c7a9f528
2 changed files with 56 additions and 79 deletions
50
.github/workflows/hotpath-comment.yml
vendored
50
.github/workflows/hotpath-comment.yml
vendored
|
|
@ -14,49 +14,31 @@ jobs:
|
||||||
comment:
|
comment:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Download profiling results
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
uses: actions/download-artifact@v8
|
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: hotpath-results
|
name: profile-metrics
|
||||||
path: /tmp/
|
path: /tmp/metrics/
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Install hotpath-utils CLI
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
run: cargo install hotpath --bin hotpath-utils --features=utils
|
||||||
|
|
||||||
- name: Install hotpath CLI
|
- name: Post PR comment
|
||||||
run: cargo install hotpath
|
|
||||||
|
|
||||||
- name: Post timing comparison comment
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
HEAD_METRICS=$(cat /tmp/head_timing.json)
|
export GITHUB_BASE_REF=$(cat /tmp/metrics/base_ref.txt)
|
||||||
BASE_METRICS=$(cat /tmp/base_timing.json)
|
export GITHUB_HEAD_REF=$(cat /tmp/metrics/head_ref.txt)
|
||||||
PR_NUMBER=$(cat /tmp/pr_number.txt)
|
hotpath-utils profile-pr \
|
||||||
hotpath profile-pr \
|
--head-metrics /tmp/metrics/head_timing.json \
|
||||||
--head-metrics "$HEAD_METRICS" \
|
--base-metrics /tmp/metrics/base_timing.json \
|
||||||
--base-metrics "$BASE_METRICS" \
|
|
||||||
--github-token "$GH_TOKEN" \
|
--github-token "$GH_TOKEN" \
|
||||||
--pr-number "$PR_NUMBER"
|
--pr-number "$(cat /tmp/metrics/pr_number.txt)" \
|
||||||
|
--benchmark-id "timing"
|
||||||
- name: Post allocation comparison comment
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
HEAD_METRICS=$(cat /tmp/head_alloc.json)
|
|
||||||
BASE_METRICS=$(cat /tmp/base_alloc.json)
|
|
||||||
PR_NUMBER=$(cat /tmp/pr_number.txt)
|
|
||||||
hotpath profile-pr \
|
|
||||||
--head-metrics "$HEAD_METRICS" \
|
|
||||||
--base-metrics "$BASE_METRICS" \
|
|
||||||
--github-token "$GH_TOKEN" \
|
|
||||||
--pr-number "$PR_NUMBER"
|
|
||||||
|
|
|
||||||
69
.github/workflows/hotpath-profile.yml
vendored
69
.github/workflows/hotpath-profile.yml
vendored
|
|
@ -4,62 +4,57 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
env:
|
permissions:
|
||||||
CARGO_TERM_COLOR: always
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
profile:
|
profile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout PR HEAD
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Rust
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
||||||
|
|
||||||
- name: Run timing profiling on HEAD
|
- name: Create metrics directory
|
||||||
|
run: mkdir -p /tmp/metrics
|
||||||
|
|
||||||
|
- name: Head benchmark (timing)
|
||||||
env:
|
env:
|
||||||
HOTPATH_JSON: "true"
|
HOTPATH_OUTPUT_FORMAT: json
|
||||||
run: |
|
HOTPATH_OUTPUT_PATH: /tmp/metrics/head_timing.json
|
||||||
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/head_timing.json
|
run: cargo run -p microfetch --release --features='hotpath'
|
||||||
|
|
||||||
- name: Run allocation profiling on HEAD
|
- name: Head benchmark (alloc)
|
||||||
env:
|
env:
|
||||||
HOTPATH_JSON: "true"
|
HOTPATH_OUTPUT_FORMAT: json
|
||||||
run: |
|
HOTPATH_OUTPUT_PATH: /tmp/metrics/head_alloc.json
|
||||||
cargo run --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/head_alloc.json
|
run: cargo run -p microfetch --release --features='hotpath,hotpath-alloc'
|
||||||
|
|
||||||
- name: Checkout base branch
|
- name: Checkout base
|
||||||
run: |
|
run: git checkout ${{ github.event.pull_request.base.sha }}
|
||||||
git checkout ${{ github.event.pull_request.base.sha }}
|
|
||||||
|
|
||||||
- name: Run timing profiling on base
|
- name: Base benchmark (timing)
|
||||||
env:
|
env:
|
||||||
HOTPATH_JSON: "true"
|
HOTPATH_OUTPUT_FORMAT: json
|
||||||
run: |
|
HOTPATH_OUTPUT_PATH: /tmp/metrics/base_timing.json
|
||||||
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/base_timing.json || echo '{}' > /tmp/base_timing.json
|
run: cargo run -p microfetch --release --features='hotpath' || echo '{}' > /tmp/metrics/base_timing.json
|
||||||
|
|
||||||
- name: Run allocation profiling on base
|
- name: Base benchmark (alloc)
|
||||||
env:
|
env:
|
||||||
HOTPATH_JSON: "true"
|
HOTPATH_OUTPUT_FORMAT: json
|
||||||
run: |
|
HOTPATH_OUTPUT_PATH: /tmp/metrics/base_alloc.json
|
||||||
cargo run --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/base_alloc.json || echo '{}' > /tmp/base_alloc.json
|
run: cargo run -p microfetch --release --features='hotpath,hotpath-alloc' || echo '{}' > /tmp/metrics/base_alloc.json
|
||||||
|
|
||||||
- name: Save PR number
|
- name: Save PR metadata
|
||||||
run: |
|
run: |
|
||||||
echo '${{ github.event.pull_request.number }}' > /tmp/pr_number.txt
|
echo '${{ github.event.pull_request.number }}' > /tmp/metrics/pr_number.txt
|
||||||
|
echo '${{ github.base_ref }}' > /tmp/metrics/base_ref.txt
|
||||||
|
echo '${{ github.head_ref }}' > /tmp/metrics/head_ref.txt
|
||||||
|
|
||||||
- name: Upload profiling results
|
- uses: actions/upload-artifact@v4
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
with:
|
||||||
name: hotpath-results
|
name: profile-metrics
|
||||||
path: |
|
path: /tmp/metrics/
|
||||||
/tmp/head_timing.json
|
|
||||||
/tmp/head_alloc.json
|
|
||||||
/tmp/base_timing.json
|
|
||||||
/tmp/base_alloc.json
|
|
||||||
/tmp/pr_number.txt
|
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue