diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..463ad3b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: go +go: + - 1.9 + +notifications: + email: false + +env: + - DEP_VERSION="0.4.1" + +before_install: + - 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 + - chmod +x ./all-test-with-coverage.sh + +install: + - dep ensure + - go get github.com/golang/lint/golint + - go get honnef.co/go/tools/cmd/megacheck + - go get github.com/fzipp/gocyclo + +script: + - ./all-test-with-coverage.sh + - go vet ./... + - megacheck ./... + - gocyclo -over 10 $(find . -iname '*.go' -type f | grep -v /vendor/) +# - golint -set_exit_status $(go list ./...) + +after_success: + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/all-test-with-coverage.sh b/all-test-with-coverage.sh new file mode 100644 index 0000000..eaf5ea0 --- /dev/null +++ b/all-test-with-coverage.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -v -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done \ No newline at end of file