Skip to content

Feat: 배포파일 및 테스트코드 name 분리, 테스트코드 결과 제공, 배포 성공여부 슬랙메세지 전송 #155

Feat: 배포파일 및 테스트코드 name 분리, 테스트코드 결과 제공, 배포 성공여부 슬랙메세지 전송

Feat: 배포파일 및 테스트코드 name 분리, 테스트코드 결과 제공, 배포 성공여부 슬랙메세지 전송 #155

Workflow file for this run

name: Run Tests on Pull Request
on:
pull_request:
branches:
- Weekly
permissions: write-all
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis:alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }}
MYSQL_USER: ${{ secrets.MYSQL_USERNAME }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: 📥 Checkout Repository
uses: actions/checkout@v4
- name: ☕ Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: 🧪 Run Tests and Generate Results
env:
SPRING_DATASOURCE_URL: ${{ secrets.MYSQL_URL }}
SPRING_DATASOURCE_USERNAME: ${{ secrets.MYSQL_USERNAME }}
SPRING_DATASOURCE_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
SPRING_JPA_HIBERNATE_DDL_AUTO: "update"
JWT_SECRET: ${{ secrets.JWT_SECRET }}
SLACK_NOTICE_WEBHOOK_URL: ${{ secrets.SLACK_NOTICE_WEBHOOK_URL }}
SLACK_CHARGE_REQUEST_URL: ${{ secrets.SLACK_CHARGE_REQUEST_URL }}
SLACK_WITHDRAW_REQUEST_URL: ${{ secrets.SLACK_WITHDRAW_REQUEST_URL }}
run: ./gradlew clean build -Dspring.profiles.active=test
- name: 📑 Publish Test Results as PR Comment
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: '**/build/test-results/test/TEST-*.xml'
- name: ✅ Add Check Comments for Failed Code Lines
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}