Skip to content

Performance tests

Performance tests #537

Workflow file for this run

name: 'Performance tests'
on:
schedule:
- cron: '0 2-23/4 * * *'
push:
branches: [main]
workflow_dispatch:
inputs:
sendReport:
description: 'Whether to send the stats to the Datadog dashboards'
required: true
default: 'false'
hyperfineOptions:
description: 'Options passed to Hyperfine'
required: false
default: ''
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: 'Building the benchmark binary'
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Build the repository
uses: ./.github/actions/build
with:
target: x86_64-unknown-linux-musl
profile: release-lto
- name: Store the build artifacts
uses: actions/upload-artifact@v4
with:
name: benchmark-binary
path: target/x86_64-unknown-linux-musl/release-lto
benchmark:
strategy:
matrix:
benchmark:
- [Next.js, next]
- [Gatsby, gatsby]
- [Monorepo, monorepo]
needs: [build]
name: 'Running the ${{matrix.benchmark[0]}} benchmark'
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Install Yarn Switch
uses: yarnpkg/setup-action@main
- uses: actions/download-artifact@v4
with:
name: benchmark-binary
path: local
- name: Set the +x flag on the binaries
run: |
chmod +x local/{yarn,yarn-bin}
- name: Install Flamegraph
run: |
cargo install flamegraph@0.6.9
- name: Install Hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.10.0/hyperfine_1.10.0_amd64.deb
sudo dpkg -i hyperfine_1.10.0_amd64.deb
- name: 'Creates a temporary directory'
run: |
BENCH_DIR=$(mktemp -d)
echo "BENCH_DIR=$BENCH_DIR" >> "$GITHUB_ENV"
- name: Prepare Node
uses: ./.github/actions/prepare-node
- name: 'Run the performance test'
run: |
bash scripts/bench-run.sh zpm ${{matrix.benchmark[1]}} hyperfine "$BENCH_DIR" || true
if [[ '${{github.event.inputs.sendReport}}' != 'false' ]]; then
yarn node scripts/submit-bench-data.js zpm ${{matrix.benchmark[1]}} "$BENCH_DIR"
fi
env:
DD_API_KEY: ${{secrets.DD_API_KEY}}
HYPERFINE_OPTIONS: ${{github.event.inputs.hyperfineOptions}}