forked from swc-project/swc
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (114 loc) · 4 KB
/
bench.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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 -- --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/[email protected]
with:
token: ${{ secrets.GH_TOKEN }}
branch: gh-pages
folder: raw-data
clean: false
single-commit: false
git-config-email: [email protected]
repository-name: swc-project/raw-data
commit-message: "Update"