Skip to content

Merge pull request #516 from nanaf6203-bit/main #1

Merge pull request #516 from nanaf6203-bit/main

Merge pull request #516 from nanaf6203-bit/main #1

Workflow file for this run

name: Performance Benchmarks
on:
push:
branches: [main]
workflow_dispatch:
jobs:
sla-benchmarks:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nexafx_test
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-retries 5
redis:
image: redis:7
ports: ['6379:6379']
options: --health-cmd "redis-cli ping" --health-interval 10s --health-retries 5
env:
NODE_ENV: test
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: nexafx_test
REDIS_URL: redis://localhost:6379
JWT_SECRET: test-jwt-secret
DISABLE_BULL: 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci --legacy-peer-deps
- name: Start application
run: npm run start:prod &
env:
PORT: 3000
- name: Wait for app to be ready
run: npx wait-on http://localhost:3000/health --timeout 30000
- name: Install k6
run: |
curl https://github.com/grafana/k6/releases/download/v0.50.0/k6-v0.50.0-linux-amd64.tar.gz -L | tar xvz
sudo mv k6-v0.50.0-linux-amd64/k6 /usr/local/bin/
- name: Run SLA benchmarks
run: k6 run test/performance/sla-benchmarks.js
env:
BASE_URL: http://localhost:3000
TRANSACTION_P99_MS: '200'
BALANCE_P99_MS: '50'
FX_RATE_P99_MS: '100'
FX_CONVERT_P99_MS: '300'
- name: Upload benchmark results
uses: actions/upload-artifact@v4
if: always()
with:
name: benchmark-results-${{ github.sha }}
path: test/performance/results.json