82 lines
2.1 KiB
YAML
82 lines
2.1 KiB
YAML
name: Load Testing
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "scripts/load-test/**"
|
|
- ".github/workflows/load-testing.yml"
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- "scripts/load-test/**"
|
|
- ".github/workflows/load-testing.yml"
|
|
schedule:
|
|
# Run load tests daily at 2 AM UTC
|
|
- cron: "0 2 * * *"
|
|
|
|
concurrency:
|
|
group: load-testing-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: scripts/load-test
|
|
|
|
jobs:
|
|
load-test:
|
|
name: Performance Load Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
cache-dependency-path: scripts/load-test/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run load tests
|
|
run: npm run load-test
|
|
env:
|
|
API_BASE_URL: ${{ secrets.API_BASE_URL || 'https://api.frenocorp.com' }}
|
|
LOAD_TEST_CONCURRENCY: ${{ vars.LOAD_TEST_CONCURRENCY || 10 }}
|
|
LOAD_TEST_DURATION: ${{ vars.LOAD_TEST_DURATION || 60 }}
|
|
|
|
- name: Upload results artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: load-test-results-${{ github.run_id }}
|
|
path: scripts/load-test/reports/
|
|
retention-days: 7
|
|
|
|
performance-baseline:
|
|
name: Performance Baseline Check
|
|
runs-on: ubuntu-latest
|
|
needs: load-test
|
|
if: github.event_name == 'pull_request'
|
|
steps:
|
|
- name: Download results
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: load-test-results-${{ github.run_id }}
|
|
path: scripts/load-test/reports/
|
|
|
|
- name: Compare against baseline
|
|
run: |
|
|
if [ -f "scripts/load-test/reports/baseline.json" ]; then
|
|
echo "Comparing against baseline..."
|
|
# Add comparison logic here
|
|
npm run compare-baseline
|
|
else
|
|
echo "No baseline found, creating initial baseline"
|
|
npm run create-baseline
|
|
fi
|
|
env:
|
|
BASELINE_THRESHOLD: ${{ vars.BASELINE_THRESHOLD || 0.1 }}
|