Skip to content

Commit f57583a

Browse files
authored
Merge pull request #15 from depromeet/chore/ci
[Chore] CI 워크플로우 추가
2 parents b5d21a8 + aef9209 commit f57583a

4 files changed

Lines changed: 76 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [ develop, main ]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write # JaCoCo 커버리지 코멘트용
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
token: ${{ secrets.SUBMODULE_TOKEN != '' && secrets.SUBMODULE_TOKEN || github.token }}
21+
22+
- name: Set up JDK 25
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '25'
26+
distribution: 'temurin'
27+
28+
# ── Gradle Setup (Build Cache 포함) ──
29+
- name: Setup Gradle
30+
uses: gradle/actions/setup-gradle@v4
31+
with:
32+
cache-read-only: ${{ github.event_name == 'pull_request' && github.base_ref != 'main' || github.ref != 'refs/heads/main' }}
33+
34+
# ── Lint ──
35+
- name: Run ktlint
36+
run: ./gradlew ktlintCheck
37+
38+
# ── Detekt (정적 분석) ──
39+
- name: Run Detekt
40+
run: ./gradlew detekt
41+
42+
# ── Build & Test + JaCoCo 리포트 생성 ──
43+
- name: Build and Test
44+
run: ./gradlew build jacocoTestReport
45+
46+
# ── JaCoCo 커버리지 PR 코멘트 ──
47+
- name: JaCoCo Coverage Report
48+
if: github.event_name == 'pull_request'
49+
uses: madrapps/jacoco-report@v1.7.1
50+
with:
51+
paths: '**/build/reports/jacoco/test/jacocoTestReport.xml'
52+
token: ${{ secrets.GITHUB_TOKEN }}
53+
min-coverage-overall: 50
54+
min-coverage-changed-files: 70
55+
title: '📊 테스트 커버리지 리포트'
56+
update-comment: true
57+
58+
# ── Docker 이미지 빌드 검증 ──
59+
- name: Docker Build (verification only)
60+
if: hashFiles('Dockerfile') != ''
61+
run: |
62+
docker build -t ${{ github.repository }}:pr-${{ github.event.pull_request.number }} .

build.gradle.kts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
plugins {
2-
kotlin("jvm") version "2.3.10"
3-
kotlin("plugin.spring") version "2.3.10"
2+
kotlin("jvm") version "2.3.0"
3+
kotlin("plugin.spring") version "2.3.0"
44
id("org.springframework.boot") version "4.0.5"
55
id("io.spring.dependency-management") version "1.1.7"
6-
kotlin("plugin.jpa") version "2.2.21"
6+
kotlin("plugin.jpa") version "2.3.0"
77
id("org.jlleitschuh.gradle.ktlint") version "12.3.0"
8+
id("dev.detekt") version "2.0.0-alpha.2"
9+
jacoco
810
}
911

1012
group = "com.team2"
@@ -65,4 +67,12 @@ ktlint {
6567

6668
tasks.withType<Test> {
6769
useJUnitPlatform()
70+
finalizedBy(tasks.jacocoTestReport)
71+
}
72+
73+
tasks.jacocoTestReport {
74+
reports {
75+
xml.required = true
76+
html.required = true
77+
}
6878
}

src/main/kotlin/com/team2/server/common/filter/MdcLoggingFilter.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import java.util.UUID
1010

1111
@Component
1212
class MdcLoggingFilter : OncePerRequestFilter() {
13-
1413
override fun doFilterInternal(
1514
request: HttpServletRequest,
1615
response: HttpServletResponse,

src/test/kotlin/com/team2/server/ServerApplicationTests.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest
66
@SpringBootTest
77
class ServerApplicationTests {
88
@Test
9+
@Suppress("EmptyFunctionBlock")
910
fun contextLoads() {
1011
}
1112
}

0 commit comments

Comments
 (0)