-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (51 loc) · 1.44 KB
/
Copy pathci.yml
File metadata and controls
63 lines (51 loc) · 1.44 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: journal
POSTGRES_USER: journal
POSTGRES_PASSWORD: journal
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Start NATS JetStream
run: docker run -d -p 4222:4222 -p 8222:8222 --name nats nats:2.10-alpine -js
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: Install dependencies
run: go mod download
- name: Vet
run: go vet ./...
- name: Run Tests (Unit & Domain)
run: go test -race -v ./internal/domain/... ./internal/ledger/...
- name: Run Integration Tests
env:
DATABASE_URL: postgresql://journal:journal@localhost:5432/journal?sslmode=disable
run: |
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
migrate -path migrations -database "$DATABASE_URL" up
go test -v ./test/integration/...
- name: Build
run: go build -v ./cmd/api/...