Skip to content

Commit

Permalink
Environment/#130 Jacoco통한 테스트 커버리지 측정 및 자동화 설정 (#138)
Browse files Browse the repository at this point in the history
* Update gradle.yml

* chore: jacoco 환경설정 추가

* chore: JavaComplie 설정 추가

* refactor: Jacoco 설정 변경

* Update gradle.yml

* refactor: Jacoco path 변경

* refactor: JavaComplie 설정 변경

* refactor: run Coverage 설정 추가

* refactor: gradle cache 삭제

* refactor: 캐시 재적용

* chore: jacoco coverage

* chore: failure 조건 추가

* test: failure 호출 테스트

* refactor: 테스트 커버리지 조건 변경

* refactor: 조건문 depth 변경

* refactor: 커버리지 변경

* test: 커버리지 echo 테스트

* refactor: comment update 여부 설정
  • Loading branch information
jjongwa authored Jul 26, 2023
1 parent df296a9 commit 86fe313
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ permissions:
jobs:
build:
runs-on: ubuntu-22.04
permissions:
pull-requests: write

steps:

- uses: actions/checkout@v3

- name: Set up JDK 17
Expand All @@ -25,6 +26,32 @@ jobs:
java-version: '17'
distribution: 'corretto'

- name: cache gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: chmod gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Run Coverage
run: ./gradlew test

- name: run jacocoTestCoverage
id: jacoco
uses: madrapps/[email protected]
with:
title: 📝 Jacoco Test Coverage
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 85
min-coverage-changed-files: 85
update-comment: true
17 changes: 16 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.1.1'
id 'io.spring.dependency-management' version '1.1.0'
id "org.asciidoctor.jvm.convert" version "3.3.2"
id 'jacoco'
}

group = 'hanglog'
Expand Down Expand Up @@ -40,6 +41,21 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
finalizedBy jacocoTestReport
}

jacoco {
toolVersion = '0.8.8'
}

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

tasks.named('test') {
useJUnitPlatform()
}
Expand All @@ -61,4 +77,3 @@ tasks.register('copyApiDocument', Copy) {
build {
dependsOn copyApiDocument
}

0 comments on commit 86fe313

Please sign in to comment.