-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
59 lines (52 loc) · 1.66 KB
/
.travis.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
language: go
go:
- 1.6
- tip
before_install:
- go get github.com/golang/lint/golint
- go get golang.org/x/tools/cmd/vet
- go get github.com/fzipp/gocyclo
- go get github.com/mattn/goveralls
install:
# make sure stuff actually builds
- go build ./cmd/gomutate
script:
# define our own packages so that go does not
# try and build our vendored deps
- |
pkgs=()
while read -r line; do
pkgs+=("$line")
done <<< "$(go list ./... | grep -v 'vendor')"
# ensure everything is formatted all pretty like
- if gofmt -l -s . | grep -v 'vendor/'; then exit 1; fi
# vet out possible issues
- go vet ${pkgs[@]}
# run tests
- go test ${pkgs[@]} -v -race
after_success:
- |
echo "mode: count" > profile.cov
for dir in $(find . -maxdepth 10 -not -path 'vendor' -not -path './.git*' -not -path '*/_*' -type d);
do
if ls $dir/*.go &> /dev/null; then
go test -short -covermode=count -coverprofile=$dir/profile.tmp $dir
if [ -f $dir/profile.tmp ]
then
cat $dir/profile.tmp | tail -n +2 >> profile.cov
rm $dir/profile.tmp
fi
fi
done
go tool cover -func profile.cov
goveralls -coverprofile=profile.cov -service=travis-ci -repotoken=$COVERALLS -v
after_script:
# check possible styling errors
- for pkg in ${pkgs[@]}; do; golint $pkg; done
# check for potentially complex functions but don't fail build
- gocyclo -over 15 . | grep -v 'vendor/' || true
# refresh godocs in case there were api changes
- |
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then
go list ./... | xargs -n 1 -I{} curl http://godoc.org/-/refresh -d path={}
fi