-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.26 KB
/
ci.yaml
File metadata and controls
58 lines (48 loc) · 1.26 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
---
name: CI
"on":
push:
branches: [main]
pull_request: true
jobs:
test:
name: Lint, unit tests, integration tests
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
- name: Unit tests (with race detector)
run: go test -race ./internal/... -v
- name: Build binary
run: go build ./cmd/server/...
- name: Start service for integration tests
run: |
REDIS_ADDR=localhost:6379 ./server &
sleep 2 # wait for service to be ready
env:
HTTP_ADDR: ":8080"
GRPC_ADDR: ":50051"
- name: Integration tests
run: go test -tags=integration -v ./tests/integration/...
env:
REDIS_ADDR: localhost:6379
SERVICE_ADDR: http://localhost:8080