-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new workflow to compare performance
- Loading branch information
1 parent
c4f28d1
commit 5bc341b
Showing
1 changed file
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: Benchmark | ||
|
||
# only one can tun at a time. | ||
# Actions access a common cache entry and may corrupt it. | ||
concurrency: cd-benchmark-compare-${{ github.ref }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
nodejs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# Get the entire git history to walk commit history on head branch | ||
fetch-depth: 0 | ||
# Do not checkout merge commit | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Run performance tests on node | ||
run: yarn benchmark --local ./nodejs --noThrow ${{ github.event_name == 'push' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Archive nodejs benchmark artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: nodejs-benchmark | ||
path: nodejs | ||
|
||
bun: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install Dependencies | ||
run: bun install | ||
|
||
- name: Run performance tests on bun | ||
run: bun run --bun benchmark --local ./bun --noThrow ${{ github.event_name == 'push' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Archive bun benchmark artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bun-benchmark | ||
path: bun | ||
|
||
deno: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- uses: denoland/setup-deno@v2 | ||
with: | ||
deno-version: v2.x | ||
|
||
- name: Install Dependencies | ||
run: deno install | ||
|
||
- name: Run performance tests on bun | ||
run: deno run -A benchmark --local ./deno --noThrow ${{ github.event_name == 'push' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Archive deno benchmark artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: deno-benchmark | ||
path: deno | ||
|
||
compare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Download all benchmark artifacts | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: Run comparison | ||
run: node --loader ts-node/esm ./src/cli/cli.ts cmp nodejs-benchmark deno-benchmark bun-benchmark |