[Feat] 엔티티 설계 #6
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
name: CI and request Discord Message to review | |
on: | |
pull_request: | |
branches: | |
- 'develop' | |
types: | |
- opened | |
- reopened | |
- synchronize | |
#동시성 환경을 해결한다 | |
concurrency: | |
group: ${{ github.ref }} # 동일한 PR에 대한 식별자 | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
write-all | |
services: #mysql 설정 | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_DATABASE: testdb | |
MYSQL_ROOT_PASSWORD: testdb | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: JDK 17 를 준비한다. | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: gradlew 의 root 실행권한을 부여한다. | |
run: chmod +x gradlew | |
- name: Gradle 를 준비한다. | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | |
- name: 빌드한다. | |
env: | |
SPRING_DATASOURCE_URL: jdbc:mysql://127.0.0.1:3306/testdb | |
SPRING_DATASOURCE_USERNAME: root | |
SPRING_DATASOURCE_PASSWORD: testdb | |
SPRING_JPA_HIBERNATE_DDL_AUTO: update | |
run: ./gradlew build --stacktrace | |
# Test 후 Report 생성 | |
- name: 테스트 결과를 게시한다. | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
junit_files: '**/build/test-results/test/TEST-*.xml' | |
- name: 실패시 공지한다. | |
if: failure() | |
run: | | |
echo failed! | |
send_discord_message: | |
needs: build | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: 상황에 맞는 메세지를 결정한다. | |
run: | | |
if [ "${{ github.event.action }}" == "opened" ]; then | |
echo "PR_ACTION_MESSAGE=:blush: PR 생성되었습니다" >> $GITHUB_ENV | |
elif [ "${{ github.event.action }}" == "reopened" ]; then | |
echo "PR_ACTION_MESSAGE=:blush: PR 재생성 되었습니다" >> $GITHUB_ENV | |
elif [ "${{ github.event.action }}" == "synchronize" ]; then | |
echo "PR_ACTION_MESSAGE=:blush: 기존 PR에 commit 이 추가되었습니다" >> $GITHUB_ENV | |
fi | |
- name: 작업자와 리뷰어를 결정한다. | |
run: | | |
if [ "${{ github.actor }}" == "david-parkk" ]; then | |
echo "DISCORD_OWNER_ID=<@568069533214965760>" >> $GITHUB_ENV | |
echo "DISCORD_REVIEWER_ID=<@373383545873235970>" >> $GITHUB_ENV | |
else | |
echo "DISCORD_OWNER_ID=<@373383545873235970>" >> $GITHUB_ENV | |
echo "DISCORD_REVIEWER_ID=<@568069533214965760>" >> $GITHUB_ENV | |
fi | |
- name: 성공시 Discord 메세지를 보낸다 | |
if: ${{ needs.build.result == 'success' }} | |
uses: Ilshidur/action-discord@master | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: 개발진스 | |
DISCORD_AVATAR: "https://github.com/user-attachments/assets/1ff8e3ad-40c1-4a99-85cf-367376ed5d93" | |
DISCORD_EMBEDS: ' | |
[ | |
{ | |
"url": "${{github.event.pull_request.html_url}}", | |
"title": "${{ env.PR_ACTION_MESSAGE }}", | |
"fields": [ | |
{ | |
"name": "작업자", | |
"value": "${{env.DISCORD_OWNER_ID}}\n\u200B\n\u200B\n", | |
"inline": true | |
}, | |
{ | |
"name": "리뷰어", | |
"value": "${{env.DISCORD_REVIEWER_ID}}\n", | |
"inline": true | |
}, | |
{ | |
"name": "내용", | |
"value": "[${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})" | |
} | |
] | |
} | |
]' | |
- name: 실패시 실패 메세지를 보낸다 | |
if: ${{ needs.build.result == 'failure' }} | |
uses: Ilshidur/action-discord@master | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: 개발진스 | |
DISCORD_AVATAR: "https://github.com/user-attachments/assets/1ff8e3ad-40c1-4a99-85cf-367376ed5d93" | |
DISCORD_EMBEDS: ' | |
[ | |
{ | |
"url": "${{github.event.pull_request.html_url}}", | |
"title": ":sob: 테스트에 실패했습니다. 다시 확인해주세요 ", | |
"fields": [ | |
{ | |
"name": "작업자", | |
"value": "${{env.DISCORD_OWNER_ID}}\n\u200B\n", | |
"inline": true | |
}, | |
{ | |
"name": "내용", | |
"value": "[${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})" | |
} | |
] | |
} | |
]' | |