-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (32 loc) · 856 Bytes
/
test.yml
File metadata and controls
46 lines (32 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Go Tests with Docker Compose
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Compose
run: docker compose version
- name: Build and run services
run: docker compose up -d
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.3'
- name: Install dependencies
run: go mod tidy
- name: Wait for Postgres to be ready
run: |
until docker compose exec -T db pg_isready -U testuser; do
echo "Waiting for Postgres..."
sleep 2
done
- name: Run tests
run: go test -cover ./...
- name: Shutdown
if: always()
run: docker compose down