swc/.github/workflows/bench.yml
OJ Kwon 6f19f8902f
refactor(swc_core): enable bytechecked flag (#5792)
**Description:**

Another update to enable bytecheck rkyv feature flag.

Our dep tree is quite tangled with implicit enable (plugin -> rkyv). PR tries to detach some of it while trying to preserve existing behavior as much as it can.
2022-09-09 08:05:51 +00:00

131 lines
4.0 KiB
YAML

name: Benchmark
on:
- push
- pull_request
env:
RUST_LOG: "off"
jobs:
binary-size:
name: Binary size
if: >-
${{ !contains(github.event.head_commit.message, 'chore: ') }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v1
with:
path: |
./cache
~/.cargo/
target
key: cargo-release-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-release-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build (release)
run: |
yarn
yarn build
- name: Print binary size
run: ls -al ./bindings/target/release/libbinding*
benchmark:
name: Performance regression check
if: >-
${{ !contains(github.event.head_commit.message, 'chore: ') }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v1
with:
path: |
./cache
~/.cargo/
target
key: cargo-bench-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-bench-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
# toolchain: nightly-2021-09-30
override: true
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "yarn"
- name: Install node dependencies
shell: bash
run: |
yarn
- name: Run benchmark
run: cargo bench --workspace --exclude swc_plugin --features plugin_transform_schema_vtest --features rkyv-impl -- --output-format bencher | tee output.txt
- name: Download previous benchmark results
run: mkdir raw-data && curl -o raw-data/benchmark-data.json https://raw.githubusercontent.com/swc-project/raw-data/gh-pages/benchmark-data.json
- name: Analyze benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the output.txt came from
tool: "cargo"
# Where the output from the benchmark tool is stored
output-file-path: output.txt
external-data-json-path: ./raw-data/${{ github.sha }}/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
# Enable alert commit comment
comment-on-alert: true
comment-always: true
skip-fetch-gh-pages: true
- name: Analyze benchmark result (root)
if: ${{ github.event_name == 'push' }}
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the output.txt came from
tool: "cargo"
# Where the output from the benchmark tool is stored
output-file-path: output.txt
external-data-json-path: ./raw-data/benchmark-data.json
# Workflow will fail when an alert happens
# fail-on-alert: true
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
# Enable alert commit comment
comment-on-alert: true
comment-always: true
alert-comment-cc-users: "@kdy1"
skip-fetch-gh-pages: true
max-items-in-chart: 250
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
token: ${{ secrets.GH_TOKEN }}
branch: gh-pages
folder: raw-data
clean: false
single-commit: false
git-config-email: github-bot@swc.rs
repository-name: swc-project/raw-data
commit-message: "Update"