-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (72 loc) · 2 KB
/
Copy pathci.yml
File metadata and controls
77 lines (72 loc) · 2 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI
on:
push:
branches: [master, main]
pull_request:
permissions:
contents: read
jobs:
test:
name: build & test (go ${{ matrix.go }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ['1.21', 'stable']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true
- name: gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files are not gofmt-formatted:"
echo "$unformatted"
exit 1
fi
- name: go vet
run: go vet ./...
- name: build (integration tag compiles)
run: go build -tags integration ./...
- name: test
run: go test -race -count=1 ./...
integration:
name: integration (real redis)
runs-on: ubuntu-latest
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
cache: true
- name: integration tests
env:
REDIS_ADDR: localhost:6379
run: go test -tags integration -race -count=1 -run Integration ./...
lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
cache: true
# Install golangci-lint v2 directly (the .golangci.yml uses the v2 schema).
- name: install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v2.12.2
- name: run golangci-lint
run: "$(go env GOPATH)/bin/golangci-lint run --timeout 5m ./..."