Merge pull request #305 from jiucchu/main #128
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# github repository actions 페이지에 나타날 이름 | |
name: Backend CI | |
# event trigger | |
# main 브랜치에 push, PR이 되었을 때 workflow 실행 | |
on: | |
push: | |
branches: [ "main","be" ] | |
paths : 'BE/**' | |
pull_request: | |
branches: [ "main","be" ] | |
paths : 'BE/**' | |
defaults: | |
run: | |
working-directory: BE/eeos | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# JDK setting : github actions에서 사용할 JDK 설정 | |
- name: Set up JDK 17 | |
- uses: actions/checkout@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# gradlew에 실행 권한을 부여합니다. | |
- name: Grant execute permisson for gradlew | |
run: chmod +x gradlew | |
shell : bash | |
# gradle caching - 빌드 시간 향상 | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
# gradle build | |
- name: Build with Gradle | |
working-directory : ./be/overflow | |
run: ./gradlew build -x test | |
- 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() |