microfetch/.github/workflows/hotpath-comment.yml
NotAShelf 8f69512e40
ci: fixup workflows based on upstream examples
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4c82ef7b6874e213dadbbe3cc1f665466a6a6964
2025-11-30 15:21:53 +03:00

65 lines
1.8 KiB
YAML

name: Hotpath Comment
on:
workflow_run:
workflows: ["Hotpath Profile"]
types:
- completed
permissions:
contents: read
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Download profiling results
uses: actions/download-artifact@v4
with:
name: profile-metrics
path: /tmp/metrics/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Install hotpath CLI
run: cargo install hotpath
- name: Post allocation comparison comment
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
HEAD_METRICS=$(cat /tmp/metrics/head_alloc.json)
BASE_METRICS=$(cat /tmp/metrics/base_alloc.json)
PR_NUMBER=$(cat /tmp/metrics/pr_number.txt)
hotpath profile-pr \
--head-metrics "$HEAD_METRICS" \
--base-metrics "$BASE_METRICS" \
--github-token "$GH_TOKEN" \
--pr-number "$PR_NUMBER"
- name: Post timing comparison comment
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
HEAD_METRICS=$(cat /tmp/metrics/head_timing.json)
BASE_METRICS=$(cat /tmp/metrics/base_timing.json)
PR_NUMBER=$(cat /tmp/metrics/pr_number.txt)
hotpath profile-pr \
--head-metrics "$HEAD_METRICS" \
--base-metrics "$BASE_METRICS" \
--github-token "$GH_TOKEN" \
--pr-number "$PR_NUMBER"