diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8de244a3..f76cb3f7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,16 +10,30 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: ๐Ÿ“ฅ Checkout Repository uses: actions/checkout@v4 - - name: Set up SSH + - name: ๐Ÿ” Set Up SSH Authentication uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Run deployment script on server + - name: ๐Ÿš€ Run Deployment Script on Server env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} run: | ssh -o StrictHostKeyChecking=no ubuntu@${{ secrets.SERVER_IP }} "SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK_URL }} bash /home/ubuntu/deploy.sh" + # ์„œ๋ฒ„์˜ deploy.sh ์Šคํฌ๋ฆฝํŠธ๋ฅผ ํ†ตํ•ด ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค. + # ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ ์„ฑ๊ณต ์‹œ Slack ์•Œ๋ฆผ์„ ์ „์†กํ•˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. + + - name: ๐Ÿ“ข Notify Deployment Status on Slack + if: always() + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + run: | + if [ $? -eq 0 ]; then + curl -X POST -H 'Content-type: application/json' --data '{"text": "๐ŸŽ‰ *์ตœ์ข… ๋ฐฐํฌ ์„ฑ๊ณต* - ๋ฐฐํฌ๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!"}' $SLACK_WEBHOOK_URL + else + curl -X POST -H 'Content-type: application/json' --data '{"text": "โš ๏ธ *๋ฐฐํฌ ์‹คํŒจ* - ๋ฐฐํฌ ๊ณผ์ •์—์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค."}' $SLACK_WEBHOOK_URL + fi + # ๋ฐฐํฌ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์‹คํ–‰๋˜์—ˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ Slack์œผ๋กœ ์•Œ๋ฆฝ๋‹ˆ๋‹ค. diff --git a/.github/workflows/testcode.yml b/.github/workflows/testcode.yml index c2e37403..71488fce 100644 --- a/.github/workflows/testcode.yml +++ b/.github/workflows/testcode.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - Weekly +permissions: write-all jobs: test: @@ -33,18 +34,17 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - - name: Checkout code + - name: ๐Ÿ“ฅ Checkout Repository uses: actions/checkout@v4 - - name: Set up JDK + - name: โ˜• Set up JDK uses: actions/setup-java@v4 with: java-version: '21' distribution: 'temurin' - - name: Run Tests + - name: ๐Ÿงช Run Tests and Generate Results env: SPRING_DATASOURCE_URL: ${{ secrets.MYSQL_URL }} SPRING_DATASOURCE_USERNAME: ${{ secrets.MYSQL_USERNAME }} @@ -54,4 +54,17 @@ jobs: 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 test + 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 }}