2021-04-30 09:25:24 +03:00
|
|
|
name: Benchmark
|
|
|
|
|
|
|
|
on:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
jobs:
|
2021-06-23 13:50:27 +03:00
|
|
|
binary-size:
|
|
|
|
name: Binary size
|
2022-02-27 09:27:15 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2021-04-30 09:25:24 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
./cache
|
|
|
|
~/.cargo/
|
|
|
|
target
|
2021-10-28 05:55:49 +03:00
|
|
|
key: cargo-release-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
cargo-release-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
2021-06-23 13:50:27 +03:00
|
|
|
- name: Build (release)
|
|
|
|
run: |
|
2021-10-28 05:55:49 +03:00
|
|
|
yarn
|
|
|
|
yarn build
|
2021-06-23 13:50:27 +03:00
|
|
|
|
|
|
|
- name: Print binary size
|
|
|
|
run: ls -al ./target/release/libnode*
|
2021-04-30 09:25:24 +03:00
|
|
|
|
|
|
|
benchmark:
|
|
|
|
name: Performance regression check
|
2022-02-27 09:27:15 +03:00
|
|
|
if: >-
|
|
|
|
${{ !contains(github.event.head_commit.message, 'chore: ') }}
|
2021-04-30 09:25:24 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
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-03-12 12:33:32 +03:00
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
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-03-12 04:52:53 +03:00
|
|
|
run: cargo bench --workspace --exclude swc_plugin --exclude wasm --exclude swc_cli --exclude node | 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
|
|
|
|
alert-comment-cc-users: "@kdy1"
|
|
|
|
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"
|