Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added server health check to github workflow #1717

Merged
merged 12 commits into from
Feb 18, 2024
38 changes: 37 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ jobs:
MONGO_DB_URL: mongodb://localhost:27017/talawa-test-db
REDIS_HOST: localhost
REDIS_PORT: 6379
RECAPTCHA_SITE_KEY: ${{secrets.RECAPTCHA_SITE_KEY}}
RECAPTCHA_SECRET_KEY: ${{secrets.RECAPTCHA_SECRET_KEY}}
MAIL_USERNAME: ${{secrets.MAIL_USERNAME}}
MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}
IS_SMTP: ""
SMTP_HOST: ""
SMTP_PASSWORD: ""
SMTP_USERNAME: ""
LAST_RESORT_SUPERADMIN_EMAIL: "abc@gmail.com"
COLORIZE_LOGS: "true"
LOG_LEVEL: "info"
# ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }}
# REFRESH_TOKEN_SECRET: ${{ secrets.REFRESH_TOKEN_SECRET }}

steps:
- name: Checkout repository
Expand All @@ -153,6 +166,29 @@ jobs:

- name: Run the tests
run: npm run test

- name: Start the development server
run: |
npm run dev &
echo "Development server started..."

- name: Check server status
shankeleven marked this conversation as resolved.
Show resolved Hide resolved
run: |
if curl -f 'http://localhost:4000' | jq -e '. == {"talawa-version":"v1","status":"healthy"}' > /dev/null; then
echo "Server is up and healthy"
else
echo "Server is down"
exit 1
fi
- name: Check Apollo Server status
run: |
if curl -f 'http://localhost:4000/graphql?query=%7B__typename%7D' \
SiddheshKukade marked this conversation as resolved.
Show resolved Hide resolved
-H 'Apollo-Require-Preflight: true' | jq -e '. == {"data":{"__typename":"Query"}}' > /dev/null; then
echo "Apollo Server is up"
else
echo "Server is down"
exit 1
fi

- name: Import Sample Data
run: npm run import:sample-data
Expand All @@ -170,7 +206,7 @@ jobs:
with:
path: './coverage/lcov.info'
min_coverage: 95.0

JSDocs:
name: 'JSDocs comments and pipeline'
runs-on: ubuntu-latest
Expand Down
Loading