diff options
author | Joshua Sjoding <joshua.sjoding@scjalliance.com> | 2016-02-01 21:16:31 -0800 |
---|---|---|
committer | Joshua Sjoding <joshua.sjoding@scjalliance.com> | 2016-02-01 21:16:31 -0800 |
commit | f26d06d8b3dafae8b849bb0b812f2ce58df92423 (patch) | |
tree | 8623788650232bc0bcb91dab5eee19b99e15c2c5 /Makefile | |
parent | d5696c0b75a115001e67025181663b8952b02691 (diff) | |
parent | 1cad23e71e4db887700ef6d192ade463904261fd (diff) | |
download | go-git-f26d06d8b3dafae8b849bb0b812f2ce58df92423.tar.gz |
Merge remote-tracking branch 'upstream/master' into generic-object-storage
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..18e9991 --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +# Default shell +SHELL := /bin/bash + +# General +WORKDIR = $(PWD) + +# Go parameters +GOCMD = go +GOTEST = $(GOCMD) test -v + +# Coverage +COVERAGE_REPORT = coverage.txt +COVERAGE_PROFILE = profile.out +COVERAGE_MODE = atomic + +ifneq ($(origin CI), undefined) + WORKDIR := $(TRAVIS_BUILD_DIR) +endif + + +test: + $(GOTEST) ./... + +test-coverage: + cd $(WORKDIR); \ + echo "" > $(COVERAGE_REPORT); \ + for dir in `find . -name "*.go" | grep -o '.*/' | sort | uniq`; do \ + $(GOTEST) $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \ + if [ $$? != 0 ]; then \ + exit 2; \ + fi; \ + if [ -f $(COVERAGE_PROFILE) ]; then \ + cat $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \ + rm $(COVERAGE_PROFILE); \ + fi; \ + done; \ |