From 5387b4987fa8f2ab17f8d449b402f68f917bb7f6 Mon Sep 17 00:00:00 2001 From: hrmny <8845940+ForsakenHarmony@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:59:40 +0200 Subject: [PATCH] bench: use bencher for continuous benchmarking --- .github/workflows/bench-turbopack.yml | 89 +++++++++++++++++++ .../test-turbopack-rust-bench-test.yml | 2 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bench-turbopack.yml diff --git a/.github/workflows/bench-turbopack.yml b/.github/workflows/bench-turbopack.yml new file mode 100644 index 00000000000000..6393c008abeeee --- /dev/null +++ b/.github/workflows/bench-turbopack.yml @@ -0,0 +1,89 @@ +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@v3 + + - 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' + 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 --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, '/') }} + run: bencher run --err "cargo bench --workspace --exclude turbopack-bench" diff --git a/.github/workflows/test-turbopack-rust-bench-test.yml b/.github/workflows/test-turbopack-rust-bench-test.yml index 2751e68db29264..6cbbf3cd25b90b 100644 --- a/.github/workflows/test-turbopack-rust-bench-test.yml +++ b/.github/workflows/test-turbopack-rust-bench-test.yml @@ -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