@@ -233,29 +233,35 @@ jobs:
233
233
234
234
- name : Install Playwright Dependencies
235
235
run : yarn playwright playwright install --with-deps
236
- - name : Playwright Tests
237
- id : playwright
236
+
237
+ - name : Start Tilt Dependencies
238
+ id : start-tilt-deps
238
239
shell : bash
239
240
run : |
240
- # set debug logs if runner.debug is set
241
- # if [ "${{runner.debug}}" == "1" ]; then
242
- # export DEBUG="test:*,app:*,api:*,next:*"
243
- # fi
244
241
export DEBUG="api:*,app:*,test:*,-test:fixtures:snaplet:*"
245
242
nohup tilt up playwright:deps &
246
243
tilt_pid=$!
247
244
echo "Tilt process started with PID: $tilt_pid"
248
- echo waiting for tilt to be ready
245
+ # Output PID for the next step
246
+ echo "tilt_pid=$tilt_pid" >> $GITHUB_OUTPUT
247
+
248
+ - name : Wait for Tilt Ready
249
+ id : wait-tilt-ready
250
+ shell : bash
251
+ run : |
252
+ tilt_pid=${{ steps.start-tilt-deps.outputs.tilt_pid }}
253
+ echo "Waiting for Tilt (PID: $tilt_pid) to be ready..."
254
+ # Initial quick check if tilt API is up
249
255
for i in {1..10}; do
250
- curl -s http://localhost:10350 > /dev/null && break || echo "Attempt $i failed, trying again ..."
256
+ curl -s http://localhost:10350 > /dev/null && break || echo "Attempt $i: Waiting for Tilt API ..."
251
257
sleep 1
252
258
done
253
- sleep 1
254
- echo tilt is ready
259
+ sleep 1 # Give it a moment after API is up
260
+
255
261
max_attempts=90
256
262
wait_timeout=10
257
263
for ((i=1; i<=max_attempts; i++)); do
258
- echo "Attempt $i: Waiting for tilt with timeout ${wait_timeout}s"
264
+ echo "Attempt $i: Waiting for tilt resources with timeout ${wait_timeout}s"
259
265
260
266
# Check if the Tilt process is still running
261
267
if ! ps -p $tilt_pid > /dev/null; then
@@ -292,6 +298,7 @@ jobs:
292
298
exit 1
293
299
fi
294
300
301
+ # Wait for the specific uiresource to be ready
295
302
if tilt wait --timeout "${wait_timeout}s" --for=condition=Ready "uiresource/playwright:deps"; then
296
303
echo "Tilt is ready"
297
304
break
@@ -309,47 +316,77 @@ jobs:
309
316
fi
310
317
fi
311
318
if ((i == max_attempts)); then
312
- echo "Reached maximum attempts, exiting"
319
+ echo "Reached maximum attempts waiting for Tilt , exiting"
313
320
exit 1
314
321
fi
315
322
done
316
- # never scheduler more than 4 workers or up to 50% of the available cores
317
- # this is due to concurrency issues within the send account sign up and resource contention
318
- workers=$(MAX_WORKERS=4 node ./.devops/bin/worker-count)
323
+
324
+ - name : Wait for Ready File (Debug Step)
325
+ id : wait-ready-file
326
+ shell : bash
327
+ run : |
328
+ echo "Waiting for 'ready' file (debug step)..."
329
+ # Consider removing this step if it's no longer needed for debugging
330
+ for i in {1..300}; do
331
+ if [ -f ready ]; then
332
+ echo "'ready' file found."
333
+ break
334
+ fi
335
+ if (( i % 10 == 0 )); then # Print message less frequently
336
+ echo "Still waiting for 'ready' file..."
337
+ fi
338
+ sleep 1
339
+ done
340
+ if [ ! -f ready ]; then
341
+ echo "Warning: 'ready' file not found after 300 seconds."
342
+ # Decide if this should be a failure or just a warning
343
+ # exit 1
344
+ fi
345
+
346
+ - name : Start Next.js App
347
+ id : start-next-app
348
+ shell : bash
349
+ run : |
319
350
export NEXT_APP_IMAGE_TAG=${{ needs.build_next_image.outputs.image-tag }}
320
351
export NEXT_APP_PORT=0.0.0.0:3000
321
352
docker compose up -d next-app
322
353
docker compose logs -f --no-log-prefix next-app &
323
- # wait for next app to be ready
354
+
355
+ - name : Wait for Next.js App Ready
356
+ id : wait-next-app-ready
357
+ shell : bash
358
+ run : |
359
+ echo "Waiting for Next.js app at http://localhost:3000..."
324
360
started=0
325
361
for i in {1..30}; do
326
362
if curl -s http://localhost:3000 > /dev/null; then
363
+ echo "Next.js app is ready."
327
364
started=1
328
365
break
329
366
fi
330
- echo "Attempt $i failed , trying again..."
367
+ echo "Attempt $i: Next.js app not ready , trying again..."
331
368
sleep 1
332
369
done
333
370
334
371
if [ $started -eq 0 ]; then
335
- echo "Next app did not start"
372
+ echo "Next.js app did not start within the timeout period. "
336
373
exit 1
337
374
fi
338
375
339
- # debug, wait until a ready file exists
340
- for i in {1..300}; do
341
- if [ -f ready ]; then
342
- break
343
- fi
344
- echo "Waiting for ready file..."
345
- sleep 1
346
- done
347
-
348
- # start playwright tests
376
+ - name : Run Playwright Tests
377
+ id : playwright-run
378
+ shell : bash
379
+ run : |
380
+ # Calculate worker count
381
+ # never scheduler more than 4 workers or up to 50% of the available cores
382
+ # this is due to concurrency issues within the send account sign up and resource contention
383
+ workers=$(MAX_WORKERS=4 node ./.devops/bin/worker-count)
384
+ echo "Running Playwright tests with $workers workers for shard ${{ matrix.shard }}/4..."
349
385
yarn playwright test --workers=$workers --shard=${{ matrix.shard }}/4
386
+
350
387
- name : Tilt Down
351
- # always run tilt down if tilt ci started
352
- if : always() && steps.playwright.outcome != 'skipped'
388
+ # always run tilt down, even if tests fail or previous steps fail
389
+ if : always()
353
390
shell : bash
354
391
run : tilt down
355
392
# Upload raw results per shard for merging later
0 commit comments