File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Compose Validation
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches : [ main ]
7+
8+ jobs :
9+ validate-compose :
10+ name : Spin up and test health of services
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+
17+ - name : Set up Docker Buildx
18+ uses : docker/setup-buildx-action@v3
19+
20+ - name : Start Docker Compose stack
21+ run : |
22+ docker compose up -d --build
23+ echo "⏳ Waiting for services to become healthy..."
24+ docker compose ps
25+
26+ - name : Wait for services with health checks to become healthy
27+ run : |
28+ timeout 180 bash -c '
29+ while true; do
30+ unhealthy=$(docker compose ps --format "{{.Service}} {{.Health}}" | awk '\''$2 != "healthy" && $2 != "" {print $1}'\'')
31+ if [ -z "$unhealthy" ]; then
32+ echo "✅ All services with health checks are healthy!"
33+ break
34+ fi
35+ echo "Still waiting for unhealthy services:"
36+ echo "$unhealthy"
37+ sleep 5
38+ done
39+ '
40+
41+ - name : Run basic sanity checks
42+ run : |
43+ echo "✅ Checking logs for errors..."
44+ docker compose logs --no-color | grep -i "error" && exit 1 || echo "No errors detected."
45+
46+ - name : Tear down Docker Compose
47+ if : always()
48+ run : docker compose down -v
You can’t perform that action at this time.
0 commit comments