-
Notifications
You must be signed in to change notification settings - Fork 6
83 lines (72 loc) · 2.57 KB
/
be-ci-pr-code-coverage-test.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: BE/CI - Test Coverage 검증
on:
workflow_dispatch:
pull_request:
types: [opened, ready_for_review]
branches:
- be/develop
jobs:
test-coverage-pr-opened:
defaults:
run:
working-directory: ./backend
if: startsWith(github.head_ref, 'be-')
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Gradle wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle-wrapper.properties', '**/settings.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: |
chmod +x gradlew
- name: Run tests and generate coverage report
env:
JAVA_HOME: ${{ steps.setup-java.outputs.java-home }}
run: ./gradlew test jacocoTestReport
continue-on-error: true
- name: Verify test coverage
env:
JAVA_HOME: ${{ steps.setup-java.outputs.java-home }}
run: ./gradlew jacocoTestCoverageVerification
continue-on-error: true
- name: 테스트 커버리지를 PR에 코멘트로 등록
uses: madrapps/jacoco-report@v1.6.1
with:
title: 📌 Test Coverage Report
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 80
min-coverage-changed-files: 80
- name: Cache Gradle build cache
uses: actions/cache@v3
with:
path: |
${{ runner.workspace }}/backend/.gradle/build-cache
key: ${{ runner.os }}-gradle-build-cache-${{ hashFiles('**/*.gradle*', '**/settings.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-build-cache-
- name: List Gradle build cache directory
run: ls -al ${{ runner.workspace }}/2024-cruru/backend/.gradle/build-cache