Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] CI 설정 #227

Merged
merged 7 commits into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# github repository actions 페이지에 나타날 이름
name: Backend CI

# event trigger
# main 브랜치에 push, PR이 되었을 때 workflow 실행
on:
push:
branches: [ "weekly","develop","main" ]
paths : '**'
pull_request:
branches: [ "weekly","develop","main" ]
paths : '**'

permissions: write-all

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: github actions에서 사용할 JDK를 설정합니다.
uses: actions/checkout@v3
with:
java-version: '17'
distribution: 'temurin'

- name: gradlew 실행 권한을 부여합니다.
run: chmod +x gradlew
shell : bash

- name: DB를 실행합니다.
run: |
docker-compose -f resources/local-develop-environment/docker-compose.yml up -d
sleep 20

- name: gradle를 캐싱합니다.
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: gradle를 build합니다.
run: ./gradlew build

- name: 테스트 결과를 PR에 코멘트로 등록합니다.
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'

- name: 테스트 실패 시, 실패한 코드 라인에 Check 코멘트를 등록합니다.
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}

- name: build 실패 시 Slack으로 알립니다.
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: 백엔드 빌드 실패 알림
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()