mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-12-16 17:21:00 +00:00
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I4c82ef7b6874e213dadbbe3cc1f665466a6a6964
91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
name: Hotpath Profile
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
profile:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout PR HEAD
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Run allocation profiling on HEAD
|
|
id: head_alloc_metrics
|
|
env:
|
|
HOTPATH_JSON: "true"
|
|
run: |
|
|
{
|
|
echo 'metrics<<EOF'
|
|
cargo run --release --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"'
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Run timing profiling on HEAD
|
|
id: head_timing_metrics
|
|
env:
|
|
HOTPATH_JSON: "true"
|
|
run: |
|
|
{
|
|
echo 'metrics<<EOF'
|
|
cargo run --release --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"'
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Checkout base branch
|
|
run: |
|
|
git checkout ${{ github.event.pull_request.base.sha }}
|
|
|
|
- name: Run allocation profiling on base
|
|
id: base_alloc_metrics
|
|
env:
|
|
HOTPATH_JSON: "true"
|
|
run: |
|
|
{
|
|
echo 'metrics<<EOF'
|
|
cargo run --release --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"'
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Run timing profiling on base
|
|
id: base_timing_metrics
|
|
env:
|
|
HOTPATH_JSON: "true"
|
|
run: |
|
|
{
|
|
echo 'metrics<<EOF'
|
|
cargo run --release --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"'
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Save metrics to artifact
|
|
run: |
|
|
mkdir -p /tmp/metrics
|
|
echo '${{ steps.head_alloc_metrics.outputs.metrics }}' > /tmp/metrics/head_alloc.json
|
|
echo '${{ steps.base_alloc_metrics.outputs.metrics }}' > /tmp/metrics/base_alloc.json
|
|
echo '${{ steps.head_timing_metrics.outputs.metrics }}' > /tmp/metrics/head_timing.json
|
|
echo '${{ steps.base_timing_metrics.outputs.metrics }}' > /tmp/metrics/base_timing.json
|
|
echo '${{ github.event.pull_request.number }}' > /tmp/metrics/pr_number.txt
|
|
|
|
- name: Upload profiling results
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: profile-metrics
|
|
path: /tmp/metrics/
|
|
retention-days: 1
|