-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (46 loc) · 1.63 KB
/
Copy pathci.yml
File metadata and controls
56 lines (46 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: CI
on:
pull_request:
branches: [dev, main]
push:
branches: [dev, main]
# 같은 브랜치/PR에서 새 커밋이 올라오면 이전 실행을 취소해 러너 낭비를 줄인다.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# 최소 권한 원칙: 포맷 검사에는 저장소 읽기 권한만 필요하다.
permissions:
contents: read
jobs:
check:
name: Format, Build & Test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 체크아웃 이후 GITHUB_TOKEN을 로컬 git 설정에 남기지 않는다.
persist-credentials: false
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
# google-java-format 기준으로 포맷 준수 여부만 검사한다. 위반 시 spotlessApply 안내와 함께 실패한다.
- name: Format Check (spotless)
run: ./gradlew spotlessCheck --no-daemon
# 컴파일/패키징 + 테스트 검증. 테스트는 H2 in-memory(test 프로파일)로 외부 인프라 없이 돈다.
- name: Build & Test (H2)
run: ./gradlew build --no-daemon -x spotlessCheck
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-report
path: build/reports/tests/test
retention-days: 7