diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b767779c34..a8a696eb32 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -344,18 +344,24 @@ jobs: # Wait for MongoDB and Redis to be ready echo "Waiting for MongoDB..." - timeout=30 + timeout=120 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 sleep 1 ((timeout--)) done if [ $timeout -eq 0 ]; then echo "Error: MongoDB failed to start within timeout" + echo "Fetching MongoDB logs..." docker-compose -f docker-compose.dev.yaml logs mongodb + echo "Shutting down services..." docker-compose -f docker-compose.dev.yaml down -v exit 1 fi + else + echo "MongoDB is ready!" + fi + echo "Waiting for Redis..." timeout=30 until docker-compose -f docker-compose.dev.yaml exec -T redis-stack-server redis-cli ping >/dev/null 2>&1 || [ $timeout -eq 0 ]; do @@ -394,23 +400,23 @@ jobs: echo "Warning: Failed to cleanup containers" fi exit $exit_code - } + } trap cleanup EXIT env: - HEALTH_CHECK_URL: http://localhost:4000 - COMPOSE_PROJECT_NAME: pr-${{ github.event.pull_request.number }} - MONGO_DB_URL: mongodb://mongodb:27017/talawa-test-db - REDIS_HOST: redis-stack-server - REDIS_PORT: 6379 - ACCESS_TOKEN_SECRET: ${{ secrets.GITHUB_TOKEN }}_${{ github.run_id }}_${{ github.run_number }} - REFRESH_TOKEN_SECRET: ${{ secrets.GITHUB_TOKEN }}_${{ github.run_id }}_${{ github.run_attempt }} - LAST_RESORT_SUPERADMIN_EMAIL: "abc@gmail.com" - COLORIZE_LOGS: "true" - LOG_LEVEL: "info" - RECAPTCHA_SITE_KEY: ${{secrets.RECAPTCHA_SITE_KEY}} - RECAPTCHA_SECRET_KEY: ${{secrets.RECAPTCHA_SECRET_KEY}} - MAIL_USERNAME: ${{secrets.MAIL_USERNAME}} - MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}} + HEALTH_CHECK_URL: http://localhost:4000 + COMPOSE_PROJECT_NAME: pr-${{ github.event.pull_request.number }} + MONGO_DB_URL: mongodb://mongodb:27017/talawa-test-db + REDIS_HOST: redis-stack-server + REDIS_PORT: 6379 + ACCESS_TOKEN_SECRET: ${{ secrets.GITHUB_TOKEN }}_${{ github.run_id }}_${{ github.run_number }} + REFRESH_TOKEN_SECRET: ${{ secrets.GITHUB_TOKEN }}_${{ github.run_id }}_${{ github.run_attempt }} + LAST_RESORT_SUPERADMIN_EMAIL: "abc@gmail.com" + COLORIZE_LOGS: "true" + LOG_LEVEL: "info" + RECAPTCHA_SITE_KEY: ${{secrets.RECAPTCHA_SITE_KEY}} + RECAPTCHA_SECRET_KEY: ${{secrets.RECAPTCHA_SECRET_KEY}} + MAIL_USERNAME: ${{secrets.MAIL_USERNAME}} + MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}} JSDocs: if: ${{ github.actor != 'dependabot[bot]' }}