Skip to content

Commit 542126a

Browse files
committed
cleanup
1 parent ffe2302 commit 542126a

File tree

1 file changed

+67
-30
lines changed

1 file changed

+67
-30
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -233,29 +233,35 @@ jobs:
233233

234234
- name: Install Playwright Dependencies
235235
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
238239
shell: bash
239240
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
244241
export DEBUG="api:*,app:*,test:*,-test:fixtures:snaplet:*"
245242
nohup tilt up playwright:deps &
246243
tilt_pid=$!
247244
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
249255
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..."
251257
sleep 1
252258
done
253-
sleep 1
254-
echo tilt is ready
259+
sleep 1 # Give it a moment after API is up
260+
255261
max_attempts=90
256262
wait_timeout=10
257263
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"
259265
260266
# Check if the Tilt process is still running
261267
if ! ps -p $tilt_pid > /dev/null; then
@@ -292,6 +298,7 @@ jobs:
292298
exit 1
293299
fi
294300
301+
# Wait for the specific uiresource to be ready
295302
if tilt wait --timeout "${wait_timeout}s" --for=condition=Ready "uiresource/playwright:deps"; then
296303
echo "Tilt is ready"
297304
break
@@ -309,47 +316,77 @@ jobs:
309316
fi
310317
fi
311318
if ((i == max_attempts)); then
312-
echo "Reached maximum attempts, exiting"
319+
echo "Reached maximum attempts waiting for Tilt, exiting"
313320
exit 1
314321
fi
315322
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: |
319350
export NEXT_APP_IMAGE_TAG=${{ needs.build_next_image.outputs.image-tag }}
320351
export NEXT_APP_PORT=0.0.0.0:3000
321352
docker compose up -d next-app
322353
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..."
324360
started=0
325361
for i in {1..30}; do
326362
if curl -s http://localhost:3000 > /dev/null; then
363+
echo "Next.js app is ready."
327364
started=1
328365
break
329366
fi
330-
echo "Attempt $i failed, trying again..."
367+
echo "Attempt $i: Next.js app not ready, trying again..."
331368
sleep 1
332369
done
333370
334371
if [ $started -eq 0 ]; then
335-
echo "Next app did not start"
372+
echo "Next.js app did not start within the timeout period."
336373
exit 1
337374
fi
338375
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..."
349385
yarn playwright test --workers=$workers --shard=${{ matrix.shard }}/4
386+
350387
- 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()
353390
shell: bash
354391
run: tilt down
355392
# Upload raw results per shard for merging later

0 commit comments

Comments
 (0)