This repository has been archived by the owner on Mar 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
/
.travis.yml
62 lines (54 loc) · 1.6 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
60
61
62
language: go
go:
- '1.10'
- '1.11'
- tip
matrix:
allow_failures:
- go: tip
fast_finish: true
before_install:
# linting tools
- go get golang.org/x/lint/golint
- go get github.com/fzipp/gocyclo
# code coverage
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
install:
# make sure stuff actually builds
- go build
script:
# ensure everything is formatted all pretty like
- if gofmt -l -s . | grep '**.go'; then exit 1; fi
# run tests
- go get -t
# vet out possible issues
- go vet ./...
- go test -a -race -v ./...
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 -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
- golint ./...
# check for potentially complex functions but don't false build
- gocyclo -over 15 . || 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