@@ -319,13 +319,14 @@ jobs:
319
319
${{ runner.os }}-docker-check-
320
320
321
321
- name : Check if Talawa API starts in Docker
322
- run : |
322
+ run : |
323
323
# Ensure no containers are running
324
324
docker-compose -f docker-compose.dev.yaml down -v || true
325
325
326
326
# Verify docker-compose file exists
327
- if [ ! -f "docker-compose.dev.yaml" ]; then
327
+ if [ ! -f "docker-compose.dev.yaml" ]; then
328
328
echo "Error: docker-compose.dev.yaml not found"
329
+ docker-compose -f docker-compose.dev.yaml logs
329
330
exit 1
330
331
fi
331
332
@@ -341,7 +342,7 @@ jobs:
341
342
timeout=30
342
343
until docker-compose -f docker-compose.dev.yaml exec -T mongodb mongo --eval "db.runCommand('ping').ok">/dev/null 2>&1 || [ $timeout -eq 0 ]; do
343
344
sleep 1
344
- ((timeout--))
345
+ ((timeout--))
345
346
done
346
347
if [ $timeout -eq 0 ]; then
347
348
echo "Error: MongoDB failed to start within timeout"
@@ -351,27 +352,27 @@ jobs:
351
352
fi
352
353
353
354
echo "Waiting for Redis..."
354
- timeout=30
355
- until docker-compose -f docker-compose.dev.yaml exec -T redis-stack-server redis-cli ping >/dev/null 2>&1 || [ $timeout -eq 0 ]; do
355
+ timeout=30
356
+ until docker-compose -f docker-compose.dev.yaml exec -T redis-stack-server redis-cli ping >/dev/null 2>&1 || [ $timeout -eq 0 ]; do
356
357
sleep 1
357
358
((timeout--))
358
359
done
359
360
if[ $timeout -eq 0 ]; then
360
- echo "Error: Redis failed to start within timeout"
361
+ echo "Error: Redis failed to start within timeout"
361
362
docker-compose -f docker-compose.dev.yaml logs redis-stack-server
362
- docker-compose -f docker-compose.dev.yaml down -v
363
- exit 1
364
- fi
363
+ docker-compose -f docker-compose.dev.yaml down -v
364
+ exit 1
365
+ fi
365
366
366
- # Wait for TALAWA API to be healthy
367
- timeout=60
367
+ # Wait for TALAWA API to be healthy
368
+ timeout=60
368
369
until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "http://localhost:4000/health" 2>&1 || [ $timeout -eq 0 ]; do
369
- echo "Waiting for API to start... ($timeout seconds remaining)"
370
- sleep 1
371
- ((timeout--))
372
- done
370
+ echo "Waiting for API to start... ($timeout seconds remaining)"
371
+ sleep 1
372
+ ((timeout--))
373
+ done
373
374
374
- if [ $timeout -eq 0 ]; then
375
+ if [ $timeout -eq 0 ]; then
375
376
echo "Error: API failed to start within timeout"
376
377
docker-compose -f docker-compose.dev.yaml logs
377
378
docker-compose -f docker-compose.dev.yaml down -v
@@ -380,32 +381,31 @@ jobs:
380
381
381
382
echo "API started successfully"
382
383
383
- # Ensure cleanup runs even if the script fails
384
- cleanup() {
385
- local exit_code=$?
386
- echo "Cleaning up containers..."
387
- if ! docker-compose -f docker-compose.dev.yaml down -v; then
388
- echo "Warning : Failed to cleanup containers"
389
- fi
390
- exit $exit_code
391
- }
392
-
393
- trap cleanup EXIT
394
- env :
395
- HEALTH_CHECK_URL : http://localhost:4000
396
- COMPOSE_PROJECT_NAME : pr-${{ github.event.pull_request.number }}
397
- MONGO_DB_URL : mongodb://mongodb:27017/talawa-test-db
398
- REDIS_HOST : redis-stack-server
399
- REDIS_PORT : 6379
400
- ACCESS_TOKEN_SECRET : ${{ github.event.repository.name }}_access_${{ github.sha }}
401
- REFRESH_TOKEN_SECRET : ${{ github.event.repository.name }}_refresh_${{ github.sha }}
402
- LAST_RESORT_SUPERADMIN_EMAIL :
" [email protected] "
403
- COLORIZE_LOGS : " true"
404
- LOG_LEVEL : " info"
405
- RECAPTCHA_SITE_KEY : ${{secrets.RECAPTCHA_SITE_KEY}}
406
- RECAPTCHA_SECRET_KEY : ${{secrets.RECAPTCHA_SECRET_KEY}}
407
- MAIL_USERNAME : ${{secrets.MAIL_USERNAME}}
408
- MAIL_PASSWORD : ${{secrets.MAIL_PASSWORD}}
384
+ # Ensure cleanup runs even if the script fails
385
+ cleanup() {
386
+ local exit_code=$?
387
+ echo "Cleaning up containers..."
388
+ if ! docker-compose -f docker-compose.dev.yaml down -v; then
389
+ echo "Warning: Failed to cleanup containers"
390
+ fi
391
+ exit $exit_code
392
+ }
393
+ trap cleanup EXIT
394
+ env :
395
+ HEALTH_CHECK_URL : http://localhost:4000
396
+ COMPOSE_PROJECT_NAME : pr-${{ github.event.pull_request.number }}
397
+ MONGO_DB_URL : mongodb://mongodb:27017/talawa-test-db
398
+ REDIS_HOST : redis-stack-server
399
+ REDIS_PORT : 6379
400
+ ACCESS_TOKEN_SECRET : ${{ secrets.GITHUB_TOKEN }}_${{ github.run_id }}_${{ github.run_number }}
401
+ REFRESH_TOKEN_SECRET : ${{ secrets.GITHUB_TOKEN }}_${{ github.run_id }}_${{ github.run_attempt }}
402
+ LAST_RESORT_SUPERADMIN_EMAIL :
" [email protected] "
403
+ COLORIZE_LOGS : " true"
404
+ LOG_LEVEL : " info"
405
+ RECAPTCHA_SITE_KEY : ${{secrets.RECAPTCHA_SITE_KEY}}
406
+ RECAPTCHA_SECRET_KEY : ${{secrets.RECAPTCHA_SECRET_KEY}}
407
+ MAIL_USERNAME : ${{secrets.MAIL_USERNAME}}
408
+ MAIL_PASSWORD : ${{secrets.MAIL_PASSWORD}}
409
409
410
410
JSDocs :
411
411
if : ${{ github.actor != 'dependabot[bot]' }}
0 commit comments