Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore]: test CI 수정 #51

Merged
merged 1 commit into from
Jan 2, 2024
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
14 changes: 1 addition & 13 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,4 @@ jobs:
- name: test CI
uses: gradle/gradle-build-action@v2
with:
arguments: clean test jacocoTestReport jacocoTestCoverageVerification

- name: Add coverage to PR
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
paths: |
${{ github.workspace }}/interpark/api/build/reports/jacoco/jacocoTestReport.xml,
${{ github.workspace }}/interpark/core/build/reports/jacoco/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: '# :lobster: Test Coverage Report'
pass-emoji: ':green_circle:'
fail-emoji: ':red_circle:'
arguments: clean test
117 changes: 30 additions & 87 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,94 +1,37 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
id 'java'
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
}

subprojects {

apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: "java-test-fixtures"
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "java-test-fixtures"

group = 'dev.hooon'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
mavenCentral()
}

// 공통 dependencies
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-starter-validation'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

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

group = 'dev.hooon'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
mavenCentral()
}

// 공통 dependencies
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-starter-validation'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
finalizedBy 'jacocoTestReport' // test 이후 커버리지 실행
}

jacoco {
toolVersion = '0.8.8'
}

jacocoTestReport {
reports {
xml.required = true
html.required = true
}

def Qdomains = []

for (qPattern in '**/QA'..'**/QZ') { // qPattern = '*.QA', '*.QB', ... '*.QZ'
Qdomains.add(qPattern + '*')
}

afterEvaluate { // report 제외대상 지정
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, excludes: [] + Qdomains)
})
)
}

finalizedBy 'jacocoTestCoverageVerification' // 커버리지 이후에 평가
}

jacocoTestCoverageVerification { // 커버리지 상세설정
def Qdomains = []

for (qPattern in '*.QA'..'*.QZ') { // qPattern = '*.QA', '*.QB', ... '*.QZ'
Qdomains.add(qPattern + '*')
}

violationRules {
rule {
enabled = true
element = 'CLASS'

limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.0
}

limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.0
}

excludes = [] + Qdomains // 커버리지 평가 제외 대상
}
}
}
}