Makefile: make full tests run on go1.10+ as well as go1.9

This commit is contained in:
Nick Craig-Wood 2018-01-26 12:02:44 +00:00
parent c2ce3114f4
commit 926cd52a7f

View File

@ -4,7 +4,8 @@ LAST_TAG := $(shell git describe --tags --abbrev=0)
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)') NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)')
GO_VERSION := $(shell go version) GO_VERSION := $(shell go version)
GO_FILES := $(shell go list ./... | grep -v /vendor/ ) GO_FILES := $(shell go list ./... | grep -v /vendor/ )
GO_LATEST := $(findstring go1.9,$(GO_VERSION)) # Run full tests if go >= go1.9
FULL_TESTS := $(shell go version | perl -lne 'print "go$$1.$$2" if /go(\d+)\.(\d+)/ && ($$1 > 1 || $$2 >= 9)')
BETA_URL := https://beta.rclone.org/$(TAG)/ BETA_URL := https://beta.rclone.org/$(TAG)/
# Pass in GOTAGS=xyz on the make command line to set build tags # Pass in GOTAGS=xyz on the make command line to set build tags
ifdef GOTAGS ifdef GOTAGS
@ -24,7 +25,7 @@ vars:
@echo LAST_TAG="'$(LAST_TAG)'" @echo LAST_TAG="'$(LAST_TAG)'"
@echo NEW_TAG="'$(NEW_TAG)'" @echo NEW_TAG="'$(NEW_TAG)'"
@echo GO_VERSION="'$(GO_VERSION)'" @echo GO_VERSION="'$(GO_VERSION)'"
@echo GO_LATEST="'$(GO_LATEST)'" @echo FULL_TESTS="'$(FULL_TESTS)'"
@echo BETA_URL="'$(BETA_URL)'" @echo BETA_URL="'$(BETA_URL)'"
version: version:
@ -40,24 +41,24 @@ test: rclone
# Quick test # Quick test
quicktest: quicktest:
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES) RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES)
ifdef GO_LATEST ifdef FULL_TESTS
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES) RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES)
endif endif
# Do source code quality checks # Do source code quality checks
check: rclone check: rclone
ifdef GO_LATEST ifdef FULL_TESTS
go vet $(BUILDTAGS) -printfuncs Debugf,Infof,Logf,Errorf ./... go vet $(BUILDTAGS) -printfuncs Debugf,Infof,Logf,Errorf ./...
errcheck $(BUILDTAGS) ./... errcheck $(BUILDTAGS) ./...
find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1 find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1
go list ./... | xargs -n1 golint | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1 go list ./... | xargs -n1 golint | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1
else else
@echo Skipping tests as not on Go stable @echo Skipping source quality tests as version of go too old
endif endif
# Get the build dependencies # Get the build dependencies
build_dep: build_dep:
ifdef GO_LATEST ifdef FULL_TESTS
go get -u github.com/kisielk/errcheck go get -u github.com/kisielk/errcheck
go get -u golang.org/x/tools/cmd/goimports go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/golang/lint/golint go get -u github.com/golang/lint/golint
@ -126,10 +127,10 @@ upload_beta:
@echo Beta release ready at $(BETA_URL) @echo Beta release ready at $(BETA_URL)
compile_all: compile_all:
ifdef GO_LATEST ifdef FULL_TESTS
go run bin/cross-compile.go -parallel 8 -compile-only $(BUILDTAGS) $(TAG)β go run bin/cross-compile.go -parallel 8 -compile-only $(BUILDTAGS) $(TAG)β
else else
@echo Skipping compile all as not on Go stable @echo Skipping compile all as version of go too old
endif endif
travis_beta: travis_beta: