|
| 1 | +name: hotpath-profile |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + |
| 9 | +jobs: |
| 10 | + profile: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - uses: dtolnay/rust-toolchain@stable |
| 18 | + - uses: Swatinem/rust-cache@v2 |
| 19 | + |
| 20 | + - id: head_timing_metrics |
| 21 | + run: | |
| 22 | + # Extract timing metrics from head branch |
| 23 | + { |
| 24 | + echo 'metrics<<EOF' |
| 25 | + cargo run --example benchmark --features='hotpath,hotpath-ci' | grep '^{"hotpath_profiling_mode"' |
| 26 | + echo 'EOF' |
| 27 | + } >> "$GITHUB_OUTPUT" |
| 28 | +
|
| 29 | + - id: head_alloc_metrics |
| 30 | + run: | |
| 31 | + # Extract alloc metrics from head branch |
| 32 | + { |
| 33 | + echo 'metrics<<EOF' |
| 34 | + cargo run --example benchmark --features='hotpath,hotpath-ci,hotpath-alloc-count-total' | grep '^{"hotpath_profiling_mode"' |
| 35 | + echo 'EOF' |
| 36 | + } >> "$GITHUB_OUTPUT" |
| 37 | +
|
| 38 | + - name: Checkout base |
| 39 | + run: | |
| 40 | + git checkout ${{ github.event.pull_request.base.sha }} |
| 41 | +
|
| 42 | + - id: base_timing_metrics |
| 43 | + run: | |
| 44 | + # Extract timing metrics from base branch |
| 45 | + { |
| 46 | + echo 'metrics<<EOF' |
| 47 | + cargo run --example benchmark --features='hotpath,hotpath-ci' | grep '^{"hotpath_profiling_mode"' |
| 48 | + echo 'EOF' |
| 49 | + } >> "$GITHUB_OUTPUT" |
| 50 | +
|
| 51 | + - id: base_alloc_metrics |
| 52 | + run: | |
| 53 | + # Extract alloc metrics from base branch |
| 54 | + { |
| 55 | + echo 'metrics<<EOF' |
| 56 | + cargo run --example benchmark --features='hotpath,hotpath-ci,hotpath-alloc-count-total' | grep '^{"hotpath_profiling_mode"' |
| 57 | + echo 'EOF' |
| 58 | + } >> "$GITHUB_OUTPUT" |
| 59 | +
|
| 60 | + - name: Save metrics to artifact |
| 61 | + run: | |
| 62 | + mkdir -p /tmp/metrics |
| 63 | + echo '${{ steps.head_timing_metrics.outputs.metrics }}' > /tmp/metrics/head_timing.json |
| 64 | + echo '${{ steps.base_timing_metrics.outputs.metrics }}' > /tmp/metrics/base_timing.json |
| 65 | + echo '${{ steps.head_alloc_metrics.outputs.metrics }}' > /tmp/metrics/head_alloc.json |
| 66 | + echo '${{ steps.base_alloc_metrics.outputs.metrics }}' > /tmp/metrics/base_alloc.json |
| 67 | + echo '${{ github.event.pull_request.number }}' > /tmp/metrics/pr_number.txt |
| 68 | +
|
| 69 | + - uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: profile-metrics |
| 72 | + path: /tmp/metrics/ |
| 73 | + retention-days: 1 |
0 commit comments