-
Notifications
You must be signed in to change notification settings - Fork 7
287 lines (243 loc) · 9.43 KB
/
e2e-infrastructure.yml
File metadata and controls
287 lines (243 loc) · 9.43 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: Infrastructure E2E
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "47 6 * * *"
workflow_dispatch:
concurrency:
group: infra-e2e-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker-compose-smoke:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Prepare docker secret placeholders
run: |
mkdir -p docker/secrets
printf 'ci-openrouter-placeholder\n' > docker/secrets/openrouter_api_key
- name: Start docker-compose smoke stack
run: docker compose -f docker/docker-compose.yml up -d --build redis massive-game-server
- name: Wait for healthz and readyz
run: |
set -euo pipefail
for _ in $(seq 1 90); do
if curl -fsS http://127.0.0.1:8080/healthz >/dev/null 2>&1 \
&& curl -fsS http://127.0.0.1:8080/readyz >/dev/null 2>&1; then
exit 0
fi
sleep 2
done
echo "docker-compose smoke stack did not become ready" >&2
exit 1
- name: Verify Node runtime
run: |
node --version
npm --version
- name: Install Playwright dependencies
working-directory: scripts/e2e
run: npm ci
- name: Install Playwright browser
working-directory: scripts/e2e
run: npx playwright install --with-deps chromium
- name: Run compose-backed gameplay smoke
working-directory: scripts/e2e
env:
E2E_SERVER_SKIP: "1"
E2E_BASE_URL: http://127.0.0.1:8080
E2E_WS_URL: ws://127.0.0.1:8080/ws
run: |
npx playwright test \
tests/connect.spec.js \
tests/runtime.spec.js \
tests/human_gameplay_journey.spec.js \
tests/pickup_zone_live.spec.js \
--workers=1 \
--reporter=list
- name: Capture compose logs on failure
if: failure()
run: docker compose -f docker/docker-compose.yml logs --no-color > /tmp/mgs_docker_compose_smoke.log
- name: Upload compose smoke artifacts on failure
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: docker-compose-smoke-artifacts
path: |
/tmp/mgs_docker_compose_smoke.log
scripts/e2e/test-results
scripts/e2e/playwright-report
- name: Tear down docker-compose smoke stack
if: always()
run: docker compose -f docker/docker-compose.yml down -v
auth-e2e:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
CARGO_TERM_COLOR: always
E2E_BASE_URL: http://127.0.0.1:19080
E2E_WS_URL: ws://127.0.0.1:19080/ws
E2E_SERVER_CMD: ./target/debug/massive_game_server_core
E2E_SERVER_START_TIMEOUT_MS: "480000"
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
with:
toolchain: stable
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5
- name: Install FlatBuffers compiler
run: scripts/install_flatc.sh
- name: Build debug server binary
run: cargo build -p massive_game_server_core --bin massive_game_server_core --locked
- name: Run Rust auth lifecycle integration test
run: cargo test -p massive_game_server_core --locked --test auth_e2e -- --nocapture
- name: Verify Node runtime
run: |
node --version
npm --version
- name: Install Playwright dependencies
working-directory: scripts/e2e
run: npm ci
- name: Install Playwright browser
working-directory: scripts/e2e
run: npx playwright install --with-deps chromium
- name: Run browser auth flow E2E
working-directory: scripts/e2e
run: |
npx playwright test \
tests/auth_flow.spec.js \
tests/auth_session_expiry.spec.js \
--workers=1 \
--reporter=list
- name: Upload auth E2E artifacts on failure
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: auth-e2e-artifacts
path: |
scripts/e2e/test-results
scripts/e2e/playwright-report
redis-failover-smoke:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
CARGO_TERM_COLOR: always
REDIS_FAILOVER_PORT: "19081"
REDIS_FAILOVER_CONTAINER: mgs-redis-failover
REDIS_FAILOVER_PASSWORD: mgs_redis_dev_password
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
with:
toolchain: stable
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5
- name: Install FlatBuffers compiler
run: scripts/install_flatc.sh
- name: Build debug server binary
run: cargo build -p massive_game_server_core --bin massive_game_server_core --locked
- name: Start Redis failover fixture
run: |
docker run -d \
--name "${REDIS_FAILOVER_CONTAINER}" \
-p 16379:6379 \
redis:7-alpine \
redis-server --appendonly yes --requirepass "${REDIS_FAILOVER_PASSWORD}"
- name: Run Redis failover smoke
run: |
set -euo pipefail
data_root=/tmp/mgs_redis_failover
rm -rf "${data_root}"
mkdir -p "${data_root}/arena_wasm" "${data_root}/arena_sources"
MGS_HOST=127.0.0.1 \
MGS_PORT="${REDIS_FAILOVER_PORT}" \
MGS_DISABLE_STUN=1 \
MGS_TARGET_BOT_COUNT=0 \
MGS_DIAGNOSTICS_ENABLED=0 \
MGS_QUIC_PRIMARY=0 \
MGS_SMS_COMMAND="$PWD/scripts/test_support/capture_sms.sh" \
MGS_TEST_SMS_CAPTURE_PATH="${data_root}/otp.txt" \
MGS_AUTH_STORE_PATH="${data_root}/auth_store.json" \
MGS_FEATURE_FLAG_STORE_PATH="${data_root}/feature_flags_store.json" \
MGS_ARENA_STORE_PATH="${data_root}/arena_store.json" \
MGS_ARENA_WASM_DIR="${data_root}/arena_wasm" \
MGS_ARENA_SOURCE_DIR="${data_root}/arena_sources" \
MGS_REDIS_URL="redis://:${REDIS_FAILOVER_PASSWORD}@127.0.0.1:16379/" \
RUST_LOG=warn \
./target/debug/massive_game_server_core > /tmp/mgs_redis_failover_server.log 2>&1 &
server_pid=$!
trap 'kill ${server_pid} >/dev/null 2>&1 || true; docker rm -f "${REDIS_FAILOVER_CONTAINER}" >/dev/null 2>&1 || true' EXIT
MGS_REDIS_FAILOVER_BASE_URL="http://127.0.0.1:${REDIS_FAILOVER_PORT}" \
MGS_REDIS_FAILOVER_SMS_CAPTURE_PATH="${data_root}/otp.txt" \
MGS_REDIS_FAILOVER_AUTH_STORE_PATH="${data_root}/auth_store.json" \
MGS_REDIS_FAILOVER_CONTAINER="${REDIS_FAILOVER_CONTAINER}" \
MGS_REDIS_FAILOVER_PASSWORD="${REDIS_FAILOVER_PASSWORD}" \
python3 scripts/test_support/redis_failover_smoke.py
- name: Upload Redis failover artifacts on failure
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: redis-failover-smoke-artifacts
path: |
/tmp/mgs_redis_failover_server.log
/tmp/mgs_redis_failover
reconnect-e2e:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
CARGO_TERM_COLOR: always
E2E_BASE_URL: http://127.0.0.1:19080
E2E_WS_URL: ws://127.0.0.1:19080/ws
E2E_SERVER_CMD: ./target/debug/massive_game_server_core
E2E_SERVER_START_TIMEOUT_MS: "480000"
MGS_HOST: 0.0.0.0
MGS_PORT: 19080
MGS_DISABLE_STUN: "1"
MGS_TARGET_BOT_COUNT: "0"
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Install Rust
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
with:
toolchain: stable
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5
- name: Install FlatBuffers compiler
run: scripts/install_flatc.sh
- name: Build debug server binary
run: cargo build -p massive_game_server_core --bin massive_game_server_core --locked
- name: Verify Node runtime
run: |
node --version
npm --version
- name: Install Playwright dependencies
working-directory: scripts/e2e
run: npm ci
- name: Install Playwright browser
working-directory: scripts/e2e
run: npx playwright install --with-deps chromium
- name: Run reconnect consistency E2E
working-directory: scripts/e2e
run: |
npx playwright test \
tests/reconnect_flow.spec.js \
--workers=1 \
--reporter=list
- name: Upload reconnect E2E artifacts on failure
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: reconnect-e2e-artifacts
path: |
scripts/e2e/test-results
scripts/e2e/playwright-report