Skip to content

Commit

Permalink
bench: use bencher for continuous benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Sep 27, 2024
1 parent fb15ee9 commit cad34f5
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
97 changes: 97 additions & 0 deletions .github/workflows/bench-turbopack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Benchmark Turbopack
on:
push:
branches: [canary]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
actions: write
contents: read
pull-requests: read

jobs:
turbopack_rust_check:
name: Turbopack rust check
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
targets: wasm32-unknown-unknown

- name: Run cargo check release
run: |
RUSTFLAGS="-D warnings -A deprecated" cargo check --workspace --all-targets --features rustls-tls --release
turbopack_bench_pr:
needs: [turbopack_rust_check]
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
name: Benchmark and compare Turbopack performance on ${{ matrix.os.title }}
strategy:
fail-fast: false
matrix:
os:
- name: linux
title: Linux
quiet: false
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'

runs-on: ${{ matrix.os.runs-on }}
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

# - name: Fetch the base branch
# run: git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --depth=1 origin +${{ github.base_ref }}:base

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
check-latest: true

- run: node -v
- run: corepack enable

- name: Setup Rust
uses: ./.github/actions/setup-rust

- uses: bencherdev/bencher@main

- name: Build the benchmark target(s)
run: cargo bench --workspace --exclude turbopack-bench --exclude next-swc-napi --exclude wasm --no-run

- name: Run the benchmarks
env:
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
BENCHER_PROJECT: 06b087de-c9ba-48ec-b909-ad9f69e97537
BENCHER_TESTBED: ${{ join(matrix.os.runs-on, '/') }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bencher run \
--branch '${{ github.head_ref }}' \
--branch-start-point '${{ github.base_ref }}' \
--branch-start-point-hash '${{ github.event.pull_request.base.sha }}' \
--branch-reset \
--err \
"cargo bench --workspace --exclude turbopack-bench --exclude next-swc-napi --exclude wasm"
2 changes: 1 addition & 1 deletion .github/workflows/test-turbopack-rust-bench-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
if: inputs.os == 'windows'

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Rust
uses: ./.github/actions/setup-rust
Expand Down

0 comments on commit cad34f5

Please sign in to comment.