Files
pnpm/.github/workflows/benchmark.yml
dependabot[bot] fd20a6ee8a chore(deps): bump the github-actions group across 1 directory with 11 updates (#12785)
Bumps the github-actions group with 11 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `6.0.3` | `7.0.0` |
| [bencherdev/bencher](https://github.com/bencherdev/bencher) | `0.6.7` | `0.6.8` |
| [actions/cache/restore](https://github.com/actions/cache) | `5.0.5` | `6.1.0` |
| [actions/cache/save](https://github.com/actions/cache) | `5.0.5` | `6.1.0` |
| [taiki-e/install-action](https://github.com/taiki-e/install-action) | `2.82.0` | `2.82.5` |
| [actions/cache](https://github.com/actions/cache) | `5.0.5` | `6.1.0` |
| [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) | `4.1.0` | `4.1.1` |
| [softprops/action-gh-release](https://github.com/softprops/action-gh-release) | `3.0.0` | `3.0.1` |
| [warpdotdev/oz-agent-action](https://github.com/warpdotdev/oz-agent-action) | `1.0.19` | `1.0.21` |
| [cbrgm/mastodon-github-action](https://github.com/cbrgm/mastodon-github-action) | `2.2.1` | `2.2.2` |
| [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.5.6` | `0.5.7` |



Updates `actions/checkout` from 6.0.3 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6.0.3...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0)

Updates `bencherdev/bencher` from 0.6.7 to 0.6.8
- [Release notes](https://github.com/bencherdev/bencher/releases)
- [Commits](ec56bb69a7...5f9d4cf890)

Updates `actions/cache/restore` from 5.0.5 to 6.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](27d5ce7f10...55cc834586)

Updates `actions/cache/save` from 5.0.5 to 6.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](27d5ce7f10...55cc834586)

Updates `taiki-e/install-action` from 2.82.0 to 2.82.5
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](b8cecb8356...bffeee26d4)

Updates `actions/cache` from 5.0.5 to 6.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](27d5ce7f10...55cc834586)

Updates `actions/attest-build-provenance` from 4.1.0 to 4.1.1
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](a2bbfa2537...0f67c3f485)

Updates `softprops/action-gh-release` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](b430933298...718ea10b13)

Updates `warpdotdev/oz-agent-action` from 1.0.19 to 1.0.21
- [Release notes](https://github.com/warpdotdev/oz-agent-action/releases)
- [Commits](501d24fbf4...1922f22c00)

Updates `cbrgm/mastodon-github-action` from 2.2.1 to 2.2.2
- [Release notes](https://github.com/cbrgm/mastodon-github-action/releases)
- [Commits](244bbe72e6...ac2d8e8c99)

Updates `zizmorcore/zizmor-action` from 0.5.6 to 0.5.7
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](5f14fd08f7...192e21d79a)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: bencherdev/bencher
  dependency-version: 0.6.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: actions/cache/restore
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/cache/save
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: taiki-e/install-action
  dependency-version: 2.82.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: actions/cache
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/attest-build-provenance
  dependency-version: 4.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: softprops/action-gh-release
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: warpdotdev/oz-agent-action
  dependency-version: 1.0.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: cbrgm/mastodon-github-action
  dependency-version: 2.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.5.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-08 01:12:37 +02:00

212 lines
7.0 KiB
YAML

name: Benchmarks
on:
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to benchmark (works with fork PRs too)'
required: false
default: ''
type: string
runs:
description: 'Number of benchmark runs per scenario'
required: false
default: '10'
type: string
warmup:
description: 'Number of warmup runs before timing'
required: false
default: '1'
type: string
push:
# Build Bencher's continuous baseline for the `pnpm` testbed.
# Every merge to main that touches the TypeScript stack re-runs the
# bench so PR comparisons have an up-to-date reference; cancel-in-progress
# stays off below so we never throw away a partial run.
branches: [main]
paths:
- 'pnpm11/**'
- 'package.json'
- 'pnpm-workspace.yaml'
- 'pnpm-lock.yaml'
- '.github/workflows/benchmark.yml'
permissions:
contents: read
pull-requests: write
checks: write
# Don't cancel-in-progress — killing a bench mid-run wastes a long
# CI job and produces no usable data.
concurrency:
group: benchmark-${{ inputs.pr_number || github.ref }}
cancel-in-progress: false
jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Checkout PR head
if: inputs.pr_number != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ inputs.pr_number }}
run: |
echo "Fetching PR #$PR_NUMBER head..."
git fetch origin "refs/pull/${PR_NUMBER}/head:refs/remotes/origin/pr-${PR_NUMBER}"
git checkout "origin/pr-${PR_NUMBER}"
echo "Checked out PR #$PR_NUMBER at $(git rev-parse --short HEAD)"
- name: Install pnpm and Node
uses: pnpm/setup@77cf06832101b3ac8c65caaf76a21643936d07a4
with:
runtime: node@26.4.0
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
shared-key: pnpm-benchmark
- name: Install hyperfine
uses: ./.github/actions/binstall
with:
packages: hyperfine@1.18.0
- name: Run benchmarks
id: bench
run: |
set -o pipefail
./pnpm11/benchmarks/bench.sh 2>&1 | tee bench-output.txt
BENCH_DIR=$(grep "Temp directory kept at:" bench-output.txt | sed 's/Temp directory kept at: //')
echo "bench_dir=$BENCH_DIR" >> "$GITHUB_OUTPUT"
env:
RUNS: ${{ inputs.runs }}
WARMUP: ${{ inputs.warmup }}
- name: Install Bencher CLI
if: steps.bench.outputs.bench_dir != ''
uses: bencherdev/bencher@5f9d4cf890255c35e0354af1ed325108a6a0babd # v0.6.8
- name: Upload results to Bencher
if: steps.bench.outputs.bench_dir != ''
env:
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCH_DIR: ${{ steps.bench.outputs.bench_dir }}
EVENT_NAME: ${{ github.event_name }}
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
REF_NAME: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -z "${BENCHER_API_TOKEN:-}" ]; then
echo "::notice::BENCHER_API_TOKEN not set, skipping Bencher upload"
exit 0
fi
if [ ! -f "$BENCH_DIR/bencher-results.json" ]; then
echo "::warning::bencher-results.json not found, skipping upload"
exit 0
fi
# `bencher run --file` takes hyperfine JSON via the
# shell_hyperfine adapter. Branch policy:
# - push to main → record into the `main` branch (baseline)
# - workflow_dispatch with pr_number → record into `pr/<n>`,
# forked from main at the latest baseline
# - workflow_dispatch without pr_number → record into the
# ref's branch name (e.g. a feature branch), forked from main
args=(
--project pnpm
--testbed pnpm
--adapter shell_hyperfine
--file "$BENCH_DIR/bencher-results.json"
--github-actions "$GITHUB_TOKEN"
)
# `--start-point-clone-thresholds` so the forked branch inherits
# the threshold configured on main; `--err` so the workflow fails
# when a sample breaches the upper boundary. Main pushes skip
# both — by then the regression has already landed.
if [ "$EVENT_NAME" = "push" ] || [ "$REF_NAME" = "main" ]; then
args+=(--branch main)
elif [ -n "$INPUT_PR_NUMBER" ]; then
args+=(
--branch "pr/$INPUT_PR_NUMBER"
--start-point main
--start-point-reset
--start-point-clone-thresholds
--err
)
else
args+=(
--branch "$REF_NAME"
--start-point main
--start-point-reset
--start-point-clone-thresholds
--err
)
fi
bencher run "${args[@]}"
- name: Comment on PR
if: steps.bench.outputs.bench_dir != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BENCH_DIR: ${{ steps.bench.outputs.bench_dir }}
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
REF_NAME: ${{ github.ref_name }}
RUN_ID: ${{ github.run_id }}
SERVER_URL: ${{ github.server_url }}
REPO: ${{ github.repository }}
RUNS: ${{ inputs.runs }}
ACTOR: ${{ github.actor }}
run: |
RESULTS_FILE="$BENCH_DIR/results.md"
if [ ! -f "$RESULTS_FILE" ]; then
echo "::warning::Results file not found at $RESULTS_FILE"
exit 0
fi
echo "--- Benchmark Results ---"
cat "$RESULTS_FILE"
echo "-------------------------"
if [ -n "$INPUT_PR_NUMBER" ]; then
PR_NUMBER="$INPUT_PR_NUMBER"
else
PR_NUMBER=$(gh pr list --head "$REF_NAME" --json number --jq '.[0].number' 2>/dev/null || echo "")
fi
if [ -z "$PR_NUMBER" ]; then
echo "::notice::No open PR found for branch $REF_NAME. Results printed above."
exit 0
fi
MARKER="<!-- pnpm-benchmark-results -->"
{
echo "$MARKER"
cat "$RESULTS_FILE"
echo ""
echo "_Run [${RUN_ID}](${SERVER_URL}/${REPO}/actions/runs/${RUN_ID}) · ${RUNS} runs per scenario · triggered by @${ACTOR}_"
} > /tmp/comment-body.md
COMMENT_ID=$(gh api "repos/${REPO}/issues/${PR_NUMBER}/comments" \
--jq "[.[] | select(.body | startswith(\"$MARKER\"))] | .[0].id // empty" 2>/dev/null || echo "")
if [ -n "$COMMENT_ID" ]; then
echo "Updating existing benchmark comment $COMMENT_ID on PR #$PR_NUMBER"
gh api "repos/${REPO}/issues/comments/${COMMENT_ID}" \
-X PATCH \
-F "body=@/tmp/comment-body.md"
else
echo "Creating new benchmark comment on PR #$PR_NUMBER"
gh pr comment "$PR_NUMBER" --body-file /tmp/comment-body.md
fi