forked from MyFanss/MyFans
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 2.27 KB
/
Copy pathe2e-mock-rpc.yml
File metadata and controls
79 lines (68 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: E2E – Mock Stellar RPC
on:
workflow_dispatch:
jobs:
e2e-mock-rpc:
name: Backend E2E (mock Stellar RPC)
runs-on: ubuntu-latest
timeout-minutes: 20
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: myfans_ci
POSTGRES_PASSWORD: myfans_ci
POSTGRES_DB: myfans_test
ports:
- 5432:5432
options: >
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: myfans_ci
DB_PASSWORD: myfans_ci
DB_NAME: myfans_test
JWT_SECRET: ci-test-secret-not-for-production
WEBHOOK_SECRET: ci-webhook-secret-not-for-production
NODE_ENV: test
STELLAR_NETWORK: testnet
# Point all Soroban RPC calls at the local mock server
SOROBAN_RPC_URL: http://127.0.0.1:8000
MOCK_RPC_PORT: 8000
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '20'
cache: npm
cache-dependency-path: backend/package-lock.json
- name: Install backend dependencies
run: npm ci
working-directory: backend
- name: Start mock Stellar RPC server
run: |
node backend/scripts/mock-stellar-rpc.js &
echo "MOCK_RPC_PID=$!" >> "$GITHUB_ENV"
# Wait until the mock is ready
timeout 15 bash -c 'until curl -sf -X POST http://127.0.0.1:8000 \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"getHealth\",\"params\":{}}" \
| grep -q healthy; do sleep 1; done'
echo "Mock Stellar RPC is ready"
- name: Run backend tests (with mock RPC)
run: npm test
working-directory: backend
- name: Run E2E / integration tests (with mock RPC)
run: npm run test:e2e
working-directory: backend
continue-on-error: false
- name: Stop mock Stellar RPC server
if: always()
run: |
if [ -n "$MOCK_RPC_PID" ]; then
kill "$MOCK_RPC_PID" 2>/dev/null || true
fi