Skip to content

[feature] #34 swagger 전용 Auth API 추가 #201

[feature] #34 swagger 전용 Auth API 추가

[feature] #34 swagger 전용 Auth API 추가 #201

Workflow file for this run

name: Backend CI
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
pull_request_target:
branches: [ dev ] # fork PR secrets 사용 가능
types: [opened, synchronize, reopened]
jobs:
build-and-test:
runs-on: ubuntu-latest
if: |
(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
github.event_name == 'push'
services:
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: ${{ secrets.DB_NAME }}
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homeaid_user
MYSQL_PASSWORD: ${{ secrets.DB_PASSWORD }}
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout PR code (fork PR only)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout code (for push or internal pull_request)
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3
- name: Set up JDK 17 (corretto)
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: gradle # 👉 캐시 추가: 빌드 속도 향상
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and Test
env:
DB_DRIVER: ${{ secrets.DB_DRIVER }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: ./gradlew clean build
- name: Notify success on Discord
if: success()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "✅ CI 성공",
"description": "**📦 Repository:** `${{ github.repository }}`\n**🌿 Branch:** `${{ github.ref_name }}`\n**🧪 Workflow:** `${{ github.workflow }}`\n**🎯 Event:** `${{ github.event_name }}`\n**👤 작성자:** `${{ github.actor }}`\n\n[🔗 GitHub Actions 로그 확인하기](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n${{ github.event_name == 'pull_request' && format('[🔍 PR 보기](https://github.com/{0}/pull/{1})', github.repository, github.event.pull_request.number) || '' }}",
"color": 5763719
}],
"content": "✅ CI 통과: `${{ github.ref_name }}` 브랜치입니다!"
}' \
${{ secrets.DISCORD_WEBHOOK }}
- name: Notify failure on Discord
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "❌ CI 실패",
"description": "**📦 Repository:** `${{ github.repository }}`\n**🌿 Branch:** `${{ github.ref_name }}`\n**🧪 Workflow:** `${{ github.workflow }}`\n**🎯 Event:** `${{ github.event_name }}`\n**👤 작성자:** `${{ github.actor }}`\n\n[🔗 GitHub Actions 로그 확인하기](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n${{ github.event_name == 'pull_request' && format('[🔍 PR 보기](https://github.com/{0}/pull/{1})', github.repository, github.event.pull_request.number) || '' }}",
"color": 16711680
}],
"content": "❗ CI 실패 발생: `${{ github.ref_name }}` 브랜치 확인해주세요!"
}' \
${{ secrets.DISCORD_WEBHOOK }}