Skip to content

feat: API benchmark suite for #30 #37

feat: API benchmark suite for #30

feat: API benchmark suite for #30 #37

Workflow file for this run

name: API Benchmark
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
npm install
npm install -g autocannon
- name: Install API dependencies
run: |
cd apps/api
npm install
- name: Start API server
run: |
cd apps/api
npm run dev &
sleep 5
- name: Run benchmarks
run: |
node benchmarks/run.js || true
- name: Check thresholds
run: |
node benchmarks/run.js
- name: Upload benchmark results
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmarks/results/
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const summary = fs.readFileSync('benchmarks/results/summary.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '## Benchmark Results\n\n' + summary
});