|
| 1 | +name: Docker Compose Integration |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ main ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + docker-compose-integration: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + steps: |
| 12 | + - name: Checkout code |
| 13 | + uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Set up Docker Buildx |
| 16 | + uses: docker/setup-buildx-action@v3 |
| 17 | + |
| 18 | + - name: Start services |
| 19 | + run: docker compose up -d |
| 20 | + |
| 21 | + - name: Wait for services to be healthy |
| 22 | + run: | |
| 23 | + echo "Waiting for all services to be healthy..." |
| 24 | + # Wait for services with health checks to be healthy (4 services) and all services to be up |
| 25 | + timeout 300 bash -c 'until [ $(docker compose ps --format "{{.Health}}" | grep -c "healthy") -ge 4 ] && [ $(docker compose ps --format "{{.Status}}" | grep -c "Up") -ge 5 ]; do sleep 5; done' |
| 26 | + docker compose ps |
| 27 | + |
| 28 | + - name: Test dashboard endpoints |
| 29 | + run: | |
| 30 | + curl -f http://localhost:8081/dashboard/ || exit 1 |
| 31 | + curl -f http://localhost:8082 || exit 1 |
| 32 | + |
| 33 | + - name: Test API endpoints |
| 34 | + run: | |
| 35 | + # Test sticker award API with sample user data |
| 36 | + curl -f -X GET "http://localhost:8080/api/award/v1/users/user-001/stickers" || exit 1 |
| 37 | + # Test user management health endpoint |
| 38 | + # TODO! |
| 39 | + # curl -f -X GET "http://localhost:8080/api/users/v1/health" || exit 1 |
| 40 | + |
| 41 | + - name: Show service logs on failure |
| 42 | + if: failure() |
| 43 | + run: | |
| 44 | + echo "=== Docker Compose Services Status ===" |
| 45 | + docker compose ps |
| 46 | + echo "=== Traefik Logs ===" |
| 47 | + docker compose logs traefik |
| 48 | + echo "=== Sticker Award Logs ===" |
| 49 | + docker compose logs sticker-award |
| 50 | + echo "=== User Management Logs ===" |
| 51 | + docker compose logs user-management |
| 52 | + echo "=== Database Logs ===" |
| 53 | + docker compose logs sticker-award-db |
| 54 | + docker compose logs user-management-db |
| 55 | + |
| 56 | + - name: Cleanup |
| 57 | + if: always() |
| 58 | + run: docker compose down -v |
0 commit comments