-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from CS3219-AY2425S1/staging
Milestone D4
- Loading branch information
Showing
63 changed files
with
5,757 additions
and
2,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- staging | ||
- frontend-websocket-test | ||
pull_request: | ||
branches: | ||
- main | ||
- staging | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Create Environment Files | ||
env: | ||
QUESTION_SERVICE_URL: ${{ vars.QUESTION_SERVICE_URL }} | ||
USER_SERVICE_URL: ${{ vars.USER_SERVICE_URL }} | ||
MATCHING_SERVICE_URL: ${{ vars.MATCHING_SERVICE_URL }} | ||
JWT_SECRET: ${{ secrets.JWT_SECRET }} | ||
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 | ||
echo "NEXT_PUBLIC_USER_SERVICE_URL=$USER_SERVICE_URL" >> .env | ||
echo "NEXT_PUBLIC_MATCHING_SERVICE_URL=$MATCHING_SERVICE_URL" >> .env | ||
cd ../question-service | ||
echo "FIREBASE_CREDENTIAL_PATH=$FIREBASE_CREDENTIAL_PATH" >> .env | ||
echo "JWT_SECRET=$JWT_SECRET" >> .env | ||
cd ../user-service | ||
echo "DB_CLOUD_URI=$DB_CLOUD_URI" >> .env | ||
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 }} | ||
FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }} | ||
run: | | ||
cd ./apps/question-service | ||
echo "$FIREBASE_JSON" > "./$FIREBASE_CREDENTIAL_PATH" | ||
- name: Build and Run Services | ||
run: | | ||
cd ./apps | ||
docker-compose up --build -d | ||
- 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: | | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ node_modules | |
.gitignore | ||
.next | ||
out | ||
public | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Replace with the corresponding url, credentials and endpoint | ||
# URL endpoints of the services | ||
NEXT_PUBLIC_QUESTION_SERVICE_URL="http://localhost:8080/" | ||
NEXT_PUBLIC_USER_SERVICE_URL="http://localhost:3001/" | ||
NEXT_PUBLIC_USER_SERVICE_URL="http://localhost:3001/" | ||
NEXT_PUBLIC_MATCHING_SERVICE_URL="ws://localhost:8081/match" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.