From dcbf7f86d617ee7d4975a2e61da5ed356739388e Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 15 Dec 2013 12:13:59 +0400 Subject: [PATCH] Try to run coverage only on go1.2. --- .travis.yml | 2 +- Makefile | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 213a1529..69925298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ install: - go get launchpad.net/gocheck -script: make test \ No newline at end of file +script: make travis \ No newline at end of file diff --git a/Makefile b/Makefile index ce4f1e11..cb5e3b4a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,30 @@ -prepare: +GOVERSION=$(shell go version | awk '{print $$3;}') + +ifeq ($(TRAVIS), yes) +GOVERALLS?=$(HOME)/gopath/bin/goveralls +else +GOVERALLS?=goveralls +endif + +ifeq ($(GOVERSION), go1.2) +TRAVIS_TARGET=coveralls +PREPARE_LIST=cover-prepare +else +TRAVIS_TARGET=test +PREPARE_LIST= +endif + +all: test check + +prepare: $(PREPARE_LIST) go get -d -v ./... go get launchpad.net/gocheck - go get github.com/axw/gocov/gocov + +cover-prepare: go get github.com/golang/lint/golint go get github.com/matm/gocov-html go get github.com/mattn/goveralls + go get code.google.com/p/go.tools/cmd/cover coverage: gocov test ./... | gocov-html > coverage.html @@ -14,5 +34,12 @@ check: go tool vet -all=true . golint . +travis: $(TRAVIS_TARGET) + test: - go test -v ./... \ No newline at end of file + go test -v ./... + +coveralls: + $(GOVERALLS) -service travis-ci.org -package="./..." $(COVERALLS_TOKEN) + +.PHONY: prepare cover-prepare coverage check test coveralls travis \ No newline at end of file