Skip to content

Commit 5731f03

Browse files
committed
refactor: (#933) test job 의 jacocoReport 를 재사용하여서 test-all job 에서 pr 댓글을 추가하도록 변경
1 parent ba05587 commit 5731f03

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

.github/workflows/CI.yml

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ jobs:
5454
./gradlew :dms-gateway:test jacocoGatewayServiceReport --info
5555
fi
5656
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
63+
5764
- name: Upload coverage for ${{ matrix.service }}
5865
uses: codecov/codecov-action@v4
5966
with:
@@ -64,41 +71,35 @@ jobs:
6471
fail_ci_if_error: false
6572
verbose: true
6673

67-
test-all:
74+
coverage-report:
6875
runs-on: ubuntu-latest
6976
needs: test
77+
if: github.event_name == 'pull_request'
7078

7179
steps:
7280
- name: Checkout code
7381
uses: actions/checkout@v4
7482
with:
7583
fetch-depth: 0
7684

77-
- name: Set up Java
78-
uses: actions/setup-java@v4
85+
- name: Download all JaCoCo reports
86+
uses: actions/download-artifact@v4
7987
with:
80-
java-version: '17'
81-
distribution: 'zulu'
82-
cache: 'gradle'
83-
84-
- name: Setup Gradle
85-
uses: gradle/gradle-build-action@v2
88+
path: build/reports/jacoco/
89+
pattern: jacoco-report-*
90+
merge-multiple: false
8691

87-
- name: Grant execute permission for gradlew
88-
run: chmod +x gradlew
89-
90-
- name: Verify Docker is running
91-
run: docker info
92-
93-
- name: Run all tests
94-
run: ./gradlew test --info
95-
96-
- name: Generate service-specific coverage reports
97-
run: ./gradlew jacocoAllServiceReports --info
98-
99-
- name: Verify Jacoco reports exist
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
100102
run: |
101-
echo "=== Looking for service-specific Jacoco reports ==="
102103
echo "=== Main service report ==="
103104
ls -la build/reports/jacoco/main-service/ || echo "No main service report found"
104105
echo "=== Notification service report ==="
@@ -107,7 +108,6 @@ jobs:
107108
ls -la build/reports/jacoco/gateway-service/ || echo "No gateway service report found"
108109
109110
- name: Delete previous JaCoCo comments
110-
if: github.event_name == 'pull_request'
111111
run: |
112112
COMMENTS=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
113113
--jq '.[] | select(.body | contains("Coverage Report")) | .id')
@@ -120,7 +120,6 @@ jobs:
120120
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121121

122122
- name: Comment PR with main service coverage
123-
if: github.event_name == 'pull_request'
124123
uses: madrapps/jacoco-report@v1.6.1
125124
with:
126125
paths: |
@@ -131,7 +130,6 @@ jobs:
131130
title: '📊 Main Service Coverage Report'
132131

133132
- name: Comment PR with notification service coverage
134-
if: github.event_name == 'pull_request'
135133
uses: madrapps/jacoco-report@v1.6.1
136134
with:
137135
paths: |
@@ -142,7 +140,6 @@ jobs:
142140
title: '📊 Notification Service Coverage Report'
143141

144142
- name: Comment PR with gateway service coverage
145-
if: github.event_name == 'pull_request'
146143
uses: madrapps/jacoco-report@v1.6.1
147144
with:
148145
paths: |

0 commit comments

Comments
 (0)