Skip to content

Commit f1330e6

Browse files
authored
merge: (#933) 테스트 커버리지 향상을 위한 단위/통합 테스트 추가 및 CI 워크플로우 변경
2 parents 0600d77 + c62e6fc commit f1330e6

File tree

59 files changed

+3397
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3397
-90
lines changed

.github/workflows/CI.yml

Lines changed: 118 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,141 @@ on:
1010
- main
1111
- develop
1212

13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
1317
jobs:
14-
build:
18+
test:
1519
runs-on: ubuntu-latest
1620

21+
strategy:
22+
matrix:
23+
service: [main, notification, gateway]
24+
1725
steps:
18-
- uses: actions/checkout@v3
19-
- uses: codecov/codecov-action@v1
26+
- name: Checkout code
27+
uses: actions/checkout@v4
2028
with:
21-
token: ${{ secrets.CODECOV_TOKEN }}
29+
fetch-depth: 0
2230

2331
- name: Set up Java
24-
uses: actions/setup-java@v2
32+
uses: actions/setup-java@v4
2533
with:
2634
java-version: '17'
2735
distribution: 'zulu'
36+
cache: 'gradle'
2837

2938
- name: Setup Gradle
3039
uses: gradle/gradle-build-action@v2
3140

3241
- name: Grant execute permission for gradlew
3342
run: chmod +x gradlew
3443

35-
- name: codecov gradle
36-
run: ./gradlew test jacocoSubReports
44+
- name: Verify Docker is running
45+
run: docker info
46+
47+
- name: Run tests for ${{ matrix.service }} service
48+
run: |
49+
if [ "${{ matrix.service }}" = "main" ]; then
50+
./gradlew :dms-main:test jacocoMainServiceReport --info
51+
elif [ "${{ matrix.service }}" = "notification" ]; then
52+
./gradlew :dms-notification:test jacocoNotificationServiceReport --info
53+
elif [ "${{ matrix.service }}" = "gateway" ]; then
54+
./gradlew :dms-gateway:test jacocoGatewayServiceReport --info
55+
fi
56+
57+
- name: Upload JaCoCo report artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: jacoco-report-${{ matrix.service }}
61+
path: build/reports/jacoco/${{ matrix.service }}-service/
62+
retention-days: 1
3763

38-
- name: Upload coverage to Codecov
39-
uses: codecov/codecov-action@v2
64+
- name: Upload coverage for ${{ matrix.service }}
65+
uses: codecov/codecov-action@v4
4066
with:
4167
token: ${{ secrets.CODECOV_TOKEN }}
42-
files: '**/build/reports/jacoco/test/jacocoTestReport.xml'
68+
files: build/reports/jacoco/${{ matrix.service }}-service/jacocoTestReport.xml
69+
flags: ${{ matrix.service }}-service
70+
name: ${{ matrix.service }}-service-coverage
71+
fail_ci_if_error: false
72+
verbose: true
73+
74+
coverage-report:
75+
runs-on: ubuntu-latest
76+
needs: test
77+
if: github.event_name == 'pull_request'
78+
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 0
84+
85+
- name: Download all JaCoCo reports
86+
uses: actions/download-artifact@v4
87+
with:
88+
path: build/reports/jacoco/
89+
pattern: jacoco-report-*
90+
merge-multiple: false
91+
92+
- name: Move reports to correct location
93+
run: |
94+
mkdir -p build/reports/jacoco/main-service
95+
mkdir -p build/reports/jacoco/notification-service
96+
mkdir -p build/reports/jacoco/gateway-service
97+
cp -r build/reports/jacoco/jacoco-report-main/* build/reports/jacoco/main-service/ 2>/dev/null || true
98+
cp -r build/reports/jacoco/jacoco-report-notification/* build/reports/jacoco/notification-service/ 2>/dev/null || true
99+
cp -r build/reports/jacoco/jacoco-report-gateway/* build/reports/jacoco/gateway-service/ 2>/dev/null || true
100+
101+
- name: Verify JaCoCo reports exist
102+
run: |
103+
echo "=== Main service report ==="
104+
ls -la build/reports/jacoco/main-service/ || echo "No main service report found"
105+
echo "=== Notification service report ==="
106+
ls -la build/reports/jacoco/notification-service/ || echo "No notification service report found"
107+
echo "=== Gateway service report ==="
108+
ls -la build/reports/jacoco/gateway-service/ || echo "No gateway service report found"
109+
110+
- name: Delete previous JaCoCo comments
111+
run: |
112+
COMMENTS=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
113+
--jq '.[] | select(.body | contains("Coverage Report")) | .id')
114+
115+
for comment_id in $COMMENTS; do
116+
echo "Deleting comment $comment_id"
117+
gh api repos/${{ github.repository }}/issues/comments/$comment_id -X DELETE
118+
done
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Comment PR with main service coverage
123+
uses: madrapps/jacoco-report@v1.6.1
124+
with:
125+
paths: |
126+
build/reports/jacoco/main-service/jacocoTestReport.xml
127+
token: ${{ secrets.GITHUB_TOKEN }}
128+
min-coverage-overall: 24
129+
min-coverage-changed-files: 50
130+
title: '📊 Main Service Coverage Report'
131+
132+
- name: Comment PR with notification service coverage
133+
uses: madrapps/jacoco-report@v1.6.1
134+
with:
135+
paths: |
136+
build/reports/jacoco/notification-service/jacocoTestReport.xml
137+
token: ${{ secrets.GITHUB_TOKEN }}
138+
min-coverage-overall: 25
139+
min-coverage-changed-files: 50
140+
title: '📊 Notification Service Coverage Report'
141+
142+
- name: Comment PR with gateway service coverage
143+
uses: madrapps/jacoco-report@v1.6.1
144+
with:
145+
paths: |
146+
build/reports/jacoco/gateway-service/jacocoTestReport.xml
147+
token: ${{ secrets.GITHUB_TOKEN }}
148+
min-coverage-overall: 0
149+
min-coverage-changed-files: 50
150+
title: '📊 Gateway Service Coverage Report'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ out/
4242
### Claude Code ###
4343
CLAUDE.md
4444
.claude/*
45+
tmpclaude-*

0 commit comments

Comments
 (0)