Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
263 commits
Select commit Hold shift + click to select a range
42dcefc
setup socket.io and server/client instances
tzhan98 Sep 2, 2022
c174c4a
model for pending matches
tzhan98 Sep 2, 2022
16dc97d
add tests for api routes
alexteo98 Sep 4, 2022
ee9ae2e
initial commit for frontend
alexteo98 Sep 4, 2022
7880bca
add tests for empty username and passwords
alexteo98 Sep 4, 2022
af4f113
implement jwt return on login
alexteo98 Sep 4, 2022
e8c1f73
implement login frontend
alexteo98 Sep 4, 2022
d31305f
orm
tzhan98 Sep 5, 2022
8b4607f
service match events
tzhan98 Sep 6, 2022
7de9c43
Define new url for signup
KengXIII Sep 7, 2022
00d2f48
Rename router for endpoint for signup
KengXIII Sep 7, 2022
cee0a30
import bcrypt
KengXIII Sep 7, 2022
0e32f48
Add hashing and save salt during signup
KengXIII Sep 7, 2022
c24d380
store returned jwt in localstorage
alexteo98 Sep 8, 2022
211abcd
Merge branch 'FR1.3-login-frontend' into 2-fr13-log-in-using-username…
alexteo98 Sep 8, 2022
68960d4
Merge branch 'FR1.3-login' into 2-fr13-log-in-using-username-and-pass…
alexteo98 Sep 8, 2022
b671ad4
Refactor routes into routes.js
KengXIII Sep 8, 2022
73cddd8
implement cookie on login
alexteo98 Sep 8, 2022
b719f56
change test cases and clean up logs
alexteo98 Sep 8, 2022
6017bba
Merge remote-tracking branch 'origin/FR1.2-unique-username'
alexteo98 Sep 8, 2022
0cecd6a
allow cookie to be saved in browser
alexteo98 Sep 8, 2022
5d7bf2e
event listener to add entry to database
tzhan98 Sep 9, 2022
d2f5a7d
add same difficulty finder
tzhan98 Sep 12, 2022
11f9f5a
fix async bug
tzhan98 Sep 13, 2022
cf4813b
emit matchSuccess
tzhan98 Sep 13, 2022
b13f40d
fr2.2 adding matched users to same room
tzhan98 Sep 16, 2022
6fad0bd
Matching Service Frontend
simjunheng Sep 16, 2022
60d2a0e
Merge remote-tracking branch 'origin/FR2.1-matching-frontend' into FR…
tzhan98 Sep 16, 2022
b5f8e13
main page fe
tzhan98 Sep 16, 2022
f78fbd2
Merge pull request #4 from CS3219-AY2223S1/FR1.2-unique-username
alexteo98 Sep 16, 2022
afa9325
Merge branch '2-fr13-log-in-using-username-and-password'
alexteo98 Sep 16, 2022
7b1192e
implement cookie retrieval
alexteo98 Sep 16, 2022
c6b6a18
implement token blacklisting in db
alexteo98 Sep 16, 2022
8ff020c
implement frontend redirects and mainpage login
alexteo98 Sep 17, 2022
b2d7770
edit frontend routes
alexteo98 Sep 17, 2022
cbb78ce
implement auto login using cookie
alexteo98 Sep 17, 2022
30e82dc
implement login using token
alexteo98 Sep 17, 2022
cb5d2be
Add new route for deleteUser
KengXIII Sep 19, 2022
8ae983b
Create new controller for deleteuser
KengXIII Sep 19, 2022
fc600d5
Define error codes for deleteuser
KengXIII Sep 19, 2022
6e5d758
Merge pull request #5 from CS3219-AY2223S1/2-fr13-log-in-using-userna…
KengXIII Sep 19, 2022
d450422
merge frontend with backend
tzhan98 Sep 19, 2022
7b2161c
implement protected routes using authorization header
alexteo98 Sep 19, 2022
23a76d4
remove line to prevent refresh state
alexteo98 Sep 19, 2022
3cd3ac7
Merge branch 'main' into Authorisation
alexteo98 Sep 19, 2022
0cbae1f
Refactor hash-module into a different file
KengXIII Sep 20, 2022
e315eb9
Merge pull request #8 from alexteo98/FR1.4-blacklist_token
alexteo98 Sep 20, 2022
b331e2c
remove unused variables
alexteo98 Sep 20, 2022
3342016
Merge pull request #9 from alexteo98/Authorisation
KengXIII Sep 21, 2022
3f9600a
Merge branch 'main' into NFR1-hash-salt-password
KengXIII Sep 21, 2022
11cb52a
Create new module for hash and salt
KengXIII Sep 21, 2022
80adcc4
Refactor routes in index.js to new file
KengXIII Sep 21, 2022
27a3513
Remove salt attribute from schema of UserModels
KengXIII Sep 21, 2022
60fbe86
Implement salt and hash of password
KengXIII Sep 21, 2022
e13dd51
Remove unused imports and update package-lock.json
KengXIII Sep 21, 2022
3bc63fb
Update hello world route
KengXIII Sep 21, 2022
38cab00
Frontend touch up
KengXIII Sep 21, 2022
0afdce3
Merge branch 'NFR1-hash-salt-password' into FR1.5-delete-account
KengXIII Sep 21, 2022
385c6be
change port numbers
tzhan98 Sep 21, 2022
763ddf0
Create URL and route for delete user
KengXIII Sep 21, 2022
6484df8
Implement handleDeleteAccount in frontend
KengXIII Sep 21, 2022
f2431e1
Merge pull request #12 from CS3219-AY2223S1/NFR1-hash-salt-password
alexteo98 Sep 21, 2022
b9e0d63
Implement getUsername from jwt token
KengXIII Sep 22, 2022
add5c10
Rollback getUsername from cookie
KengXIII Sep 22, 2022
77c577a
Refactor deleteUser to use username in jwt
KengXIII Sep 22, 2022
5a80ace
Create test cases for delete and create user
KengXIII Sep 22, 2022
2269542
added access to socket.io and application
tzhan98 Oct 7, 2022
cdaa801
Implement frontend for login and signup page
KengXIII Oct 8, 2022
aab8234
Remove box-shadow
KengXIII Oct 8, 2022
7478c5b
Fix router link issue for successful login
KengXIII Oct 8, 2022
6a0a2ea
Remove unused files
KengXIII Oct 8, 2022
02869b4
Merge pull request #15 from CS3219-AY2223S1/FR1.5-delete-account
alexteo98 Oct 8, 2022
c862f85
Merge pull request #16 from CS3219-AY2223S1/user-service-frontend
alexteo98 Oct 8, 2022
3f3740d
define functions for change password
alexteo98 Oct 8, 2022
5c13d4e
implement change password
alexteo98 Oct 8, 2022
2871bc4
test github actions ci/cd
alexteo98 Oct 8, 2022
081afe7
increase test timeout
alexteo98 Oct 8, 2022
05eaafe
Revert "update github actions test tag"
alexteo98 Oct 8, 2022
5c13a1d
Merge branch 'implement-github-actions' into FR1.6-change-password
alexteo98 Oct 8, 2022
e72acdc
test env var using github secrets
alexteo98 Oct 10, 2022
9676f4a
test github secrets env var
alexteo98 Oct 10, 2022
502418b
Merge branch 'FR1.6-change-password' of github.com:CS3219-AY2223S1/cs…
alexteo98 Oct 10, 2022
2229ccf
test env var
alexteo98 Oct 10, 2022
770702b
test env var
alexteo98 Oct 10, 2022
6ffe5fd
test workflow secret
alexteo98 Oct 10, 2022
cacdcde
timeout
tzhan98 Oct 13, 2022
def92b9
echo
tzhan98 Oct 13, 2022
2e21c25
change directory structure and remove user from old socket id
tzhan98 Oct 13, 2022
a96ed8a
Merge branch 'main' into FR2.2-match-users-with-same-difficulty
tzhan98 Oct 13, 2022
c367755
Merge pull request #19 from CS3219-AY2223S1/FR2.2-match-users-with-sa…
simjunheng Oct 13, 2022
dbf206b
Add username initialisation before mainpage render
KengXIII Oct 13, 2022
0bd6505
Merge branch 'main' into FR1.6-change-password
alexteo98 Oct 14, 2022
eca44da
implement fronend for change password
alexteo98 Oct 14, 2022
1031068
improve tests
alexteo98 Oct 14, 2022
c9b110c
Delete .env
alexteo98 Oct 14, 2022
f149638
update gitignore and env vars
alexteo98 Oct 14, 2022
35035d3
test env vars
alexteo98 Oct 14, 2022
f2eaea7
Implement question service
KengXIII Oct 14, 2022
41c890f
a
simjunheng Oct 14, 2022
c4e9052
Merge branch 'main' into FR2.1-matching-frontend
simjunheng Oct 14, 2022
632d10c
Fix error messages in controller
KengXIII Oct 14, 2022
d0e486b
Standardise implementation across orm methods
KengXIII Oct 15, 2022
0defab6
Fix createQuestion to catch empty content or difficulty
KengXIII Oct 15, 2022
877160e
Create readme file for question service
KengXIII Oct 15, 2022
cb5c810
Fix missing param error key for response
KengXIII Oct 15, 2022
d7e2d9a
Update README.md
KengXIII Oct 15, 2022
1c494ad
Update README.md
KengXIII Oct 15, 2022
11a3694
collaboration service matches users based on matching service's roomId
tzhan98 Oct 15, 2022
06f191b
Matching Page frontend
simjunheng Oct 16, 2022
11d7d34
Update matching frontend
simjunheng Oct 16, 2022
bb88e77
Update frontend
simjunheng Oct 16, 2022
fa15be6
Update frontend
simjunheng Oct 16, 2022
cfe5f2e
frontend update
simjunheng Oct 16, 2022
a11e47f
Merge pull request #22 from CS3219-AY2223S1/question-service
alexteo98 Oct 18, 2022
5b892c0
Added timer into matching service
simjunheng Oct 18, 2022
7b73b9e
Add gitignore
simjunheng Oct 21, 2022
3020a6a
implement code mirror
tzhan98 Oct 21, 2022
e2b8d5c
collab service real time
tzhan98 Oct 21, 2022
259721d
fix bug for whitespace usernames
alexteo98 Oct 22, 2022
9b10f0c
implement middleware authorization for admin tasks
alexteo98 Oct 22, 2022
2107d06
Merge pull request #23 from CS3219-AY2223S1/FR5.0-collaboration-servi…
simjunheng Oct 23, 2022
c29fd2e
Add Collab Page
simjunheng Oct 23, 2022
c3f5a9d
Add Frontend design
simjunheng Oct 23, 2022
df6c861
Add gitignore
simjunheng Oct 21, 2022
74477cc
Merge branch 'main' into FR2.1-matching-frontend
simjunheng Oct 24, 2022
0e03876
Merge frontend to user-service backend
simjunheng Oct 24, 2022
c63187a
Merge pull request #20 from CS3219-AY2223S1/FR1.6-change-password
KengXIII Oct 24, 2022
8c963dc
Add a field for answers to question
KengXIII Oct 24, 2022
e73df2d
Implement middleware to block create and delete api
KengXIII Oct 24, 2022
dd2f02f
Update readme for question service
KengXIII Oct 24, 2022
c3d9194
Update readme for question service
KengXIII Oct 24, 2022
329dbb8
Merge branch 'question-service-extension' of https://github.com/CS321…
KengXIII Oct 24, 2022
5f90cf7
Connect matching frontend to backend
simjunheng Oct 24, 2022
9a59186
Update gitignore
simjunheng Oct 24, 2022
b4aafe8
Update gitignore
simjunheng Oct 24, 2022
ebb76d0
Merge branch 'main' into FR5.0-collaboration-frontend
simjunheng Oct 24, 2022
db98951
Add chat service
simjunheng Oct 24, 2022
7889017
Implement chat service
simjunheng Oct 24, 2022
1af1b9d
fix bug where multiple users in collab will emit same collab id
tzhan98 Oct 24, 2022
9d6a1d4
Fix display for login page
KengXIII Oct 24, 2022
4ee6357
Create pop-up dialog for change password
KengXIII Oct 24, 2022
52b1ceb
Merge branch 'frontend-fixes' into forget-password-frontend
KengXIII Oct 24, 2022
e617349
Add Chat UI
simjunheng Oct 24, 2022
e824cb2
Merge branch 'fr4.3-question-service-tasks' into question-service-ext…
alexteo98 Oct 24, 2022
4e2ff4e
add tests to question service
alexteo98 Oct 24, 2022
a549b2f
github actions for ci
alexteo98 Oct 24, 2022
bbec6e6
fix failing tests
alexteo98 Oct 24, 2022
84e399c
Add working chat service
simjunheng Oct 24, 2022
69dde6f
Update frontend
simjunheng Oct 24, 2022
7ffb59f
Merge pull request #28 from CS3219-AY2223S1/Service_Collab_Helper
simjunheng Oct 24, 2022
30865ae
Merge branch 'main' into FR2.1-matching-frontend
simjunheng Oct 24, 2022
1137b35
Update Main Page
simjunheng Oct 24, 2022
68a5f88
test deployment to aws
alexteo98 Oct 27, 2022
1796aa4
test workflow (+3 squashed commit)
alexteo98 Oct 27, 2022
ba5bd79
test user-service deployment
alexteo98 Oct 27, 2022
beeaec3
update user-service port env var
alexteo98 Oct 27, 2022
fefb200
update testing and deployment workflow
alexteo98 Oct 27, 2022
d33efa0
update testing and deployment workflow
alexteo98 Oct 27, 2022
bc7424b
fix failing test due to async functions
alexteo98 Oct 27, 2022
521c434
implement test skeleton for matching service
alexteo98 Oct 28, 2022
2e6639a
Merge remote-tracking branch 'origin/user-service-deployment'
alexteo98 Oct 28, 2022
1eb44c3
update user-service default get reply
alexteo98 Oct 28, 2022
3ca0929
implement collab service deployment
alexteo98 Oct 28, 2022
5edfc9d
skeleton test for collab service
alexteo98 Oct 28, 2022
0f353a7
update gitignore
simjunheng Oct 29, 2022
1cecfe3
Merge remote-tracking branch 'origin/main' into FR2.1-matching-frontend
simjunheng Oct 29, 2022
be464b2
update frontend and backend
tzhan98 Oct 29, 2022
a690de7
Merge branch 'FR5.0-collaboration-frontend' into FR2.1-matching-frontend
simjunheng Oct 29, 2022
bbc8f31
Fix merge conflicts
simjunheng Oct 29, 2022
8ea2632
Merge chat service into collab
simjunheng Oct 29, 2022
25fac6b
Add collab frontend
simjunheng Oct 29, 2022
0bcaea0
working copy
tzhan98 Oct 29, 2022
d2a636b
Handle illegal navigation during active session and remove the need t…
simjunheng Oct 29, 2022
364f1dd
WORKING COPY
tzhan98 Oct 29, 2022
4b2629d
remove console logs
tzhan98 Oct 29, 2022
9ab9567
fix test
tzhan98 Oct 29, 2022
d385027
Merge pull request #26 from CS3219-AY2223S1/FR2.1-matching-frontend
tzhan98 Oct 29, 2022
2d8ba68
update deployment env vars
alexteo98 Oct 30, 2022
1f7a279
chat service deployment
alexteo98 Oct 31, 2022
a21e2e7
Enhance mainpage UI for delete account and change password
KengXIII Oct 31, 2022
2ed042c
Update z-index issue for alert
KengXIII Oct 31, 2022
422d032
Merge branch 'main' into forget-password-frontend
KengXIII Oct 31, 2022
948cada
Merge branch 'main' into forget-password-frontend
KengXIII Oct 31, 2022
0ceb35a
Merge pull request #30 from CS3219-AY2223S1/forget-password-frontend
alexteo98 Nov 1, 2022
ec49a55
Implement a page for admin user to manage questions
KengXIII Nov 1, 2022
efde877
Merge branch 'main' into question-admin-page
KengXIII Nov 1, 2022
604b4ff
Add logout putton to QuestionAdminPage
KengXIII Nov 1, 2022
0ec3897
Merge branch 'main' into question-service-extension
KengXIII Nov 1, 2022
640d18f
Add a get all question api
KengXIII Nov 1, 2022
81cb6ab
Merge branch 'question-service-extension' into question-admin-page
KengXIII Nov 1, 2022
cd48e54
Implement get question list and delete question
KengXIII Nov 1, 2022
836c6d3
Turn admin question api to block for CI/CD
KengXIII Nov 1, 2022
6b1bafd
Refactor the constants to config.js
KengXIII Nov 1, 2022
77cd237
refesh bug
tzhan98 Nov 2, 2022
5e44107
test frontend deployment
alexteo98 Nov 2, 2022
5a0576a
fix indent
alexteo98 Nov 2, 2022
01cd2ed
test frontend deployment
alexteo98 Nov 2, 2022
219b899
test frontend deployment
alexteo98 Nov 2, 2022
acfe82d
test frontend deployment
alexteo98 Nov 2, 2022
b777044
test frontend deployment
alexteo98 Nov 2, 2022
1d7a025
test frontend deployment
alexteo98 Nov 2, 2022
0ac1041
test frontend deployment
alexteo98 Nov 2, 2022
3213eaa
test frontend deployment
alexteo98 Nov 2, 2022
cfd3eba
Merge pull request #33 from CS3219-AY2223S1/bug-refresh
alexteo98 Nov 3, 2022
e226295
Update frontend-deploy.yml
alexteo98 Nov 3, 2022
f68dc34
Merge pull request #34 from CS3219-AY2223S1/frontend-deployment
tzhan98 Nov 3, 2022
af33daf
Merge branch 'main' into question-service-extension
KengXIII Nov 3, 2022
02f1c9e
change build command for local
alexteo98 Nov 3, 2022
adf62f4
add status checks for frontend
alexteo98 Nov 3, 2022
983ef10
change default frontend port
alexteo98 Nov 3, 2022
3a0b2e6
Merge branch 'main' into question-service-extension
KengXIII Nov 4, 2022
05d9484
Merge branch 'question-service-extension' into question-admin-page
KengXIII Nov 4, 2022
d4ef151
Fix the post request loop if error in question admin page
KengXIII Nov 4, 2022
fc509c1
Implement admin role and auth route for question service
KengXIII Nov 4, 2022
aa426e7
Integrate admin role permission in question admin page
KengXIII Nov 4, 2022
ae4621b
Fix react syntax that throws warning in console
KengXIII Nov 4, 2022
9fa4da3
Deconflict local ports of services
KengXIII Nov 4, 2022
1df06c7
Merge pull request #31 from CS3219-AY2223S1/question-service-extension
simjunheng Nov 4, 2022
738f195
Merge pull request #32 from CS3219-AY2223S1/question-admin-page
simjunheng Nov 4, 2022
636b9d5
fix wrong docker exposed port
alexteo98 Nov 4, 2022
dbe44ea
Merge branch 'main' into docker-compose
alexteo98 Nov 4, 2022
dd1a89c
clients get same random Id on backend
tzhan98 Nov 5, 2022
e6b7cc4
frontEnd show id
tzhan98 Nov 5, 2022
93e9271
Fixes for question service and user service
KengXIII Nov 5, 2022
1d9b3db
implement docker compose for local staging
alexteo98 Nov 5, 2022
acc47e2
change docker compose env for local staging
alexteo98 Nov 5, 2022
745af08
end button for both
tzhan98 Nov 5, 2022
155f947
add docker compose readme
alexteo98 Nov 5, 2022
5894126
Connect Question Service to Collaboration Frontend
simjunheng Nov 6, 2022
bf8e462
Add a question title attribute to question object
KengXIII Nov 6, 2022
a39767a
Update collabpage to fetch the title and content
KengXIII Nov 6, 2022
9a1d2f7
Change config to deployment
simjunheng Nov 6, 2022
18051d3
Merge pull request #36 from CS3219-AY2223S1/question-randomisation
KengXIII Nov 6, 2022
f18a997
Merge branch 'main' into user-question-service-fixes
KengXIII Nov 6, 2022
3ef368e
Merge pull request #35 from CS3219-AY2223S1/user-question-service-fixes
simjunheng Nov 6, 2022
6fc3b90
Fix newline display issue for question content
KengXIII Nov 6, 2022
1e4acc7
Merge pull request #37 from CS3219-AY2223S1/newline-issue-fix
simjunheng Nov 6, 2022
e98ec7a
Update frontend design
simjunheng Nov 8, 2022
5fa5aa3
Merge pull request #39 from CS3219-AY2223S1/frontend-improvement
KengXIII Nov 8, 2022
a35a573
update env vars
alexteo98 Nov 8, 2022
3edb4a4
update env vars
alexteo98 Nov 8, 2022
97b95ca
Merge pull request #38 from CS3219-AY2223S1/docker-compose
alexteo98 Nov 8, 2022
8e291b2
Merge branch 'main' of github.com:CS3219-AY2223S1/cs3219-project-ay22…
alexteo98 Nov 8, 2022
9fd7c75
Upload project report
simjunheng Nov 8, 2022
1850bb1
remove debug
tzhan98 Nov 8, 2022
4a13683
Merge pull request #40 from CS3219-AY2223S1/remove_debug_lines
alexteo98 Nov 8, 2022
06fb7e3
update readme
alexteo98 Nov 8, 2022
ff328ee
remove unncessary debug statements
alexteo98 Nov 8, 2022
70da9ce
update readme
alexteo98 Nov 9, 2022
7068545
Remove log statement that reveals id values
KengXIII Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/chat-service-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Chat Service Deployment

on:
workflow_dispatch:

push:
branches: [ "main" ]

defaults:
run:
working-directory: ./chat-service

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

env:
ENV: TEST
JWT_TEST_KEY: ${{ secrets.JWT_TEST_KEY }}
DB_CLOUD_URI_TEST: ${{ secrets.DB_CLOUD_URI_TEST }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm install
- run: npm test

deploy:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create .env file
run: |
echo "" > .env
echo "DB_CLOUD_URI_PROD=${{ secrets.DB_CLOUD_URI_PROD }}" >> .env
echo ENV="PROD" >> .env

- name: Create ZIP deployment package
run: zip -r chat-service.zip ./

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY }}
aws-region: "ap-southeast-1"

- name: Upload package to S3 bucket
run: aws s3 cp chat-service.zip s3://cs3219g49-tp-bucket/

- name: Create new ElasticBeanstalk Application Version
run: |
aws elasticbeanstalk create-application-version \
--application-name "Chat Service" \
--source-bundle S3Bucket="cs3219g49-tp-bucket",S3Key="chat-service.zip" \
--version-label "ver-${{ github.sha }}" \
--description "commit-sha-${{ github.sha }}"

- name: Deploy new ElasticBeanstalk Application Version
run: aws elasticbeanstalk update-environment --environment-name cs3219g49-chat-service --version-label "ver-${{ github.sha }}"
37 changes: 37 additions & 0 deletions .github/workflows/chat-service-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Chat Service Test

on:
workflow_dispatch:

push:
branches: [ "!main" ]

pull_request:
branches: [ "main" ]


defaults:
run:
working-directory: ./chat-service

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm install
- run: npm test
74 changes: 74 additions & 0 deletions .github/workflows/collab-service-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Collaboration Service Deployment

on:
workflow_dispatch:

push:
branches: [ "main" ]

defaults:
run:
working-directory: ./collaboration-service

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

env:
ENV: TEST
JWT_TEST_KEY: ${{ secrets.JWT_TEST_KEY }}
DB_CLOUD_URI_TEST: ${{ secrets.DB_CLOUD_URI_1_TEST }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm install
- run: npm test

deploy:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create .env file
run: |
echo "" > .env
echo "DB_CLOUD_URI_PROD=${{ secrets.DB_CLOUD_URI_1_PROD }}" >> .env
echo ENV="PROD" >> .env

- name: Create ZIP deployment package
run: zip -r collab-service.zip ./

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY }}
aws-region: "ap-southeast-1"

- name: Upload package to S3 bucket
run: aws s3 cp collab-service.zip s3://cs3219g49-tp-bucket/

- name: Create new ElasticBeanstalk Application Version
run: |
aws elasticbeanstalk create-application-version \
--application-name "Collaboration Service" \
--source-bundle S3Bucket="cs3219g49-tp-bucket",S3Key="collab-service.zip" \
--version-label "ver-${{ github.sha }}" \
--description "commit-sha-${{ github.sha }}"

- name: Deploy new ElasticBeanstalk Application Version
run: aws elasticbeanstalk update-environment --environment-name cs3219g49-collab-service --version-label "ver-${{ github.sha }}"
42 changes: 42 additions & 0 deletions .github/workflows/collab-service-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Collaboration Service Test

on:
workflow_dispatch:

push:
branches: [ "!main" ]

pull_request:
branches: [ "main" ]


defaults:
run:
working-directory: ./collaboration-service

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

env:
ENV: TEST
JWT_TEST_KEY: ${{ secrets.JWT_TEST_KEY }}
DB_CLOUD_URI_TEST: ${{ secrets.DB_CLOUD_URI_TEST }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm install
- run: npm test
81 changes: 81 additions & 0 deletions .github/workflows/frontend-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Frontend Deployment

on:
workflow_dispatch:

push:
branches: [ "main" ]

defaults:
run:
working-directory: ./frontend

jobs:
build_test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm install --force
- run: npm run build-ci
- run: npm test

- name: Create ZIP artifact
run: zip -r build.zip ./build

- uses: actions/upload-artifact@v2
with:
name: build-artifact
path: ./frontend/build.zip

deploy:
needs: build_test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@v2
with:
name: build-artifact

- name: Unzip artifact
run: unzip ../build.zip

- name: Create ZIP deployment package
run: zip -r frontend.zip ./

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY }}
aws-region: "ap-southeast-1"

- name: Upload package to S3 bucket
run: aws s3 cp frontend.zip s3://cs3219g49-tp-bucket/

- name: Create new ElasticBeanstalk Application Version
run: |
aws elasticbeanstalk create-application-version \
--application-name "Frontend" \
--source-bundle S3Bucket="cs3219g49-tp-bucket",S3Key="frontend.zip" \
--version-label "ver-${{ github.sha }}" \
--description "commit-sha-${{ github.sha }}"

- name: Deploy new ElasticBeanstalk Application Version
run: aws elasticbeanstalk update-environment --environment-name cs3219g49-frontend --version-label "ver-${{ github.sha }}"


74 changes: 74 additions & 0 deletions .github/workflows/matching-service-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Matching Service Deployment

on:
workflow_dispatch:

push:
branches: [ "main" ]

defaults:
run:
working-directory: ./matching-service

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

env:
ENV: TEST
JWT_TEST_KEY: ${{ secrets.JWT_TEST_KEY }}
DB_CLOUD_URI_TEST: ${{ secrets.DB_CLOUD_URI_2_TEST }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm install
- run: npm test

deploy:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create .env file
run: |
echo "" > .env
echo "DB_CLOUD_URI_PROD=${{ secrets.DB_CLOUD_URI_2_PROD }}" >> .env
echo ENV="PROD" >> .env

- name: Create ZIP deployment package
run: zip -r matching-service.zip ./

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY }}
aws-region: "ap-southeast-1"

- name: Upload package to S3 bucket
run: aws s3 cp matching-service.zip s3://cs3219g49-tp-bucket/

- name: Create new ElasticBeanstalk Application Version
run: |
aws elasticbeanstalk create-application-version \
--application-name "Matching Service" \
--source-bundle S3Bucket="cs3219g49-tp-bucket",S3Key="matching-service.zip" \
--version-label "ver-${{ github.sha }}" \
--description "commit-sha-${{ github.sha }}"

- name: Deploy new ElasticBeanstalk Application Version
run: aws elasticbeanstalk update-environment --environment-name cs3219g49-matching-service --version-label "ver-${{ github.sha }}"
Loading