-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (92 loc) · 2.93 KB
/
lint-and-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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Lint and Test with coverage
on:
pull_request:
branches:
- develop
- main
jobs:
ktlint:
name: Check kotlin lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: ktLint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
fail_on_error: true
level: warning
test:
name: Execute test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Execute unit test
run: ./gradlew unitTest
- name: Execute integration test
run: ./gradlew integrationTest
- name: Register test results as comments in PR
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: "build/test-results/**/*.xml"
- name: If test fails, register a Check comment on the failed code line
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: build/test-results/**/*.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: If build fails, notify as Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Build Failure Notification
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ failure() }}
coverage:
needs: test
name: Execute coverage
continue-on-error: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Execute jacoco coverage
run: ./gradlew jacocoTestReport
- name: Register test coverage as a comment in PR
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
title: 📝 테스트 커버리지 리포트입니다
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 50
min-coverage-changed-files: 50
pass-emoji: ':green_circle:'
fail-emoji: ':red_circle:'