File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-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+ docker compose ps
24+
25+ - name : Wait for services with health checks to become healthy
26+ run : |
27+ timeout 180 bash -c '
28+ while true; do
29+ unhealthy=$(docker compose ps --format "{{.Service}} {{.Health}}" | awk '\''$2 != "healthy" && $2 != "" {print $1}'\'')
30+ if [ -z "$unhealthy" ]; then
31+ echo "✅ All services with health checks are healthy!"
32+ break
33+ fi
34+ echo "Still waiting for unhealthy services:"
35+ echo "$unhealthy"
36+ sleep 5
37+ done
38+ '
39+
40+ - name : Tear down Docker Compose
41+ if : always()
42+ run : docker compose down -v
You can’t perform that action at this time.
0 commit comments