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