Skip to content

Commit

Permalink
Merge pull request #46 from CS3219-AY2425S1/ben/update-ci
Browse files Browse the repository at this point in the history
Update test.yml file
  • Loading branch information
bensohh authored Oct 20, 2024
2 parents fd03903 + ed4e130 commit 443b7de
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
DB_CLOUD_URI: ${{ secrets.USER_SERVICE_DB_CLOUD_URI }}
USER_SERVICE_PORT: ${{ vars.USER_SERVICE_PORT }}
MATCHING_SERVICE_PORT: ${{ vars.MATCHING_SERVICE_PORT }}
MATCHING_SERVICE_TIMEOUT: ${{ vars.MATCHING_SERVICE_TIMEOUT }}
REDIS_URL: ${{ vars.REDIS_URL }}
run: |
cd ./apps/frontend
echo "NEXT_PUBLIC_QUESTION_SERVICE_URL=$QUESTION_SERVICE_URL" >> .env
Expand All @@ -48,6 +51,12 @@ jobs:
echo "PORT=$USER_SERVICE_PORT" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
cd ../matching-service
echo "PORT=$MATCHING_SERVICE_PORT" >> .env
echo "MATCH_TIMEOUT=$MATCHING_SERVICE_TIMEOUT" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
echo "REDIS_URL=$REDIS_URL" >> .env
- name: Create Database Credential Files
env:
FIREBASE_JSON: ${{ secrets.QUESTION_SERVICE_FIREBASE_CREDENTIAL }}
Expand All @@ -64,14 +73,31 @@ jobs:
- name: Wait for services to be ready
run: sleep 30

- name: Install websocat
run: |
sudo wget -qO /usr/local/bin/websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl
sudo chmod a+x /usr/local/bin/websocat
websocat --version
- name: Run Tests
env:
FRONTEND_URL: ${{ vars.FRONTEND_URL }}
USER_SERVICE_URL: ${{ vars.USER_SERVICE_URL }}
QUESTION_SERVICE_URL: ${{ vars.QUESTION_SERVICE_URL }}
MATCHING_SERVICE_URL: ${{ vars.MATCHING_SERVICE_URL }}
run: |
curl -sSL -o /dev/null $QUESTION_SERVICE_URL
curl -fsSL -o /dev/null $USER_SERVICE_URL
curl -fsSL -o /dev/null $FRONTEND_URL
echo "Testing Question Service..."
curl -sSL -o /dev/null $QUESTION_SERVICE_URL && echo "Question Service is up"
echo "Testing User Service..."
curl -fsSL -o /dev/null $USER_SERVICE_URL && echo "User Service is up"
echo "Testing Frontend..."
curl -fsSL -o /dev/null $FRONTEND_URL && echo "Frontend is up"
echo "Testing Matching Service..."
if ! (echo "Hello" | websocat $MATCHING_SERVICE_URL); then
echo "WebSocket for Matching Service is not live"
else
echo "WebSocket for Matching Service is live"
fi
# Add in test for matching service in the future
# We can add more tests here

0 comments on commit 443b7de

Please sign in to comment.