-
Notifications
You must be signed in to change notification settings - Fork 173
146 lines (124 loc) · 3.78 KB
/
Copy pathplaywright-e2e.yml
File metadata and controls
146 lines (124 loc) · 3.78 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Playwright E2E Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
playwright:
name: Playwright E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
services:
# Redis service for backend caching
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- name: Install root dependencies
run: npm ci
- name: Install backend dependencies
working-directory: backend
run: npm ci
- name: Install frontend dependencies
working-directory: frontend
run: npm ci
- name: Build backend
working-directory: backend
run: npm run build
- name: Build frontend
working-directory: frontend
run: npm run build
- name: Create backend .env for CI
working-directory: backend
run: |
cat > .env << 'EOF'
PORT=3001
LOG_LEVEL=info
NODE_ENV=test
CONTRACT_ID=CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5V3NN
ALLOWED_ASSETS=USDC,XLM,ARS
ALLOWED_ORIGINS=http://localhost:3000
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org:443
SOROBAN_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
CONTRACT_AMOUNT_DECIMALS=2
DEFAULT_MAX_PER_CONTRIBUTOR=0
REDIS_URL=redis://redis:6379
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Start services with docker-compose
run: |
docker-compose up -d
echo "Waiting for services to be healthy..."
# Wait for backend to be healthy
for i in {1..60}; do
if curl -f http://localhost:3001/api/health > /dev/null 2>&1; then
echo "Backend is healthy"
break
fi
echo "Waiting for backend... (attempt $i/60)"
sleep 2
done
# Wait for frontend to be healthy
for i in {1..60}; do
if curl -f http://localhost:3000 > /dev/null 2>&1; then
echo "Frontend is healthy"
break
fi
echo "Waiting for frontend... (attempt $i/60)"
sleep 2
done
env:
REDIS_URL: redis://redis:6379
VITE_API_URL: http://localhost:3001/api
- name: Install Playwright browsers
run: npx playwright install chromium
- name: Run Playwright tests
run: npm run test:e2e
env:
CI: true
- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Upload test videos on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-videos
path: test-results/
retention-days: 7
- name: Stop services
if: always()
run: docker-compose down -v
- name: Collect docker logs on failure
if: failure()
run: |
mkdir -p docker-logs
docker-compose logs > docker-logs/docker-compose.log 2>&1 || true
- name: Upload docker logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: docker-logs
path: docker-logs/
retention-days: 7