1+ name : Performance Tests
2+
3+ on :
4+ push :
5+ branches : [main, develop]
6+ pull_request :
7+ branches : [main, develop]
8+ schedule :
9+ # Run performance tests daily at 2 AM UTC
10+ - cron : ' 0 2 * * *'
11+ workflow_dispatch :
12+
13+ concurrency :
14+ group : performance-${{ github.ref }}
15+ cancel-in-progress : true
16+
17+ jobs :
18+ performance-tests :
19+ name : Performance Test Suite
20+ runs-on : ubuntu-latest
21+ services :
22+ postgres :
23+ image : postgres:15
24+ env :
25+ POSTGRES_DB : stellar_escrow
26+ POSTGRES_USER : indexer
27+ POSTGRES_PASSWORD : password
28+ options : >-
29+ --health-cmd pg_isready
30+ --health-interval 10s
31+ --health-timeout 5s
32+ --health-retries 5
33+ ports :
34+ - 5432:5432
35+
36+ redis :
37+ image : redis:7-alpine
38+ ports :
39+ - 6379:6379
40+
41+ steps :
42+ - uses : actions/checkout@v4
43+
44+ - name : Setup Node.js
45+ uses : actions/setup-node@v4
46+ with :
47+ node-version : ' 20'
48+ cache : ' npm'
49+
50+ - name : Install Rust
51+ uses : dtolnay/rust-toolchain@stable
52+
53+ - uses : Swatinem/rust-cache@v2
54+
55+ - name : Install dependencies
56+ run : npm ci
57+
58+ - name : Build API
59+ run : npm run build --workspace=api
60+
61+ - name : Start test services
62+ run : |
63+ docker-compose -f docker-compose.dev.yml up -d postgres redis
64+ timeout 60 bash -c 'until pg_isready -h localhost -p 5432; do sleep 1; done'
65+
66+ - name : Run database migrations
67+ run : |
68+ cd indexer
69+ cargo run --bin migrate
70+
71+ - name : Start API server
72+ run : |
73+ npm run gateway --workspace=api &
74+ timeout 30 bash -c 'until curl -f http://localhost:3000/health; do sleep 1; done'
75+
76+ - name : Install Artillery
77+ run : npm install -g artillery
78+
79+ - name : Run Jest performance tests
80+ run : npm run test:performance --workspace=api
81+
82+ - name : Run Artillery load tests
83+ run : artillery run tests/load/load-test.yml --output reports/load-test.json
84+
85+ - name : Run Artillery stress tests
86+ run : artillery run tests/load/stress-test.yml --output reports/stress-test.json
87+
88+ - name : Run Artillery spike tests
89+ run : artillery run tests/load/spike-test.yml --output reports/spike-test.json
90+
91+ - name : Run smart contract performance tests
92+ run : ./scripts/stress-test.sh
93+
94+ - name : Generate performance report
95+ run : |
96+ mkdir -p reports/performance
97+ node scripts/performance-test-runner.js
98+
99+ - name : Upload performance reports
100+ uses : actions/upload-artifact@v4
101+ if : always()
102+ with :
103+ name : performance-reports
104+ path : |
105+ reports/
106+ contract/coverage/
107+
108+ - name : Performance regression check
109+ run : |
110+ # Check if performance metrics are within acceptable ranges
111+ # This would compare against baseline metrics stored as artifacts
112+ echo "Performance regression check would go here"
113+
114+ - name : Notify on performance degradation
115+ if : failure()
116+ run : |
117+ echo "Performance tests failed - check artifacts for details"
118+ # In a real setup, this would send notifications to Slack/Discord
0 commit comments