-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
36 lines (28 loc) · 1.35 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
language: go
sudo: false
notifications:
email: false
go:
- "1.11"
- "1.12"
env:
- GO111MODULE=on
install:
- go get -t -v ./...
before_script:
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/
- go get golang.org/x/lint/golint # Install golint
- go get honnef.co/go/tools/cmd/staticcheck # Install staticcheck
- go get github.com/fzipp/gocyclo # Install gocycle
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter # Install CodeClimate reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt
- go vet ./... # go vet is the official Go static analyzer
- staticcheck ./... # Static code checking
- gocyclo -over 19 $GO_FILES # forbid code with huge functions
- golint -set_exit_status $(go list ./...) # one last linter
- go test -v -race -coverprofile c.out ./... # Run the tests with race-condition enabled and generate the coverage report
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT # Report coverage to CodeClimate