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

[Deploy] JaCoCo 테스트 커버리지 분석 적용 #127

Merged
merged 3 commits into from
Jul 10, 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
41 changes: 41 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PR Test

on:
pull_request:
branches: [ develop ]

permissions: write-all

jobs:
test:
# 실행 환경
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

# JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# ./gradlew 권한 설정
- name: ./gradlew 권한 설정
run: chmod +x ./gradlew

# Gradle 테스트 수행
- name: ./gradlew 테스트
run: ./gradlew --info test

# Jacoco Test Coverage Report
- name: Test Coverage Report
id: jacoco
uses: madrapps/[email protected]
with:
title: Test Coverage Report
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 70
min-coverage-changed-files: 70
33 changes: 33 additions & 0 deletions 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.9'
id 'io.spring.dependency-management' version '1.1.4'
id "org.asciidoctor.jvm.convert" version "3.3.2"
id 'jacoco'
}

group = 'com'
Expand Down Expand Up @@ -131,3 +132,35 @@ bootJar {
}
}
// -------------------

// Jacoco 설정 -------------------
test {
finalizedBy jacocoTestReport
useJUnitPlatform()
}

jacoco {
toolVersion = "0.8.8"
}

jacocoTestReport {
dependsOn test

afterEvaluate { // report 작성 시 특정 파일 제외
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['**/JisunginApplication',
'**/*Request*',
'**/*Response*',
'com/jisungin/config/**',
'com/jisungin/exception/**',
'com/jisungin/infra/**',
'com/jisungin/trace/**'])
}))
}

reports {
xml.required.set(true)
}
}
// -------------------
1 change: 1 addition & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lombok.addLombokGeneratedAnnotation = true
Loading