Skip to content

Commit

Permalink
chore: add home-cooked “continuous benchmarking”
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Aug 12, 2024
1 parent d6ab3af commit b81a328
Show file tree
Hide file tree
Showing 17 changed files with 2,463 additions and 298 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/bench-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Benchmark Main Branch

on:
push:
branches: [main]
paths:
- 'src/**/*.ts'

jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm

- name: Install dependencies
run: |
pnpm install -C scripts/benchmarks
pnpm install -C scripts/radashi-db
- uses: awalsh128/[email protected]
with:
packages: valgrind
version: 1 # The “cache version” for cache-busting

- name: Run benchmarks
env:
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
# https://pythonspeed.com/articles/consistent-benchmarking-in-ci/
valgrind --tool=cachegrind ./scripts/benchmarks/node_modules/.bin/tsx ./scripts/benchmarks/ci-bench-main.ts
39 changes: 39 additions & 0 deletions .github/workflows/bench-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Benchmark Pull Request

on:
pull_request:
branches: [main, next]
paths:
- 'src/**/*.ts'

jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm

- name: Install dependencies
run: |
pnpm install -C scripts/benchmarks
pnpm install -C scripts/radashi-db
- uses: awalsh128/[email protected]
with:
packages: valgrind
version: 1 # The “cache version” for cache-busting

- name: Run benchmarks
env:
RADASHI_BOT_TOKEN: ${{ secrets.RADASHI_BOT_TOKEN }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
# https://pythonspeed.com/articles/consistent-benchmarking-in-ci/
valgrind --tool=cachegrind ./scripts/benchmarks/node_modules/.bin/tsx ./scripts/benchmarks/ci-bench-pr.ts ${{ github.base_ref }} ${{ github.event.number }}
27 changes: 0 additions & 27 deletions .github/workflows/codspeed.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/seed-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Seed Benchmarks

on:
workflow_dispatch:

jobs:
seed-benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm

- name: Install dependencies
run: |
pnpm install -C scripts/benchmarks
pnpm install -C scripts/radashi-db
- uses: awalsh128/[email protected]
with:
packages: valgrind
version: 1 # The “cache version” for cache-busting

- name: Run benchmarks and seed database
env:
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
# https://pythonspeed.com/articles/consistent-benchmarking-in-ci/
valgrind --tool=cachegrind ./scripts/benchmarks/node_modules/.bin/tsx ./scripts/benchmarks/seed-benchmarks.ts
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@codspeed/vitest-plugin": "^3.1.0",
"@typescript-eslint/parser": "^7.16.1",
"@vitest/coverage-v8": "2.0.3",
"concurrently": "^8.2.2",
Expand All @@ -60,16 +59,11 @@
"prettier-plugin-sh": "^0.14.0",
"tsup": "^8.1.0",
"typescript": "^5.5.2",
"vitest": "2.0.2"
"vitest": "2.0.5"
},
"sideEffects": false,
"browserslist": [
">0.1% and not dead",
"node >= 16"
],
"pnpm": {
"patchedDependencies": {
"@codspeed/[email protected]": "patches/@[email protected]"
}
}
]
}
16 changes: 0 additions & 16 deletions patches/@[email protected]

This file was deleted.

Loading

0 comments on commit b81a328

Please sign in to comment.