Skip to content

Commit 274023d

Browse files
Merge pull request #24 from One-armed-boy/etc/actionCoverage
Github Action 내 테스트 커버리지 측정 추가
2 parents e4b680b + 837723e commit 274023d

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

.github/workflows/pr-check.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ jobs:
3232
- name: Check Build
3333
run: ./gradlew clean build
3434

35-
- name: Publish Test Results
36-
uses: EnricoMi/publish-unit-test-result-action@v2
37-
if: always()
35+
- name: Run test
36+
run: ./gradlew test
37+
38+
- name: Add coverage to PR
39+
id: jacoco
40+
uses: madrapps/[email protected]
3841
with:
39-
files: |
40-
build/test-results/**/*.xml
41-
build/test-results/**/*.trx
42-
build/test-results/**/*.json
42+
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
min-coverage-overall: 40
45+
min-coverage-changed-files: 60
46+
update-comment: true
47+
pass-emoji: ':green_circle:'
48+
fail-emoji: ':red_circle:'

build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java'
33
id 'org.springframework.boot' version '3.2.0'
44
id 'io.spring.dependency-management' version '1.1.4'
5+
id 'jacoco'
56
}
67

78
group = 'com.stream'
@@ -11,6 +12,10 @@ java {
1112
sourceCompatibility = '17'
1213
}
1314

15+
jacoco {
16+
toolVersion = "0.8.9"
17+
}
18+
1419
configurations {
1520
compileOnly {
1621
extendsFrom annotationProcessor
@@ -47,4 +52,14 @@ dependencies {
4752

4853
tasks.named('test') {
4954
useJUnitPlatform()
55+
finalizedBy jacocoTestReport
56+
}
57+
58+
jacocoTestReport {
59+
dependsOn test // tests are required to run before generating the report
60+
reports {
61+
xml.required = true
62+
html.required = false
63+
csv.required = false
64+
}
5065
}

0 commit comments

Comments
 (0)