mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-12-14 08:21:01 +00:00
ci: fixup workflows based on upstream examples
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I4c82ef7b6874e213dadbbe3cc1f665466a6a6964
This commit is contained in:
parent
48c3807148
commit
8f69512e40
2 changed files with 102 additions and 58 deletions
60
.github/workflows/hotpath-comment.yml
vendored
60
.github/workflows/hotpath-comment.yml
vendored
|
|
@ -7,6 +7,7 @@ on:
|
|||
- completed
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
|
|
@ -15,35 +16,50 @@ jobs:
|
|||
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: hotpath-results
|
||||
name: profile-metrics
|
||||
path: /tmp/metrics/
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
|
||||
- name: Read PR number
|
||||
id: pr
|
||||
run: echo "number=$(cat pr_number.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Install hotpath CLI
|
||||
run: cargo install hotpath
|
||||
|
||||
- name: Post timing comparison comment
|
||||
run: |
|
||||
hotpath profile-pr \
|
||||
--head-metrics head-timing.json \
|
||||
--base-metrics base-timing.json \
|
||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
||||
--pr-number ${{ steps.pr.outputs.number }}
|
||||
- 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 allocation comparison comment
|
||||
run: |
|
||||
hotpath profile-pr \
|
||||
--head-metrics head-alloc.json \
|
||||
--base-metrics base-alloc.json \
|
||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
||||
--pr-number ${{ steps.pr.outputs.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"
|
||||
|
|
|
|||
100
.github/workflows/hotpath-profile.yml
vendored
100
.github/workflows/hotpath-profile.yml
vendored
|
|
@ -4,60 +4,88 @@ 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
|
||||
|
||||
- name: Setup Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Run timing profiling on HEAD
|
||||
env:
|
||||
HOTPATH_JSON: "true"
|
||||
run: |
|
||||
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-timing.json
|
||||
|
||||
- name: Run allocation profiling on HEAD
|
||||
env:
|
||||
HOTPATH_JSON: "true"
|
||||
run: |
|
||||
cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-alloc.json
|
||||
|
||||
- name: Checkout base branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.base.sha }}
|
||||
|
||||
- name: Run timing profiling on base
|
||||
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: |
|
||||
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-timing.json
|
||||
|
||||
{
|
||||
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: |
|
||||
cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-alloc.json
|
||||
|
||||
- name: Save PR number
|
||||
run: echo "${{ github.event.number }}" > pr_number.txt
|
||||
|
||||
{
|
||||
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: hotpath-results
|
||||
path: |
|
||||
head-timing.json
|
||||
head-alloc.json
|
||||
base-timing.json
|
||||
base-alloc.json
|
||||
pr_number.txt
|
||||
name: profile-metrics
|
||||
path: /tmp/metrics/
|
||||
retention-days: 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue