mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 11:11:30 +03:00
105 lines
3.4 KiB
YAML
105 lines
3.4 KiB
YAML
name: Benchmark
|
|
|
|
on:
|
|
pull_request:
|
|
types: ["opened", "reopened", "synchronize"]
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
RUST_LOG: "off"
|
|
|
|
jobs:
|
|
benchmark:
|
|
name: Performance regression check
|
|
if: >-
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') && github.repository_owner == 'swc-project' && github.ref == 'refs/heads/main' }}
|
|
runs-on: ubuntu-large
|
|
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 --sample-size 10 | 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"
|