chore: add performance benchmark with hyperfine #10
Workflow file for this run
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: Performance Benchmark | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
hyperfine: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
npm-${{ hashFiles('package-lock.json') }} | |
npm- | |
- name: Environments | |
run: | | |
echo | |
echo Using Node $(node -v), NPM $(npm -v) | |
echo | |
- name: Install Dependencies | |
run: npm ci | |
- name: Install External | |
run: npm i -g hyperfine @redocly/cli@1.0.0-beta.100 | |
- name: Prepare | |
run: | | |
jq '.bin = {"redocly-next":"bin/cli.js"} | .name = "@redocly/cli-next"' packages/cli/package.json > __tmp__.json | |
mv __tmp__.json packages/cli/package.json | |
cat packages/cli/package.json | |
npm run pack:prepare | |
npm i -g redocly-cli.tgz | |
- run: redocly-next --version | |
- run: redocly --version | |
- name: Run Benchmark | |
run: hyperfine -i --warmup 3 'redocly lint packages/core/src/benchmark/benches/rebilly.yaml' 'redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml' --export-markdown benchmark_check.md | |
- name: Comment PR | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
filePath: benchmark_check.md |