-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 2.84 KB
/
pr_check.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
name: branch build check
on:
pull_request:
branches: [ main, develop, release ]
permissions:
contents: read
issues: read
checks: write
pull-requests: write
jobs:
pr_check:
runs-on: ubuntu-latest
# job 실행 중 필요한 서비스들을 정의한다.
# Docker Container로 설정할 수 있다.
# 이 프로젝트는 PostgreSQL을 사용했기 때문에 postgres 환경으로 구성했다.
services:
postgres:
image: postgres:latest
env:
# application.yml에서 DB를 test로 지정했었다.
POSTGRES_DB: ${{ secrets.TEST_DB }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
POSTGRES_USER: ${{ secrets.DB_USER }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '17'
distribution: 'temurin'
- name: make application.yml
run: |
mkdir ./src/main/resources
touch ./application.yml
echo "${{ secrets.PROPERTIES }}" > ./application.yml
shell: bash
- name: make test application.yml
run: |
mkdir ./src/test/resources
touch ./application.yml
echo "${{ secrets.TEST-PROPERTIES }}" > ./application.yml
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: Test with Gradle
run: ./gradlew test
- name: ktlintCheck with Gradle
run: ./gradlew ktlintCheck
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: build/test-results/**/*.xml
- name: On Failed, Notify in Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#ff0000'
SLACK_ICON: https://avatars.githubusercontent.com/u/108561231?size=48
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: 'CI checks have failed ⚠️🚫'
MSG_MINIMAL: true
SLACK_USERNAME: 어? 도랏노바?
SLACK_MESSAGE: 'CI checks 실패했노바⚠️'
- name: On Success
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: '#53A551'
SLACK_ICON: https://avatars.githubusercontent.com/u/108561231?size=48
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: 'All checks have passed ✅🫡'
MSG_MINIMAL: true
SLACK_USERNAME: 슈퍼노바
SLACK_MESSAGE: 'CI check 성공했노바 🎉'