| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- name: Performance
- on:
- pull_request:
- types: [opened, synchronize, reopened, labeled, unlabeled]
- workflow_dispatch:
- inputs:
- base:
- description: Baseline commit or branch
- required: true
- default: main
- type: string
- suite:
- description: Performance suite (full includes startup and long history)
- required: true
- default: full
- type: choice
- options: [full, basic]
- permissions:
- contents: read
- jobs:
- performance:
- # Unrelated label events must not replace the actual performance check.
- name: ${{ contains(fromJSON('["labeled","unlabeled"]'), github.event.action) && github.event.label.name != 'perf:full' && 'performance (label ignored)' || 'performance' }}
- if: ${{ !contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || github.event.label.name == 'perf:full' }}
- strategy:
- matrix:
- suite: ${{ fromJSON((inputs.suite == 'full' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'perf:full'))) && '["full"]' || '["basic"]') }}
- concurrency:
- group: performance-${{ github.event_name }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && matrix.suite || 'auto' }}
- cancel-in-progress: true
- runs-on: macos-15
- timeout-minutes: ${{ matrix.suite == 'full' && 45 || 15 }}
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- with:
- path: candidate
- ref: ${{ github.event.pull_request.head.sha || github.sha }}
- persist-credentials: false
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- with:
- path: baseline
- ref: ${{ github.event.pull_request.base.sha || inputs.base }}
- persist-credentials: false
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- with:
- repository: KonghaYao/harness-perf-benchmark
- ref: 8ad1e09f7653d7e97b83b4f5b4d347ca2fa129c7
- path: benchmark
- persist-credentials: false
- - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- with:
- version: 9.12.0
- package_json_file: candidate/package.json
- - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- with:
- node-version: 22.23.2
- package-manager-cache: false
- - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- with:
- bun-version: 1.4.2
- - name: Build baseline
- working-directory: baseline
- run: |
- pnpm install --frozen-lockfile
- pnpm build
- - name: Build candidate
- working-directory: candidate
- run: |
- pnpm install --frozen-lockfile
- pnpm build
- - name: Install pinned benchmark
- working-directory: benchmark
- run: bun install --frozen-lockfile
- - name: Compare on this runner
- env:
- PERF_SUITE: ${{ matrix.suite }}
- run: node candidate/scripts/perf/run.mjs --base baseline --head candidate --benchmark benchmark --suite "$PERF_SUITE" --out "$RUNNER_TEMP/performance"
- - name: Upload performance evidence
- if: ${{ always() }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
- with:
- name: performance-${{ matrix.suite }}-${{ github.run_attempt }}
- path: ${{ runner.temp }}/performance/
- include-hidden-files: true
- retention-days: 14
- if-no-files-found: warn
|