mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
benchmark execution time reduced from 15 mins to 12 mins. Time reduction should be more noticeable for large code changes which require longer compile time.
104 lines
3.1 KiB
YAML
104 lines
3.1 KiB
YAML
# Note: macos-latest is too unstable to be useful for benchmark, the variance is always huge.
|
|
|
|
name: Benchmark
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
- '**/*.yml'
|
|
- 'npm/**'
|
|
- 'website/**'
|
|
- 'crates/oxc/**'
|
|
- 'crates/oxc_cli/**'
|
|
- 'crates/oxc_formatter/**'
|
|
- 'crates/oxc_linter/**'
|
|
- 'crates/oxc_napi/**'
|
|
- 'crates/oxc_query/**'
|
|
- 'crates/oxc_resolver/**'
|
|
- 'crates/oxc_type_synthesis/**'
|
|
- 'crates/oxc_wasm/**'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
benchmark_ubuntu:
|
|
name: Benchmark Linux
|
|
uses: ./.github/workflows/reusable_benchmark.yml
|
|
with:
|
|
os: ubuntu-latest
|
|
|
|
benchmark_windows:
|
|
name: Benchmark Windows
|
|
uses: ./.github/workflows/reusable_benchmark.yml
|
|
with:
|
|
os: windows-latest
|
|
|
|
compare:
|
|
runs-on: ubuntu-latest
|
|
name: Compare Benchmarks
|
|
needs: [benchmark_ubuntu, benchmark_windows]
|
|
steps:
|
|
- name: Install critcmp
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: critcmp
|
|
|
|
- name: Linux | Download benchmark results
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: benchmark-results-ubuntu-latest
|
|
path: ./target/criterion
|
|
|
|
- name: Linux | Compare benchmark results
|
|
shell: bash
|
|
run: |
|
|
echo "## Benchmark Results" >> summary.md
|
|
echo "### Linux" >> summary.md
|
|
echo "\`\`\`" >> summary.md
|
|
critcmp main pr >> summary.md
|
|
echo "\`\`\`" >> summary.md
|
|
echo "" >> summary.md
|
|
|
|
- name: Linux | Cleanup benchmark results
|
|
run: rm -rf ./target/criterion
|
|
|
|
- name: Windows | Download PR benchmark results
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: benchmark-results-windows-latest
|
|
path: ./target/criterion
|
|
|
|
- name: Windows | Compare benchmark results
|
|
shell: bash
|
|
run: |
|
|
echo "### Windows" >> summary.md
|
|
echo "\`\`\`" >> summary.md
|
|
critcmp main pr >> summary.md
|
|
echo "\`\`\`" >> summary.md
|
|
echo "" >> summary.md
|
|
cat summary.md > $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Find Comment
|
|
# Check if the event is not triggered by a fork
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
uses: peter-evans/find-comment@v2
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: Benchmark Results
|
|
|
|
- name: Create or update comment
|
|
# Check if the event is not triggered by a fork
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
uses: peter-evans/create-or-update-comment@v2
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
edit-mode: replace
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
body-file: summary.md
|