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
56
.github/workflows/hotpath-comment.yml
vendored
56
.github/workflows/hotpath-comment.yml
vendored
|
|
@ -7,6 +7,7 @@ on:
|
||||||
- completed
|
- completed
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -15,35 +16,50 @@ jobs:
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
|
||||||
steps:
|
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
|
- name: Download profiling results
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: hotpath-results
|
name: profile-metrics
|
||||||
|
path: /tmp/metrics/
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
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
|
- name: Install hotpath CLI
|
||||||
run: cargo install hotpath
|
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
|
- name: Post allocation comparison comment
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
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 \
|
hotpath profile-pr \
|
||||||
--head-metrics head-alloc.json \
|
--head-metrics "$HEAD_METRICS" \
|
||||||
--base-metrics base-alloc.json \
|
--base-metrics "$BASE_METRICS" \
|
||||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
--github-token "$GH_TOKEN" \
|
||||||
--pr-number ${{ steps.pr.outputs.number }}
|
--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"
|
||||||
|
|
|
||||||
78
.github/workflows/hotpath-profile.yml
vendored
78
.github/workflows/hotpath-profile.yml
vendored
|
|
@ -4,6 +4,9 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
|
@ -14,50 +17,75 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout PR HEAD
|
- name: Checkout PR HEAD
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Run timing profiling on HEAD
|
- name: Rust Cache
|
||||||
env:
|
uses: Swatinem/rust-cache@v2
|
||||||
HOTPATH_JSON: "true"
|
|
||||||
run: |
|
|
||||||
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-timing.json
|
|
||||||
|
|
||||||
- name: Run allocation profiling on HEAD
|
- name: Run allocation profiling on HEAD
|
||||||
|
id: head_alloc_metrics
|
||||||
env:
|
env:
|
||||||
HOTPATH_JSON: "true"
|
HOTPATH_JSON: "true"
|
||||||
run: |
|
run: |
|
||||||
cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > head-alloc.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
|
- name: Checkout base branch
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.base.sha }}
|
|
||||||
|
|
||||||
- name: Run timing profiling on base
|
|
||||||
env:
|
|
||||||
HOTPATH_JSON: "true"
|
|
||||||
run: |
|
run: |
|
||||||
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-timing.json
|
git checkout ${{ github.event.pull_request.base.sha }}
|
||||||
|
|
||||||
- name: Run allocation profiling on base
|
- name: Run allocation profiling on base
|
||||||
|
id: base_alloc_metrics
|
||||||
env:
|
env:
|
||||||
HOTPATH_JSON: "true"
|
HOTPATH_JSON: "true"
|
||||||
run: |
|
run: |
|
||||||
cargo run --features='hotpath,hotpath-alloc-count-total' 2>&1 | grep '^{"hotpath_profiling_mode"' > base-alloc.json
|
{
|
||||||
|
echo 'metrics<<EOF'
|
||||||
|
cargo run --release --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"'
|
||||||
|
echo 'EOF'
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Save PR number
|
- name: Run timing profiling on base
|
||||||
run: echo "${{ github.event.number }}" > pr_number.txt
|
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
|
- name: Upload profiling results
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: hotpath-results
|
name: profile-metrics
|
||||||
path: |
|
path: /tmp/metrics/
|
||||||
head-timing.json
|
|
||||||
head-alloc.json
|
|
||||||
base-timing.json
|
|
||||||
base-alloc.json
|
|
||||||
pr_number.txt
|
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue