-
Notifications
You must be signed in to change notification settings - Fork 21
102 lines (86 loc) · 3.47 KB
/
ci.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
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 체크아웃
uses: actions/checkout@v4
with:
fetch-depth: 0
# java 17
- name: JDK 17 설치
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: gradle 권한부여
run: chmod +x gradlew
- name: gradle 빌드
run: ./gradlew build -Pprofile=ci
- name: detekt 정적 분석
run: ./gradlew detekt
- name: detekt 리포트
uses: actions/github-script@v5
with:
script: |
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find(comment => comment.body.includes('Detekt 정적 분석 결과'));
if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: 'Detekt 정적 분석 결과\n' + require('fs').readFileSync('build/reports/detekt/detekt.md', 'utf8'),
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'Detekt 정적 분석 결과\n' + require('fs').readFileSync('build/reports/detekt/detekt.md', 'utf8'),
});
}
- name: Install Pandoc
run: sudo apt-get install -y pandoc
- name: kover 커버리지 리포트 변환
run: |
pandoc mains/monolith-main/build/reports/kover/html/index.html -f html -t gfm -o output.md
sed -n '/# monolith-main: Overall Coverage Summary/,/# Coverage Breakdown/p' output.md | grep -v '# Coverage Breakdown' > coverage-summary.md
echo "COVERAGE_SUMMARY_PATH=$(pwd)/coverage-summary.md" >> $GITHUB_ENV
- name: kover coverage report
uses: actions/github-script@v5
with:
script: |
const fs = require('fs');
const path = process.env.COVERAGE_SUMMARY_PATH;
const coverageData = fs.readFileSync(path, 'utf8');
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find(comment => comment.body.includes('kover 커버리지 결과'));
if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: 'kover 커버리지 결과\n' + coverageData,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'kover 커버리지 결과\n' + coverageData,
});
}