From ebfb6a490b7fbc84747dca1f55aae045bcdea54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=88=98=EC=A7=84?= <71487608+ssssujini99@users.noreply.github.com> Date: Tue, 2 Jan 2024 13:43:24 +0900 Subject: [PATCH] =?UTF-8?q?[chore]:=20test=20CI=20=EC=88=98=EC=A0=95=20(#5?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-ci.yml | 14 +--- build.gradle | 117 +++++++++------------------------- 2 files changed, 31 insertions(+), 100 deletions(-) diff --git a/.github/workflows/test-ci.yml b/.github/workflows/test-ci.yml index 8fae802b..75e9d958 100644 --- a/.github/workflows/test-ci.yml +++ b/.github/workflows/test-ci.yml @@ -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 diff --git a/build.gradle b/build.gradle index 7a497bfb..d4a0b61c 100644 --- a/build.gradle +++ b/build.gradle @@ -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 // 커버리지 평가 제외 대상 - } - } - } }