2021-04-30 09:25:24 +03:00
|
|
|
name: Benchmark
|
|
|
|
|
|
|
|
on:
|
2022-11-21 07:17:02 +03:00
|
|
|
pull_request:
|
2022-12-08 05:05:53 +03:00
|
|
|
types: ["opened", "reopened", "synchronize"]
|
2022-11-21 07:17:02 +03:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2021-04-30 09:25:24 +03:00
|
|
|
|
2022-04-04 14:12:03 +03:00
|
|
|
env:
|
|
|
|
RUST_LOG: "off"
|
|
|
|
|
2021-04-30 09:25:24 +03:00
|
|
|
jobs:
|
|
|
|
benchmark:
|
|
|
|
name: Performance regression check
|
2022-02-27 09:27:15 +03:00
|
|
|
if: >-
|
2022-12-08 05:05:53 +03:00
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') && github.repository_owner == 'swc-project' && github.ref == 'refs/heads/main' }}
|
|
|
|
runs-on: ubuntu-large
|
2021-04-30 09:25:24 +03:00
|
|
|
steps:
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-28 05:55:49 +03:00
|
|
|
|
2021-04-30 09:25:24 +03:00
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
./cache
|
|
|
|
~/.cargo/
|
|
|
|
target
|
2021-10-28 05:55:49 +03:00
|
|
|
key: cargo-bench-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
cargo-bench-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
2021-11-15 18:38:03 +03:00
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-02-28 10:12:28 +03:00
|
|
|
# toolchain: nightly-2021-09-30
|
2021-12-07 08:34:16 +03:00
|
|
|
override: true
|
2021-11-15 18:38:03 +03:00
|
|
|
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2022-03-12 12:33:32 +03:00
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- name: Install node dependencies
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yarn
|
|
|
|
|
2021-04-30 09:25:24 +03:00
|
|
|
- name: Run benchmark
|
2022-12-08 05:05:53 +03:00
|
|
|
run: cargo bench --workspace --exclude swc_plugin --features plugin_transform_schema_vtest --features rkyv-impl -- --output-format bencher --sample-size 10 | tee output.txt
|
2021-06-23 13:50:27 +03:00
|
|
|
|
2021-10-18 10:54:23 +03:00
|
|
|
- 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
|
|
|
|
|
2021-06-23 13:50:27 +03:00
|
|
|
- name: Analyze benchmark result
|
2021-12-29 19:12:15 +03:00
|
|
|
uses: benchmark-action/github-action-benchmark@v1
|
2021-04-30 09:25:24 +03:00
|
|
|
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
|
2021-06-25 11:19:15 +03:00
|
|
|
external-data-json-path: ./raw-data/${{ github.sha }}/benchmark-data.json
|
2021-04-30 09:25:24 +03:00
|
|
|
# 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
|
2021-06-23 13:50:27 +03:00
|
|
|
comment-always: true
|
|
|
|
skip-fetch-gh-pages: true
|
|
|
|
|
2021-10-18 10:54:23 +03:00
|
|
|
- name: Analyze benchmark result (root)
|
2021-10-29 09:11:00 +03:00
|
|
|
if: ${{ github.event_name == 'push' }}
|
2021-12-29 19:12:15 +03:00
|
|
|
uses: benchmark-action/github-action-benchmark@v1
|
2021-10-18 10:54:23 +03:00
|
|
|
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
|
2021-10-19 22:01:30 +03:00
|
|
|
# fail-on-alert: true
|
2021-10-18 10:54:23 +03:00
|
|
|
# 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
|
2021-10-26 10:23:34 +03:00
|
|
|
max-items-in-chart: 250
|
2021-10-18 10:54:23 +03:00
|
|
|
|
2021-06-23 13:50:27 +03:00
|
|
|
- name: Deploy
|
2021-11-15 10:52:45 +03:00
|
|
|
if: github.ref == 'refs/heads/main'
|
2021-06-23 13:50:27 +03:00
|
|
|
uses: JamesIves/github-pages-deploy-action@4.1.0
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
|
|
branch: gh-pages
|
|
|
|
folder: raw-data
|
2021-06-24 11:01:21 +03:00
|
|
|
clean: false
|
|
|
|
single-commit: false
|
2021-06-24 09:32:09 +03:00
|
|
|
git-config-email: github-bot@swc.rs
|
2021-06-23 13:50:27 +03:00
|
|
|
repository-name: swc-project/raw-data
|
|
|
|
commit-message: "Update"
|