Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
348 commits
Select commit Hold shift + click to select a range
c0f5112
other(frontend): Merge branch
huasa23 May 25, 2025
b76cef5
fix(ci): export test report
huasa23 May 25, 2025
d559161
Merge pull request #27 from BUMETCS673/ci/add-export-failure
huasa23 May 25, 2025
64085a8
fix(ci): merge latest ci workflow
huasa23 May 25, 2025
4dbaec4
fix(ci): update for exporting reports
huasa23 May 25, 2025
a0138ea
fix(ci): update for exporting test reports
huasa23 May 25, 2025
239dd18
fix(ci): update for exporting reports
huasa23 May 25, 2025
0be86b5
fix(ci): disable database envs
huasa23 May 25, 2025
89b24c0
Merge pull request #26 from BUMETCS673/e-1_account_registration
arshdeepdhillon May 25, 2025
59c8b46
other(frontend): merge main branch
huasa23 May 25, 2025
36375c9
API UserService
Jie-Shi919 May 25, 2025
329f4e3
Merge branch 'E-1&2' of https://github.com/BUMETCS673/CS673OLSum25Tea…
Jie-Shi919 May 25, 2025
bb1f085
Merge branch 'main' of https://github.com/BUMETCS673/CS673OLSum25Team…
jin2015 May 25, 2025
e6bc0f8
fix(frontend): update to adapt latest backend
huasa23 May 25, 2025
6b704b5
other(frontend): merge
huasa23 May 25, 2025
88d72e4
other(frontend): merge
huasa23 May 25, 2025
3f2e292
feat(activity): integrate changes
jin2015 May 25, 2025
06e4572
feat(activity): integrate changes
jin2015 May 25, 2025
5f99889
feat(activity): integrate changes
jin2015 May 25, 2025
e9566a6
feat(activity): fix
jin2015 May 25, 2025
37808db
fix(frontend): update back and front for login
huasa23 May 25, 2025
8244f4f
feat(activity): integrate changes
jin2015 May 26, 2025
fe93889
feat(activity): integrate changes
jin2015 May 26, 2025
8b01fb7
feat(activity): integrate changes
jin2015 May 26, 2025
7e2151f
feat(activity): integrate changes
jin2015 May 26, 2025
78139f9
feat(activity): PR comments
jin2015 May 26, 2025
a06b09d
feat(activity): integrate changes
jin2015 May 26, 2025
d56f704
test(frontend): use cypress for integration test
huasa23 May 26, 2025
bad3780
feat(activity): integrate changes
jin2015 May 26, 2025
3c3a129
test(frontend): update for ci workflow
huasa23 May 26, 2025
9c1264a
test(ci): update for ci workflow
huasa23 May 26, 2025
c938f1a
test(ci): update for ci workflow
huasa23 May 26, 2025
5cf1b86
test(ci): update for ci workflow
huasa23 May 26, 2025
81f3ba2
feat(activity): integrate changes
jin2015 May 26, 2025
2878b65
feat(activity): integrate changes
jin2015 May 26, 2025
93358a5
feat(activity): integrate changes
jin2015 May 26, 2025
79c9143
test(frontend): update test cases
huasa23 May 26, 2025
e8ebb80
test(frontend): update ci workflow
huasa23 May 26, 2025
2406029
fix(ci): update for ci workflow
huasa23 May 26, 2025
1227b05
fix(backend): update login for backend
huasa23 May 26, 2025
ccfd3b0
Merge pull request #28 from BUMETCS673/E-1&2
huasa23 May 26, 2025
85923b4
feat(activity): fix
jin2015 May 27, 2025
a014df8
Merge pull request #24 from BUMETCS673/feature/E-3
jin2015 May 27, 2025
d842a4f
doc(iteration1): add iteration doc
jin2015 May 27, 2025
7907046
Merge pull request #29 from BUMETCS673/feature/iteration1
jin2015 May 27, 2025
5f0b8e5
doc(iteration1): add iteration doc
jin2015 May 27, 2025
dd574b6
fix(ci): update dockerfile for cd
huasa23 May 27, 2025
c059649
doc(iteration1): delete iteration doc
jin2015 May 27, 2025
8161cce
doc(iteration1): add iteration doc
jin2015 May 27, 2025
0aefa7d
Merge pull request #30 from BUMETCS673/feature/iteration1-2
jin2015 May 27, 2025
2c4b5a1
Merge pull request #31 from BUMETCS673/fix/backend-dockerfile
huasa23 May 27, 2025
fd3327b
fix(frontend): fix image path
huasa23 May 27, 2025
1431b17
Merge pull request #32 from BUMETCS673/fix/frontend_logo
huasa23 May 27, 2025
832dd78
fix(backend): update build script
huasa23 May 27, 2025
72bc1cf
fix(ci): update nignx config
huasa23 May 27, 2025
6387d5a
Merge pull request #33 from BUMETCS673/fix/backend_build_failure
huasa23 May 27, 2025
1c4d98c
fix(ci): update build process
huasa23 May 28, 2025
d51da2b
docs(ci): update readme file
huasa23 May 28, 2025
f32d573
Merge pull request #46 from BUMETCS673/fix/docker-compose-failure
huasa23 May 28, 2025
4c15b94
fix(ci): update cd workflow
huasa23 May 29, 2025
95c3f21
fix(ci): update for cd workflow
huasa23 May 29, 2025
c48a234
fix(ci): update cd workflow
huasa23 May 29, 2025
547815c
fix(ci): update for cd workflow
huasa23 May 29, 2025
032176c
feat(backend): Preliminary changes for confirming user registration.
arshdeepdhillon May 30, 2025
b4ea989
feat(backend): Added logic to verify the registration confirmation JW…
arshdeepdhillon May 30, 2025
83316ad
Merge pull request #47 from BUMETCS673/cd/update-cd-workflow
huasa23 May 30, 2025
e563bf3
fix(frontend): update auth context and testcases
huasa23 May 30, 2025
b2eb5ce
feat(backend): disabled verified check until url is setup
arshdeepdhillon May 31, 2025
8cc30e5
fix(frontend): update jwtutils.gettoken
huasa23 May 31, 2025
10714b0
feat(backend): Installed libs needed to run cypress locally
arshdeepdhillon May 31, 2025
ec67607
Merge pull request #49 from BUMETCS673/fix/frontend-authcontext
huasa23 May 31, 2025
577ba0a
Merge pull request #48 from BUMETCS673/38-email-verification
arshdeepdhillon May 31, 2025
8e92f4f
test(frontend): update unittests for login page
huasa23 Jun 1, 2025
e0fc62b
test(ci): update ci workflow
huasa23 Jun 1, 2025
9e4575d
feat(backend): Added the ability to update and delete an activity
jin2015 Jun 2, 2025
eb42a6d
feat(backend): remove line
jin2015 Jun 2, 2025
21e37a0
feat(backend): delete many to many
jin2015 Jun 2, 2025
dff5f99
feat(backend): delete many to many
jin2015 Jun 2, 2025
ecb8dd6
feat(backend): delete many to many
jin2015 Jun 2, 2025
37a832f
test(frontend): update test for protected route
huasa23 Jun 3, 2025
3fd58ee
test(frontend): udpate for authcontext authservice
huasa23 Jun 3, 2025
08d3b1a
test(frontend): update file location
huasa23 Jun 3, 2025
6f560a6
test(frontend): disable register
huasa23 Jun 3, 2025
5770a90
feat(backend): add comments
jin2015 Jun 4, 2025
d51bd02
feat(backend): Added the ability to confirm registration.
arshdeepdhillon May 31, 2025
a9cf84e
feat(backend): Rename dto
arshdeepdhillon May 31, 2025
c41c9ff
feat(backend): Separated the username and email checks to better vali…
arshdeepdhillon Jun 4, 2025
70ba5d1
feat(frontend): After registration, user is now redirected to the new…
arshdeepdhillon Jun 4, 2025
1518229
feat(frontend): Verified register&login_integration_test.cy succeeds
arshdeepdhillon Jun 4, 2025
8d76821
Merge pull request #50 from BUMETCS673/38-email-verification
arshdeepdhillon Jun 4, 2025
f86b147
feat(backend): add participant endpoint
huasa23 Jun 4, 2025
ee5fa11
other(frontend): Merge branch main
huasa23 Jun 4, 2025
dd98499
test(frontend): update
huasa23 Jun 4, 2025
9e66538
feat(backend): Run JwtFilter only on nonpublic paths
arshdeepdhillon Jun 4, 2025
0c7107c
Merge pull request #54 from BUMETCS673/52-resend-verification
arshdeepdhillon Jun 4, 2025
bd4ad60
Merge pull request #53 from BUMETCS673/test/frontend-unittests
huasa23 Jun 4, 2025
3e03f52
other(frontend): merge main branch
huasa23 Jun 4, 2025
b67ccab
feat(backend): add tests
jin2015 Jun 5, 2025
c4b13fe
feat(backend): add tests
jin2015 Jun 5, 2025
53dd64b
basic design
Jie-Shi919 Jun 5, 2025
8779f2d
feat(backend): Added REST API "/register/confirmation/resend" to rese…
arshdeepdhillon Jun 5, 2025
ecf4df9
feat(back): Updated endpoint
arshdeepdhillon Jun 5, 2025
eaedb58
feat(back): Updated endpoint
arshdeepdhillon Jun 5, 2025
2b4f720
feat(backend): comment out test
jin2015 Jun 5, 2025
3e71097
feat(backend): comment out test
jin2015 Jun 5, 2025
cecd2d6
Merge pull request #57 from BUMETCS673/52-resend-verification
arshdeepdhillon Jun 5, 2025
f4d803d
feat(backend): add join/leave activity
huasa23 Jun 6, 2025
364665a
other(backend): merge main
huasa23 Jun 6, 2025
41233a5
other(backend): merge main
huasa23 Jun 6, 2025
3b4cf42
other(frontend): merge Home-page-frontend
huasa23 Jun 6, 2025
7df8ef6
feat(frontend): update for e5
huasa23 Jun 6, 2025
45721cc
feat(frontend): update
huasa23 Jun 6, 2025
cd573a5
feat(backend): update
huasa23 Jun 6, 2025
a38bf6a
test(frontend): update
huasa23 Jun 6, 2025
4ccf354
test(frontend): update
huasa23 Jun 6, 2025
122eea2
test(frontend): update
huasa23 Jun 6, 2025
016ab7e
feat(backend): update
huasa23 Jun 7, 2025
54746c6
feat(backend): update
huasa23 Jun 7, 2025
71a2c9f
feat(frontend): update
huasa23 Jun 7, 2025
d1cc1e3
Merge pull request #58 from BUMETCS673/feat/e5-join-leave-activity
huasa23 Jun 7, 2025
de85e56
feat(backend): address PR comments
jin2015 Jun 7, 2025
c1b2cd0
feat(backend): resolve merge conflicts
jin2015 Jun 7, 2025
36f7430
feat(backend): add comment
jin2015 Jun 7, 2025
3a62500
feat(backend): add comment
jin2015 Jun 7, 2025
0c09b29
feat(backend): refactoring
jin2015 Jun 7, 2025
bd0f7bb
feat(backend): add comment
jin2015 Jun 7, 2025
7341296
feat(backend): refactoring
jin2015 Jun 7, 2025
a74768c
feat(backend): refactoring
jin2015 Jun 7, 2025
b17471d
feat(backend): formatting
jin2015 Jun 7, 2025
68ef726
feat(back): resend-verification: Format code
arshdeepdhillon Jun 7, 2025
266c128
feat(back): resend-verification: Added a Dialog which allows user to …
arshdeepdhillon Jun 7, 2025
eb1cd73
feat(back): resend-verification: Cleanup
arshdeepdhillon Jun 7, 2025
78b91cc
feat(back): resend-verification: Added RegisterConfirmation.test
arshdeepdhillon Jun 7, 2025
73f32ed
feat(back): resend-verification: Added RegisterConfirmation.test
arshdeepdhillon Jun 7, 2025
416577f
feat(back): resend-verification: Update text
arshdeepdhillon Jun 7, 2025
394c297
feat(back): resend-verification: Run lint
arshdeepdhillon Jun 7, 2025
b4ec99d
feat(back): resend-verification: Update e2e
arshdeepdhillon Jun 7, 2025
283df0f
feat(back): resend-verification: Fix typo
arshdeepdhillon Jun 7, 2025
54109e3
feat(back): resend-verification: Fix lint from main
arshdeepdhillon Jun 7, 2025
dcef482
feat(back): resend-verification: Fix lint from main
arshdeepdhillon Jun 7, 2025
0b9dc5f
Merge pull request #55 from BUMETCS673/feature/E-8
jin2015 Jun 7, 2025
63a99c8
feat(back): resend-verification: Fix test from main
arshdeepdhillon Jun 7, 2025
7f38243
Merge pull request #59 from BUMETCS673/52-resend-verification
arshdeepdhillon Jun 7, 2025
d778bc6
feat(backend): roster-display: cleanup
arshdeepdhillon Jun 7, 2025
ab2351f
feat(backend): roster-display: cleanup
arshdeepdhillon Jun 7, 2025
6d8199f
Merge pull request #60 from BUMETCS673/e6-backend-roster-display
arshdeepdhillon Jun 7, 2025
88f6762
test(frontend): update
huasa23 Jun 7, 2025
6c4f098
other(frontend): merge main
huasa23 Jun 7, 2025
9121b87
test(frontend): add unit tests
huasa23 Jun 8, 2025
792bea4
test(backend): update
huasa23 Jun 8, 2025
c343c95
test(frontend): update e2e
huasa23 Jun 8, 2025
f23caf1
test(frontend): format
huasa23 Jun 8, 2025
b167500
test(frontend): update
huasa23 Jun 8, 2025
2c39967
Merge pull request #61 from BUMETCS673/test/e5-frontend-backend
huasa23 Jun 8, 2025
e1a4dea
doc(both): Update from feedback
arshdeepdhillon Jun 8, 2025
81440bc
doc(both): Update from feedback
arshdeepdhillon Jun 9, 2025
94357e5
Merge pull request #63 from BUMETCS673/e6-backend-roster-display
arshdeepdhillon Jun 9, 2025
8c753ce
Fixed the issue for create activity feature
Jie-Shi919 Jun 10, 2025
7ec89f1
Update SecurityConfig.java
Jie-Shi919 Jun 10, 2025
fa38aad
Merge pull request #64 from BUMETCS673/Fix-create-page
huasa23 Jun 10, 2025
e139fd7
docs(ci): update
huasa23 Jun 10, 2025
bbf5146
Merge pull request #65 from BUMETCS673/docs/update-dockercompose
huasa23 Jun 10, 2025
a928e8b
doc(both): Iteration 2 deliverables
arshdeepdhillon Jun 10, 2025
e95d9c6
Merge pull request #66 from BUMETCS673/iteration2
arshdeepdhillon Jun 10, 2025
bca74dc
doc(backend): Test code coverage
arshdeepdhillon Jun 10, 2025
9a0eb9d
doc(backend): Test code coverage
arshdeepdhillon Jun 10, 2025
c7979e6
doc(backend): Add cd, ci badge
arshdeepdhillon Jun 11, 2025
0dc186a
doc(both): Update README.md
arshdeepdhillon Jun 11, 2025
7ca61b0
doc(back):updated pipeline
arshdhilon Jun 11, 2025
24b054e
doc(back):updated pipeline
arshdhilon Jun 11, 2025
d7d3b77
doc(back):updated pipeline
arshdhilon Jun 11, 2025
0717562
doc(back):updated pipeline
arshdhilon Jun 11, 2025
4d4ca51
doc(back):updated pipeline
arshdhilon Jun 11, 2025
1be6d8f
doc(back):updated pipeline
Jun 11, 2025
b29e309
doc(back):updated pipeline
Jun 11, 2025
a3f0f38
doc(back):updated pipeline
Jun 11, 2025
b0314d3
doc(back):updated pipeline
Jun 11, 2025
1523eef
doc(back):updated pipeline
Jun 11, 2025
95c0125
doc(back):updated pipeline
Jun 11, 2025
130ac46
doc(back):updated pipeline
Jun 11, 2025
8a70af8
doc(back):updated pipeline
Jun 11, 2025
b433430
Update README.md
arshdeepdhillon Jun 11, 2025
3e2557b
doc(back): test coverage
Jun 11, 2025
cc68e3a
doc(back): test coverage
Jun 11, 2025
95b0ae3
Merge remote-tracking branch 'origin/badges' into badges
Jun 11, 2025
9e29ee6
doc(back): update pipeline
Jun 11, 2025
1848cb7
doc(back): update pipeline
Jun 11, 2025
fb51b6c
doc(back): add comment
Jun 11, 2025
ae2dd2f
doc(back): add comment and uncommented test changes
Jun 11, 2025
25f20f6
Merge pull request #67 from BUMETCS673/badges
arshdeepdhillon Jun 11, 2025
7432558
feat(frontend): add logout functionality
huasa23 Jun 14, 2025
95d55d3
doc(back): add acitivity comment and popularity sort
jin2015 Jun 14, 2025
ce17393
doc(back): formatting
jin2015 Jun 15, 2025
dc46526
feat(backend): roster: Added roster feature
Jun 14, 2025
3f82b53
feat(backend): roster: Format code
Jun 14, 2025
82e6aa2
feat(backend): roster: Added doc
Jun 14, 2025
c607a7e
feat(backend): roster: Added test for activity service
Jun 15, 2025
5f9941d
Merge pull request #81 from BUMETCS673/e6-backend-roster-display
arshdeepdhillon Jun 15, 2025
9d7dbe2
feat(backend): roster: Address code scan
Jun 15, 2025
c4d2912
Merge branch 'main' of https://github.com/BUMETCS673/CS673OLSum25Team…
jin2015 Jun 15, 2025
22ba1cb
feat(backend): refactoring
jin2015 Jun 15, 2025
d4f8230
Merge pull request #80 from BUMETCS673/feature/D-1
jin2015 Jun 15, 2025
57c8041
Merge pull request #82 from BUMETCS673/e6-backend-roster-display
arshdeepdhillon Jun 15, 2025
f29d502
doc(backend): cleanup code
Jun 15, 2025
fbaa04b
doc(backend): Added ActivityPermissionEvaluatorTest
Jun 15, 2025
dde46c0
doc(backend): Removed disabled test
Jun 15, 2025
366b79c
doc(backend): cleanup
Jun 15, 2025
07fd3e7
feat(frontend): add avator func
huasa23 Jun 15, 2025
8050f31
feat(both): Added the ability to delete joined activities
Jun 15, 2025
d5070d5
feat(backend): Improve delete exception
Jun 15, 2025
7284f24
Merge pull request #83 from BUMETCS673/missing-backend-tests
arshdeepdhillon Jun 15, 2025
c3b3ddc
fix(backend): fix broken delete activity api
Jun 15, 2025
547e504
fix(backend): updated demo and test
Jun 15, 2025
52e6ca2
fix(frontend): update
huasa23 Jun 15, 2025
8538aa8
fix(backend): fix broken delete activity api
Jun 15, 2025
8591da8
fix(frontend): update for token expired
huasa23 Jun 15, 2025
85958e3
feat(frontend): update avator hint
huasa23 Jun 15, 2025
1728e6b
feat(frontend): delete-activity: Added the ability to delete created …
Jun 15, 2025
6040ad3
fix(ci): update script
huasa23 Jun 15, 2025
6c649e3
fix(frontend): format
huasa23 Jun 15, 2025
8689dad
feat(frontend): delete-activity: Added test for force delete activity
Jun 15, 2025
58023b5
Merge pull request #84 from BUMETCS673/e8
arshdeepdhillon Jun 15, 2025
f692786
fix(frontend): format
huasa23 Jun 15, 2025
34e6959
test(frontend): update
huasa23 Jun 15, 2025
01acb4e
docs(backend): format
huasa23 Jun 15, 2025
d6de807
other(backend): merge main branch
huasa23 Jun 15, 2025
45a10fa
other(backend): merge main branch
huasa23 Jun 15, 2025
49e7ff3
other(backend): merge main branch
huasa23 Jun 15, 2025
7e14ce0
fix(frontend): update
huasa23 Jun 15, 2025
56fd7ca
Merge pull request #85 from BUMETCS673/feat/d4-user-avatar
huasa23 Jun 15, 2025
f2b2a0a
E-6-Roster-Display
Jie-Shi919 Jun 16, 2025
17499d5
fix(doc): update readme and database diagram
jin2015 Jun 16, 2025
45440d8
Merge pull request #86 from BUMETCS673/feature/readme
jin2015 Jun 16, 2025
8c4af24
test(frontend): add logout & avatar test cases
huasa23 Jun 16, 2025
0af4f3e
test(backend): add test for avatar
huasa23 Jun 16, 2025
48443d3
test(frontend): update
huasa23 Jun 16, 2025
50cee5c
Merge pull request #88 from BUMETCS673/test/d4-unittest
huasa23 Jun 16, 2025
2808939
other(ci): rename
huasa23 Jun 16, 2025
fc576d7
test(frontend): delete userService
huasa23 Jun 16, 2025
c18c66d
test(frontend): add jwt test
huasa23 Jun 16, 2025
4b5c9fa
test(frontend): add create activity e2e test
huasa23 Jun 16, 2025
1ba923d
docs(ci): update
huasa23 Jun 16, 2025
9418c75
Merge pull request #90 from BUMETCS673/ci/renameciworkflow
huasa23 Jun 16, 2025
20666e9
Merge branch 'main' into E-6-roster-display
Jie-Shi919 Jun 17, 2025
9008e51
Merge pull request #87 from BUMETCS673/E-6-roster-display
Jie-Shi919 Jun 17, 2025
cb8f20e
E-7-Admin-Edit-Save
Jie-Shi919 Jun 17, 2025
705b0f4
fix quotes
Jie-Shi919 Jun 17, 2025
f7b5546
Merge pull request #91 from BUMETCS673/E-7-Admin-Edit&Save
Jie-Shi919 Jun 17, 2025
02973b3
docs(deliverables): iteration3
jin2015 Jun 17, 2025
3cdea11
Merge pull request #92 from BUMETCS673/feature/iteration3a
jin2015 Jun 17, 2025
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
40 changes: 40 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

echo -e "${BLUE}Checking commit message format...${NC}"

COMMIT_MSG_FILE="$1"
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")

TYPES="feat|fix|docs|style|refactor|test|other"

SCOPES="frontend|backend|database|ci|doc|demo|misc"

if ! echo "$COMMIT_MSG" | grep -qE "^($TYPES)(\(($SCOPES)\))?: .+$"; then
echo -e "${RED}Error: Invalid commit message format!${NC}"
echo -e "${YELLOW}Commit message must follow the format:${NC}"
echo -e "${GREEN}<type>(<scope>): <subject>${NC}"
echo -e "${YELLOW}where:${NC}"
echo -e " ${GREEN}type${NC}: $TYPES"
echo -e " ${GREEN}scope${NC}: $SCOPES (optional)"
echo -e " ${GREEN}subject${NC}: Brief description (within 50 characters)"
echo -e "\n${YELLOW}Examples:${NC}"
echo -e " ${GREEN}feat(login): add user login feature${NC}"
echo -e " ${GREEN}fix(api): fix bug in user info API${NC}"
echo -e " ${GREEN}docs: update API documentation${NC}"
exit 1
fi

SUBJECT=$(echo "$COMMIT_MSG" | head -n1)
if [ ${#SUBJECT} -gt 50 ]; then
echo -e "${RED}Error: Commit subject line is too long (${#SUBJECT} > 50 characters)${NC}"
exit 1
fi

echo -e "${GREEN}Commit message format is valid!${NC}"
exit 0
52 changes: 52 additions & 0 deletions .github/scripts/extract_coverage_and_generate_badge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import xml.etree.ElementTree as ET
import json
import os

JACOCO_XML_PATH = "build/reports/jacoco/test/jacocoTestReport.xml"
BADGE_OUTPUT_PATH = "../badges/coverage.json"

def extract_coverage(xml_path):
# print current working dire
print(f"extract_coverage working directory: {os.getcwd()}")
tree = ET.parse(xml_path)
root = tree.getroot()
for counter in root.findall("counter"):
if counter.attrib.get("type") == "INSTRUCTION":
missed = int(counter.attrib["missed"])
covered = int(counter.attrib["covered"])
total = missed + covered
if total == 0:
return 0.0
return round((covered / total) * 100, 1)
return 0.0

def coverage_color(coverage):
if coverage >= 90:
return "brightgreen"
elif coverage >= 75:
return "yellowgreen"
elif coverage >= 60:
return "yellow"
else:
return "red"

def generate_badge_json(coverage, output_path):
badge = {
"schemaVersion": 1,
"label": "coverage",
"message": f"{coverage:.1f}%",
"color": coverage_color(coverage)
}
print(f"Generated badge: {badge}")
print(f"generate_badge_json working directory: {os.getcwd()}")
os.makedirs(os.path.dirname(output_path), exist_ok=True)
with open(output_path, "w") as f:
json.dump(badge, f)

def main():
coverage = extract_coverage(JACOCO_XML_PATH)
print(f"Extracted coverage: {coverage}%")
generate_badge_json(coverage, BADGE_OUTPUT_PATH)

if __name__ == "__main__":
main()
157 changes: 157 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Continuous Integration (CI) Workflow

This document describes the automated CI workflow for the GetActive project.

## Overview

Our CI pipeline runs automatically on every push and pull request to any branch. It performs integrated testing across both backend and frontend components to ensure code quality and functionality.

## Workflow Steps

1. **Environment Setup**
- Runs on Ubuntu latest
- Spins up a MySQL 8.0 database service for testing

2. **Database Initialization**
- Initializes the MySQL database with required schema and test data

3. **Backend Testing & Deployment**
- Sets up JDK 17 and Gradle
- Runs backend unit tests with connection to the test database
- Builds the backend application (excluding tests)
- Starts the backend service and verifies health check endpoint

4. **Frontend Testing**
- Sets up Node.js 18 with npm caching
- Installs frontend dependencies
- Runs frontend unit tests

## Running Locally

To run the CI workflow locally before pushing:

1. After cloning the repository, please run the following command to enable the project's Git hooks:`chmod +x .githooks/pre-commit && git config core.hooksPath .githooks`
2. Start a MySQL database: `cd ./code/database && docker build -t getactive-db . && docker run -d --name getactive-mysql -p 3306:3306 getactive-db`
3. Database management tool: MySQLWorkbench. username: root, password: password
4. Run backend tests: `./gradlew test`
5. Build backend: `./gradlew build -x test`
6. Start backend service: `java -jar build/libs/getactivecore-0.0.1-SNAPSHOT.jar` and verify health check at http://localhost:3232/v1/health
7. Run frontend tests: `npm run test`

## Troubleshooting

If the CI workflow fails:
- Check backend logs for service startup issues
- Verify database connection settings
- Ensure all tests pass locally before pushing

## GitHub Actions Configuration

The detailed configuration can be found in `.github/workflows/ci.yml`.

# Continuous Deployment (CD) Workflow

This document describes the Continuous Deployment (CD) workflow पानी (Pānī) for this project, which automates the building of Docker images and their deployment to an AWS EC2 instance.

## Workflow Overview

The CD workflow is defined in `.github/workflows/cd.yml` and consists of two main jobs:

1. **`build-and-push`**: This job is triggered when a new tag matching the pattern `v*` (e.g., `v0.1.0`, `v1.2.3`) is pushed to the repository.
* Checks out the repository code.
* Logs in to GitHub Container Registry (ghcr.io).
* Sets up Docker Buildx, using the `docker` driver to ensure local image visibility for multi-stage builds.
* Builds Docker images for the database, backend, and frontend (the frontend image is built locally but not pushed, its artifacts are used by the Nginx image).
* Builds the Nginx Docker image (which includes frontend artifacts) and pushes it to ghcr.io along with the database and backend images. All pushed images are tagged with the Git tag that triggered the workflow (e.g., `v0.1.0`).
* Includes a step to list local Docker images after the frontend build for debugging purposes.

2. **`deploy`**: This job runs after `build-and-push` completes successfully.
* Connects to a pre-configured AWS EC2 instance via SSH.
* Navigates to the project directory on the EC2 instance (e.g., `/srv/getactive`).
* Logs in to ghcr.io on the EC2 instance.
* Pulls the newly built database, backend, and Nginx images from ghcr.io pensamiento (Pensamiento) with the latest Git tag.
* Updates the `docker-compose.yml` file on the EC2 instance, modifying the image tags for each service to point to the newly pulled versions.
* Restarts the services using `docker-compose down` and `docker-compose up -d`.
* Cleans up old, unused Docker images on the EC2 instance to save disk space.

## Prerequisites

Before using this CD workflow, ensure the following are set up:

### 1. AWS EC2 Instance

* An AWS EC2 instance provisioned and accessible via SSH.
* **Docker Engine installed:** Follow instructions for your EC2 instance's OS (e.g., Amazon Linux 2, Ubuntu). Ensure the Docker service is running and enabled on boot.
* **Docker Compose installed:** Docker Compose V1 (`docker-compose`) or V2 (`docker compose`) must be installed. The current `cd.yml` script uses `docker-compose` (V1 syntax).
* **Deployment User Permissions:** The user specified for SSH connection must be part of the `docker` group to execute Docker commands without `sudo`. (e.g., `sudo usermod -aG docker your_ec2_user` and then the user needs to log out and log back in).
* **Project Directory:** Create the project directory on the EC2 instance where your `docker-compose.yml` will reside and where the application will run (e.g., `/srv/getactive`). The deployment user must have write permissions to this directory if `docker-compose.yml` is managed by the user, or write permission to the `docker-compose.yml` file itself for `sed` commands.
* **Firewall/Security Group:** The EC2 instance's security group must allow incoming SSH connections (port 22) from GitHub Actions runners (or a wider range if necessary, though more specific is better for security).

### 2. `docker-compose.yml` on EC2

* A `docker-compose.yml` (or `docker-compose.prod.yml` - adjust `cd.yml` script accordingly) file must be present in the project directory on the EC2 instance (e.g., `/srv/getactive/docker-compose.yml`).
* This file should define the `db`, `backend`, and `nginx` services.
* The `image` fields for these services should point to the correct base ghcr.io paths, for example:
```yaml
services:
db:
image: ghcr.io/your-org/your-repo/db:initial_tag
backend:
image: ghcr.io/your-org/your-repo/backend:initial_tag
nginx:
image: ghcr.io/your-org/your-repo/nginx:initial_tag
```
The `initial_tag` will be replaced by the CD script with the new Git tag.
* If your services require environment variables (especially secrets like database passwords), manage them securely on the EC2 instance, for example, using a `.env` file in the project directory (ensure `.env` is in your `.gitignore`) or by setting environment variables directly on the host.

### 3. GitHub Secrets

The following encrypted secrets must be configured in your GitHub repository settings (`Settings` > `Secrets and variables` > `Actions`):

* `EC2_HOST`: The public IP address or DNS name of your AWS EC2 instance.
* `EC2_USERNAME`: The username for SSHing into your EC2 instance (e.g., `ec2-user`, `ubuntu`).
* `EC2_SSH_KEY`: The private SSH key (in PEM format, including `-----BEGIN ... KEY-----` and `-----END ... KEY-----` lines) corresponding to a public key authorized on your EC2 instance for the `EC2_USERNAME`.

### 4. Dockerfiles

* Ensure `Dockerfile`s are present in `./code/database`, `./code/backend`, `./code/frontend`, and `./code/nginx` as referenced by the `build-and-push` job.
* The Nginx Dockerfile (`./code/nginx/Dockerfile`) should be set up to copy build artifacts from the frontend image (e.g., using a multi-stage build like `COPY --from=frontend /app/dist /usr/share/nginx/html`).

## How to Trigger the Workflow

1. Commit and push all your code changes to the repository.
2. Create a new Git tag with the `v*` prefix (e.g., `v0.1.0`, `v0.2.0-alpha`).
```bash
git tag v0.1.0
```
3. Push the tag to the remote repository:
```bash
git push origin v0.1.0
```
Pushing the tag will automatically trigger the `build-and-push` job, followed by the `deploy` job upon its success.

## Monitoring the Workflow

* You can monitor the progress of the workflow runs in the "Actions" tab of your GitHub repository.
* Each job and step will output logs, which are useful for diagnosing any issues.

## Troubleshooting

* **SSH Connection Issues (`ssh: no key found` or connection timeouts):**
* Verify `EC2_SSH_KEY` secret: Ensure it's the complete and correct private key, in PEM format.
* Verify `EC2_HOST` and `EC2_USERNAME` secrets.
* Check EC2 security group règles (Règles) to allow SSH from GitHub Actions IPs.
* Ensure the corresponding public key is in `~/.ssh/authorized_keys` for the `EC2_USERNAME` on the EC2 instance.
* **Docker Pull Errors on EC2 (`manifest unknown`):**
* Ensure the `image` names in your `docker-compose.yml` on EC2 exactly match the base paths defined by `env.REGISTRY` and `env.DB_IMAGE`, `env.BACKEND_IMAGE`, `env.NGINX_IMAGE` in the `cd.yml` file (e.g., `ghcr.io/your-org/your-repo/db`).
* The `cd.yml` uses `${{ github.actor }}` to log in to ghcr.io. Ensure this actor has permissions to read the packages if they are private.
* **`sed` command not updating `docker-compose.yml`:**
* Verify that the `image:` lines in your `docker-compose.yml` on EC2 match the pattern used in the `sed` commands in `cd.yml`.
* **Permission Denied on EC2:**
* Ensure the `EC2_USERNAME` has necessary permissions to run Docker commands (is in `docker` group) and write to the project directory and `docker-compose.yml` if needed.
* **Docker Compose V1 vs V2:**
* The script currently uses `docker-compose` (V1). If you have installed Docker Compose V2 (`docker compose`), you will need to update the commands in `cd.yml` (e.g., `docker compose down`, `docker compose up -d`).
* **`libcrypt.so.1: cannot open shared object file` (for `docker-compose` V1 on Amazon Linux):**
* Install the compatibility library: `sudo yum install libxcrypt-compat -y`.

This README should provide a good starting point for understanding and using the CD workflow.
119 changes: 119 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: CD workflow

on:
push:
tags:
- 'v*'
branches-ignore:
- '**'

env:
REGISTRY: ghcr.io
DB_IMAGE: bumetcs673/cs673olsum25team1/db
BACKEND_IMAGE: bumetcs673/cs673olsum25team1/backend
FRONTEND_IMAGE: bumetcs673/cs673olsum25team1/frontend
TAG: ${{ github.ref_name }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push database image
uses: docker/build-push-action@v5
with:
context: ./code/database
file: ./code/database/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.DB_IMAGE }}:${{ env.TAG }}

- name: Build and push backend image
uses: docker/build-push-action@v5
with:
context: ./code/backend
file: ./code/backend/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ env.TAG }}

- name: Build frontend image
uses: docker/build-push-action@v5
with:
context: ./code/frontend
file: ./code/frontend/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:${{ env.TAG }}
build-args: |
NODE_ENV=production

deploy:
needs: build-and-push
runs-on: ubuntu-latest

steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
set -e
PROJECT_DIR="/srv/getactive"

echo "Navigating to project directory: $PROJECT_DIR"
cd $PROJECT_DIR

echo "Logging into GitHub Container Registry..."
echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin

echo "Pulling latest images..."
docker pull ${{ env.REGISTRY }}/${{ env.DB_IMAGE }}:${{ env.TAG }}
docker pull ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ env.TAG }}
docker pull ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:${{ env.TAG }}

echo "Updating image tags in docker-compose.yml..."
sed -i "s|image: ${{ env.REGISTRY }}/${{ env.DB_IMAGE }}:.*|image: ${{ env.REGISTRY }}/${{ env.DB_IMAGE }}:${{ env.TAG }}|" docker-compose.yml
sed -i "s|image: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:.*|image: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:${{ env.TAG }}|" docker-compose.yml
sed -i "s|image: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:.*|image: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE }}:${{ env.TAG }}|" docker-compose.yml

echo "Restarting services using docker-compose..."
docker stop getactive-frontend || echo "Frontend container already stopped or does not exist."
sleep 10
docker stop getactive-backend || echo "Backend container already stopped or does not exist."
sleep 10
docker rm getactive-frontend || echo "Frontend container already removed or does not exist."
sleep 10
docker rm getactive-backend || echo "Backend container already removed or does not exist."
sleep 10
docker stop getactive-db || echo "Database container already stopped or does not exist."
sleep 10
docker rm getactive-db || echo "Database container already removed or does not exist."
sleep 10
docker network rm frontend-network || echo "Frontend network already removed or does not exist."
sleep 10
docker network rm backend-network || echo "Backend network already removed or does not exist."
sleep 10
docker volume rm mysql_data || echo "Database volume already removed or does not exist."
sleep 10
docker-compose up -d

echo "Cleaning up old Docker images..."
docker image prune -f

echo "Deployment to EC2 completed successfully!"
Loading
Loading