File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Go Tests with Docker Compose
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ test :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - uses : actions/checkout@v4
15+
16+ - name : Set up Docker Compose
17+ run : docker compose version
18+
19+ - name : Build and run services
20+ run : docker compose up -d --build
21+
22+ - name : Wait for Postgres to be ready
23+ run : |
24+ until docker-compose exec -T db pg_isready -U testuser; do
25+ echo "Waiting for Postgres..."
26+ sleep 2
27+ done
28+
29+
30+ - name : Set up Go
31+ uses : actions/setup-go@v5
32+ with :
33+ go-version : ' 1.22'
34+
35+ - name : Install dependencies
36+ run : go mod tidy
37+
38+ - name : Run tests
39+ run : go test -cover ./...
40+
41+
42+ - name : Shutdown
43+ if : always()
44+ run : docker-compose down
You can’t perform that action at this time.
0 commit comments