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 health endpoints
29+ run : |
30+ curl -f http://localhost:8080/health || exit 1
31+ curl -f http://localhost:8081/dashboard/ || exit 1
32+ curl -f http://localhost:8082 || exit 1
33+
34+ - name : Test API endpoints
35+ run : |
36+ # Test basic connectivity to services through Traefik
37+ curl -f -X GET "http://localhost:8080/api/award/health" || exit 1
38+ curl -f -X GET "http://localhost:8080/api/users/health" || exit 1
39+
40+ - name : Show service logs on failure
41+ if : failure()
42+ run : |
43+ echo "=== Docker Compose Services Status ==="
44+ docker compose ps
45+ echo "=== Traefik Logs ==="
46+ docker compose logs traefik
47+ echo "=== Sticker Award Logs ==="
48+ docker compose logs sticker-award
49+ echo "=== User Management Logs ==="
50+ docker compose logs user-management
51+ echo "=== Database Logs ==="
52+ docker compose logs sticker-award-db
53+ docker compose logs user-management-db
54+
55+ - name : Cleanup
56+ if : always()
57+ run : docker compose down -v
0 commit comments