자동 테스트 파이프라인 구축 #2
Workflow file for this run
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: Test and Build | |
on: | |
pull_request: | |
branches: ["*"] | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
gradle: | |
runs-on: ubuntu-latest | |
environment: Build-Test | |
steps: | |
- name: 📂 Checkout Repository | |
uses: actions/checkout@v3 | |
- name: 🏗️ Setup JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: 🎖️ Grant Execute Permission | |
run: chmod +x gradlew | |
- name: 🔨 Build Gradle | |
run: ./gradlew build --no-daemon -x test | |
- name: 🪂 Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: build/libs/*.jar | |
- name: 🧪 Test Gradle | |
run: ./gradlew test --no-daemon | |
docker: | |
runs-on: ubuntu-latest | |
environment: Build-Test | |
needs: gradle | |
steps: | |
- name: 📂 Checkout Repository | |
uses: actions/checkout@v3 | |
- name: 📦 Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: build/libs | |
pattern: groom-0.0.1-SNAPSHOT.jar | |
- name: 🐋 Docker Build | |
run: docker build -t groom-server:test . | |
- name: 🐋 Docker Run | |
run: docker-compose -f docker-compose.test.yml up -d | |
- name: ⌛ Wait for Application | |
run: sleep 30 | |
- name: 🧪 Test Application | |
run: | | |
RESPONSE=\$(curl -s http://127.0.0.1:8080${{ secrets.HEALTH_CHECK_PATH }}/) | |
if [ "\$RESPONSE" != "OK" ]; then | |
echo "💣 Health Check Failed" | |
exit 1 | |
fi |