-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
48 lines (38 loc) · 1.56 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
language: go
go:
- 1.9
- 1.8
- 1.7
branches:
only:
- master
cache:
directories:
- $GOPATH/pkg/dep
env:
- DEP_VERSION="0.3.2"
before_install:
# Setup some env variables
- GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/
- PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/
# Setup dependency management tool
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep
# To install latest version, use `go get -u github.com/golang/dep/cmd/dep`
# Install linters
- go get -u github.com/golang/lint/golint # Linter
- go get -u honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter
- go get -u github.com/kisielk/errcheck # errcheck checks that you checked errors.
# Install goveralls, Go integration for Coveralls.io.
- go get -u github.com/mattn/goveralls
install:
- dep ensure
script:
- test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
- go vet $PKGS # go vet is the official Go static analyzer
- megacheck $PKGS # "go vet on steroids" + linter
- errcheck $PKGS # Check for unchecked errors
- golint -set_exit_status $PKGS # One last linter
# Run all the tests, track coverage in coveralls.io
- go test -v -covermode=count -coverprofile=profile.cov $PKGS
- goveralls -coverprofile=profile.cov -service=travis-ci