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- // .github/workflows/ci.yaml
1+ ---
2+ name : CI
3+
4+ " on " :
5+ push :
6+ branches : [main]
7+ pull_request : true
8+
9+ jobs :
10+ test :
11+ name : Lint, unit tests, integration tests
12+ runs-on : ubuntu-latest
13+
14+ services :
15+ redis :
16+ image : redis:7-alpine
17+ ports :
18+ - 6379:6379
19+ options : >-
20+ --health-cmd "redis-cli ping"
21+ --health-interval 5s
22+ --health-timeout 3s
23+ --health-retries 5
24+
25+ steps :
26+ - name : Checkout
27+ uses : actions/checkout@v4
28+
29+ - name : Set up Go
30+ uses : actions/setup-go@v5
31+ with :
32+ go-version : ' 1.22'
33+ cache : true
34+
35+ - name : Lint
36+ uses : golangci/golangci-lint-action@v4
37+ with :
38+ version : latest
39+
40+ - name : Unit tests (with race detector)
41+ run : go test -race ./internal/... -v
42+
43+ - name : Build binary
44+ run : go build ./cmd/server/...
45+
46+ - name : Start service for integration tests
47+ run : |
48+ REDIS_ADDR=localhost:6379 ./server &
49+ sleep 2 # wait for service to be ready
50+ env :
51+ HTTP_ADDR : " :8080"
52+ GRPC_ADDR : " :50051"
53+
54+ - name : Integration tests
55+ run : go test -tags=integration -v ./tests/integration/...
56+ env :
57+ REDIS_ADDR : localhost:6379
58+ SERVICE_ADDR : http://localhost:8080
You can’t perform that action at this time.
0 commit comments