Skip to content

Commit 7164c5d

Browse files
authored
ci: add performance benchmarks (#4998)
1 parent fa1d2b1 commit 7164c5d

40 files changed

+603
-50
lines changed

.github/workflows/edr-benchmark.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: EDR Benchmark
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/edr-benchmark.yml"
9+
- "rust-toolchain"
10+
- "Cargo.lock"
11+
- "Cargo.toml"
12+
- "crates/**"
13+
pull_request:
14+
branches:
15+
- "**"
16+
paths:
17+
- ".github/workflows/edr-benchmark.yml"
18+
- "rust-toolchain"
19+
- "Cargo.lock"
20+
- "Cargo.toml"
21+
- "crates/**"
22+
workflow_dispatch:
23+
24+
defaults:
25+
run:
26+
working-directory: crates/tools/js/benchmark
27+
28+
concurrency:
29+
group: ${{github.workflow}}-${{github.ref}}
30+
cancel-in-progress: true
31+
32+
jobs:
33+
js-benchmark:
34+
name: Run JS scenario runner benchmark
35+
environment: github-action-benchmark
36+
runs-on: self-hosted
37+
# Only run for trusted collaborators since third-parties could run malicious code on the self-hosted benchmark runner.
38+
if: github.ref == 'refs/heads/main' || (github.event.pull_request.author_association == 'OWNER' || github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR')
39+
steps:
40+
- uses: actions/checkout@v3
41+
42+
- uses: pnpm/action-setup@v2
43+
with:
44+
version: 8
45+
- name: Install Node
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: 20
49+
cache: pnpm
50+
51+
- name: Install Rust (stable)
52+
uses: actions-rs/toolchain@v1
53+
with:
54+
profile: minimal
55+
override: true
56+
57+
- name: Install package
58+
run: pnpm install --frozen-lockfile --prefer-offline
59+
60+
- name: Run benchmark
61+
run: pnpm run -s benchmark
62+
63+
- name: Validate regressions
64+
run: pnpm run -s verify
65+
66+
- name: Generate report for github-action-benchmark
67+
run: pnpm run -s report | tee report.json
68+
69+
- name: Store benchmark result
70+
uses: benchmark-action/github-action-benchmark@v1
71+
with:
72+
tool: customSmallerIsBetter
73+
output-file-path: crates/tools/js/benchmark/report.json
74+
gh-repository: github.com/nomic-foundation-automation/edr-benchmark-results
75+
gh-pages-branch: main
76+
benchmark-data-dir-path: bench
77+
github-token: ${{ secrets.BENCHMARK_GITHUB_TOKEN }}
78+
# Only save the data for main branch pushes. For PRs we only compare
79+
auto-push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
80+
alert-threshold: "110%"
81+
# Only fail on pull requests, don't break CI in main
82+
fail-on-alert: ${{ github.event_name == 'pull_request' }}
83+
# Enable Job Summary for PRs
84+
summary-always: true
85+
max-items-in-chart: 1000

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,6 @@ Brewfile.lock.json
114114

115115
# Ipython Notebook
116116
.ipynb_checkpoints
117+
118+
# Benchmark
119+
benchmark-output.json

crates/tools/js/benchmark/README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ pnpm install
99
pnpm run benchmark
1010
```
1111

12-
The measurements will be printed to stdout as machine-readable json and to stderr as human-readable output.
12+
The measurements will be printed to stdout as machine-readable json and to stderr and saved to `./benchmark-output.json` disk as json.
1313

14-
## Grep
15-
16-
It's possible to grep the output to run a specific scenario:
17-
18-
```shell
19-
npm run benchmark -- --grep seaport
20-
```
14+
Please see `pnpm run help` for more.

0 commit comments

Comments
 (0)