-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathconfig.yml
88 lines (88 loc) · 2.13 KB
/
config.yml
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
78
79
80
81
82
83
84
85
86
87
88
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
workflows:
version: 2
build_and_test:
jobs:
- clean-code
- test:
requires:
- clean-code
- race:
requires:
- clean-code
- coverage:
requires:
- clean-code
- check_licenses:
requires:
- clean-code
jobs:
clean-code:
docker:
- image: cimg/go:1.22
steps:
- checkout
- run:
name: Install ineffassign
command: |
go install github.com/gordonklaus/ineffassign@latest
ineffassign ./...
- run:
name: Check dependencies
command: |
go mod download
go mod verify
- run:
name: gofmt
command: test -z "$(gofmt -s -l cmds pkg)"
test:
docker:
- image: cimg/go:1.22
steps:
- checkout
- run:
name: Test all
command: go test -a -ldflags '-s' ./...
- run:
name: Test coverage
command: go test -cover ./...
# https://circleci.com/docs/2.0/configuration-reference/#resourceclass
resource_class: medium
race:
docker:
- image: cimg/go:1.22
steps:
- checkout
- run:
name: Race detector
command: go test -race ./...
coverage:
docker:
- image: cimg/go:1.22
steps:
- checkout
- run:
name: Test Coverage
command: |
set -e
> coverage.txt
for d in $(go list ./... | grep -v vendor); do
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
- run:
name: Report Coverage
when: on_success
command: bash <(curl -s https://codecov.io/bash)
check_licenses:
docker:
- image: cimg/go:1.22
steps:
- checkout
- run:
name: Check licenses
command: go run scripts/checklicenses/checklicenses.go