-
Notifications
You must be signed in to change notification settings - Fork 361
150 lines (127 loc) · 3.55 KB
/
Copy pathe2e-tests.yml
File metadata and controls
150 lines (127 loc) · 3.55 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
147
148
149
150
name: E2E Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: whatomate_test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Create test config
run: |
cat > config.toml << 'EOF'
[app]
name = "Whatomate"
environment = "test"
debug = true
[server]
host = "0.0.0.0"
port = 8080
read_timeout = 30
write_timeout = 30
base_path = ""
[database]
host = "localhost"
port = 5432
user = "test"
password = "test"
name = "whatomate_test"
ssl_mode = "disable"
max_open_conns = 25
max_idle_conns = 5
conn_max_lifetime = 300
[redis]
host = "localhost"
port = 6379
username = ""
password = ""
db = 0
tls = false
[jwt]
secret = "test-secret-key-for-ci"
access_expiry_mins = 60
refresh_expiry_days = 7
[storage]
type = "local"
local_path = "./uploads"
EOF
# Build frontend FIRST so it can be embedded in the backend
- name: Install frontend dependencies
run: cd frontend && npm ci
- name: Build frontend
run: cd frontend && npm run build
- name: Copy frontend to embed directory
run: |
rm -rf internal/frontend/dist/*
cp -r frontend/dist/* internal/frontend/dist/
- name: Build backend
run: go build -o whatomate ./cmd/whatomate
- name: Start backend with migrations
run: |
./whatomate server -migrate &
sleep 10
# Verify server is running
curl -f http://localhost:8080/health || exit 1
env:
WHATOMATE_CONFIG: config.toml
- name: Install Playwright browsers
run: cd frontend && npx playwright install chromium --with-deps
- name: Run E2E tests
run: cd frontend && npm run test:e2e
env:
BASE_URL: http://localhost:8080
TEST_DATABASE_URL: postgres://test:test@127.0.0.1:5432/whatomate_test
CI: true
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 7
- name: Upload test screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-screenshots
path: frontend/test-results/
retention-days: 7