forked from linuxboot/fiano
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
122 lines (122 loc) · 3.32 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# 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: circleci/golang:1.11
working_directory: /go/src/github.com/linuxboot/fiano
steps:
- checkout
- run:
name: Install dep
command: |
wget https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
mv dep-linux-amd64 dep
chmod +x dep
- run:
name: Install golint
command: go get -u golang.org/x/lint/golint
- run:
name: Install ineffassign
command: go get github.com/gordonklaus/ineffassign
- run:
name: Check vendored dependencies
command: |
./dep status
./dep ensure -vendor-only
git status vendor
if [[ -n "$(git status --porcelain vendor)" ]]; then
echo 'vendor/ is out-of-date: run `dep ensure -vendor-only` and then check in the changes'
git status --porcelain vendor
exit 1
fi
- run:
name: vet
command: |
go tool vet cmds pkg
- run:
name: gofmt
command: test -z "$(gofmt -s -l cmds pkg)"
- run:
name: golint
command: golint --set_exit_status $(go list ./... | grep -v /vendor/)
- run:
name: ineffassign
command: ineffassign .
test:
docker:
- image: circleci/golang:1.11
working_directory: /go/src/github.com/linuxboot/fiano
environment:
- CGO_ENABLED: 0
steps:
- checkout
- run:
name: Test all
command: go test -a -ldflags '-s' ./...
- run:
name: Test coverage
command: go test -cover ./...
race:
docker:
- image: circleci/golang:1.11
working_directory: /go/src/github.com/linuxboot/fiano
environment:
- CGO_ENABLED: 1
steps:
- checkout
- run:
name: Race detector
command: go test -race ./...
coverage:
docker:
- image: circleci/golang:1.11
working_directory: /go/src/github.com/linuxboot/fiano
environment:
- CGO_ENABLED: 0
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: circleci/golang:1.11
working_directory: /go/src/github.com/linuxboot/fiano
environment:
- CGO_ENABLED: 0
steps:
- checkout
- run:
name: Check licenses
command: go run scripts/checklicenses/checklicenses.go