test: 하트비트 추가 #36
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 Test | |
on: | |
pull_request: | |
branches: [ "main", "dev" ] | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
DEFAULT_OUTPUT: ${{ secrets.AWS_DEFAULT_OUTPUT }} | |
WEBHOOK_URL: ${{ secrets.WEBHOOK }} | |
permissions: write-all | |
jobs: | |
test_pr: | |
name: Build and Test | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Set up AWS CLI | |
uses: unfor19/install-aws-cli-action@v1 | |
- name: Configure AWS credentials | |
run: | | |
aws configure set aws_access_key_id ${{ env.AWS_ACCESS_KEY }} | |
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_KEY }} | |
aws configure set default.region ${{ env.AWS_REGION }} | |
aws configure set default.output ${{ env.DEFAULT_OUTPUT }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Test with Gradle | |
run: ./gradlew --info test | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: ${{ always() }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: build/test-results/**/*.xml | |
- name: Send Notification | |
if: ${{ always() }} | |
run: | | |
if [[ ${{ job.status }} == "success" ]]; then | |
MESSAGE="✅ ${{ job.status }} 백엔드 Unit Test 성공: batch-service - by ${{ github.actor }}" | |
else | |
MESSAGE="❌ ${{ job.status }} 백엔드 Unit Test 실패: batch-service - by ${{ github.actor }}" | |
fi | |
curl -X POST -H "Content-Type: application/json" --data "{\"text\":\"${MESSAGE}\"}" ${{ env.WEBHOOK_URL }} |