final branch maybe #47
This file contains hidden or 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: | |
| push: | |
| branches: master | |
| pull_request: | |
| branches: [ "*" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📂 Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: 🐋 Docker Build | |
| run: docker build -t task27:test . | |
| - name: ⏬ Install Docker Compose | |
| run: | | |
| sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| docker-compose --version | |
| - name: 🐋 Docker Run (MySQL & Redis) | |
| run: docker-compose -f compose.yaml up -d | |
| - name: ⌛ Wait for Services | |
| run: sleep 30 | |
| - name: 🐋 Run Task.2-7 Server Container | |
| run: docker run --name task27-server --network=compose_default -d -p 8080:8080 -e APP_JAR=/app/task27-0.0.1-SNAPSHOT.jar task27:test | |
| - name: ⌛ Wait for Application | |
| run: sleep 45 | |
| - name: 📃 Log Trace | |
| run: | | |
| echo "📢 Tracking logs for task27-server..." | |
| timeout 60s docker logs -f task27-server | |
| - name: 🧪 Test Application | |
| run: | | |
| RESPONSE=$(curl -s "http://localhost:1234/health/check") | |
| if [ "$RESPONSE" != "OK" ]; then | |
| echo "💣 Health Check Failed" | |
| exit 1 | |
| fi |