swc/.github/workflows/bench.yml
2024-07-10 15:20:27 +09:00

109 lines
2.7 KiB
YAML

name: Benchmark
on:
push:
branches:
- main
pull_request:
types: ["opened", "reopened", "synchronize"]
concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CI: 1
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: "always"
DIFF: 0
# For faster CI
RUST_LOG: "off"
# https://github.com/swc-project/swc/pull/3742
RUST_MIN_STACK: 4194304
# https://github.com/actions/setup-node/issues/899#issuecomment-1819151595
SKIP_YARN_COREPACK_CHECK: 1
jobs:
# list-crates:
# if: >-
# ${{ !contains(github.event.head_commit.message, 'chore: ') }}
# name: List crates
# runs-on: ubuntu-latest
# outputs:
# crates: ${{ steps.list-crates.outputs.crates }}
# steps:
# - uses: actions/checkout@v4
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# - name: List crates
# id: list-crates
# run: echo "crates=$(./scripts/cargo/get-crates.sh)" >> $GITHUB_OUTPUT
# bench-crate:
# name: Bench ${{ matrix.crate }}
# runs-on: ubuntu-latest
# needs:
# - list-crates
# strategy:
# fail-fast: false
# matrix:
# crate: ${{fromJson(needs.list-crates.outputs.crates)}}
# steps:
# - uses: actions/checkout@v4
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# - uses: ./.github/actions/setup-node
# - name: Setup rust toolchain, cache and cargo-codspeed binary
# uses: moonrepo/setup-rust@v0
# with:
# channel: stable
# cache-target: release
# bins: cargo-codspeed
# - name: Build the benchmark target(s)
# run: cargo codspeed build -p ${{ matrix.crate }}
# - name: Run the benchmarks
# uses: CodSpeedHQ/action@v2
# with:
# run: cargo codspeed run -p ${{ matrix.crate }}
# token: ${{ secrets.CODSPEED_TOKEN }}
bench-all:
name: Bench everything
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
- uses: ./.github/actions/setup-node
- name: Setup rust toolchain, cache and cargo-codspeed binary
uses: moonrepo/setup-rust@v0
with:
channel: stable
cache-target: release
bins: cargo-codspeed
- name: Build the benchmark target(s)
run: cargo codspeed build
- name: Run the benchmarks
uses: CodSpeedHQ/action@v2
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}