Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .github/workflows/prod-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -74,3 +76,12 @@ jobs:
SPRING_DATASOURCE_USERNAME: runnect
SPRING_DATASOURCE_PASSWORD: runnect_local_password
SPRING_DATA_REDIS_HOST: localhost

# PR에서 새로 추가/수정된 라인만 커버리지를 검사한다 (전체 커버리지 게이트가 아님).
# 로직이 바뀌었는데 테스트가 안 따라오는 경우를 CI에서 기계적으로 잡기 위함.
- name: Diff coverage 게이트 (변경된 라인 기준)
run: |
pip install diff-cover
diff-cover build/reports/jacoco/test/jacocoTestReport.xml \
--compare-branch=origin/${{ github.base_ref }} \
--fail-under=70
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ public class SomeService {

yml에 키가 없으면 기본값은 비활성(`false`)이다.

### ✅ Diff Coverage 게이트

PR에서 새로 추가/수정된 라인이 테스트로 커버되는지 CI(`build` job)가 자동으로 확인한다 — 로직을 고쳤는데 관련 테스트가 안 따라오는 경우를 기계적으로 잡기 위함. 전체 커버리지가 아니라 **이번 PR에서 바뀐 라인만** 대상으로 하며, 기준은 70%다.

```bash
# CI에서 실행되는 것과 동일한 방식으로 로컬에서 직접 확인
./gradlew jacocoTestReport
pip install diff-cover
diff-cover build/reports/jacoco/test/jacocoTestReport.xml --compare-branch=origin/main
```

</aside>
<hr>
</br>
Expand Down
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'jacoco'
id 'org.springframework.boot' version '2.7.14'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}
Expand Down Expand Up @@ -79,4 +80,13 @@ dependencies {

tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}
Loading