Pull Request #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request | |
on: | |
workflow_dispatch: | |
inputs: | |
pull_number: | |
description: Pull Request number to run benchmark (e.g. 12512) | |
required: true | |
type: string | |
repeats: | |
description: number of benchmark repeats | |
required: true | |
type: string | |
default: '50' | |
os: | |
description: os matrix, comma separated, could be 'Linux' | 'Windows' | 'macOS' | |
required: false | |
type: string | |
default: Linux | |
jobs: | |
benchmark: | |
name: Run benchmark | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/github-script@v6 | |
id: os | |
with: | |
script: | | |
const runnerOS = process.env.RUNNER_OS; | |
if(!context.payload.inputs.os.split(',').map(os => os.trim()).includes(runnerOS)) { | |
core.summary.addHeading('Skipping benchmark on ${{ matrix.os }}', 6) | |
await core.summary.write() | |
core.setOutput('os_skip', 'true') | |
} | |
- uses: actions/checkout@v3 | |
if: ${{ steps.os.outputs.os_skip != 'true' }} | |
- uses: pnpm/action-setup@v2 | |
if: ${{ steps.os.outputs.os_skip != 'true' }} | |
- uses: actions/setup-node@v3 | |
if: ${{ steps.os.outputs.os_skip != 'true' }} | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: Install dependencies | |
if: ${{ steps.os.outputs.os_skip != 'true' }} | |
env: | |
PLAYWRIGHT_BROWSERS_PATH: 0 | |
run: | | |
pnpm run bootstrap | |
cd runner | |
pnpm playwright install chromium | |
- name: Run benchmark | |
if: ${{ steps.os.outputs.os_skip != 'true' }} | |
id: run_benchmark | |
env: | |
PLAYWRIGHT_BROWSERS_PATH: 0 | |
run: | | |
cd runner | |
pnpm tsx src/cli.ts bench --pull-number="${{ inputs.pull_number }}" --repeats="${{ inputs.repeats }}" |