-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cleanliness
- Loading branch information
Showing
16 changed files
with
265 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,57 @@ | ||
.DEFAULT_GOAL:=all | ||
ifdef VERBOSE | ||
V = -v | ||
else | ||
.SILENT: | ||
endif | ||
|
||
GO ?= GO111MODULE=on go | ||
|
||
include $(wildcard *.mk) | ||
|
||
COVERAGEDIR = coverage | ||
SERVICE = drone.io | ||
ifdef CIRCLE_ARTIFACTS | ||
COVERAGEDIR = $(CIRCLE_ARTIFACTS) | ||
SERVICE=circle-ci | ||
endif | ||
|
||
.PHONY: all | ||
all: generate fmt build test cover install | ||
|
||
.PHONY: install-deps | ||
install-deps: | ||
glide install | ||
all: generate fmt build test cover | ||
|
||
.PHONY: benchmarks | ||
benchmarks: generate fmt reinstall | ||
benchmarks: generate fmt build | ||
./benchmark.sh | ||
|
||
build: generate | ||
if [ ! -d bin ]; then mkdir bin; fi | ||
go build -v -o bin/gencheck ./gencheck | ||
$(GO) build -v -o bin/gencheck ./gencheck | ||
fmt: | ||
gofmt -l -w -s $$(find . -type f -name '*.go' -not -path "./vendor/*") | ||
test: generate gen-test | ||
if [ ! -d coverage ]; then mkdir coverage; fi | ||
go test -v ./generator -race -cover -coverprofile=$(COVERAGEDIR)/generator.coverprofile | ||
go test -v ./ -race -cover -coverprofile=$(COVERAGEDIR)/gencheck.coverprofile | ||
go test -v ./internal/example -race -cover -coverprofile=$(COVERAGEDIR)/example.coverprofile | ||
$(GO) test -v ./... -race -cover -coverprofile=$(COVERAGEDIR)/coverage.out | ||
|
||
cover: | ||
go tool cover -html=$(COVERAGEDIR)/generator.coverprofile -o $(COVERAGEDIR)/generator.html | ||
go tool cover -html=$(COVERAGEDIR)/gencheck.coverprofile -o $(COVERAGEDIR)/gencheck.html | ||
go tool cover -html=$(COVERAGEDIR)/gencheck.coverprofile -o $(COVERAGEDIR)/example.html | ||
$(GO) tool cover -html=$(COVERAGEDIR)/coverage.out -o $(COVERAGEDIR)/coverage.html | ||
|
||
tc: test cover | ||
coveralls: | ||
gover $(COVERAGEDIR) $(COVERAGEDIR)/coveralls.coverprofile | ||
goveralls -coverprofile=$(COVERAGEDIR)/coveralls.coverprofile -service=$(SERVICE) -repotoken=$(COVERALLS_TOKEN) | ||
clean: | ||
go clean | ||
coveralls: $(GOVERALLS) | ||
$(GOVERALLS) -coverprofile=$(COVERAGEDIR)/coverage.out -service=$(SERVICE) -repotoken=$(COVERALLS_TOKEN) | ||
|
||
clean: cleandeps | ||
$(GO) clean | ||
rm -f bin/gencheck | ||
rm -rf coverage/ | ||
|
||
# go-bindata will take all of the template files and create readable assets from them in the executable. | ||
# This way the templates are readable in atom (or another text editor with golang template language support) | ||
generate: | ||
go-bindata -o generator/assets.go -nometadata -pkg=generator template/*.tmpl | ||
generate: deps | ||
$(GOBINDATA) -o generator/assets.go -nometadata -pkg=generator template/*.tmpl | ||
|
||
gen-test: build install | ||
go generate $$(glide novendor) | ||
gen-test: build | ||
$(GO) generate ./... | ||
|
||
install: | ||
go install ./gencheck | ||
|
||
reinstall: build | ||
go install ./gencheck | ||
$(GO) install ./gencheck | ||
|
||
phony: clean tc build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
GOBINDATA=bin/go/github.com/kevinburke/go-bindata/go-bindata | ||
GOIMPORTS=bin/go/golang.org/x/tools/cmd/goimports | ||
GOVERALLS=bin/go/github.com/mattn/goveralls | ||
MOCKGEN=bin/go/github.com/golang/mock/mockgen | ||
TOOLS = $(GOBINDATA) \ | ||
$(GOIMPORTS) \ | ||
$(MOCKGEN) \ | ||
$(GOVERALLS) | ||
|
||
cleandeps: | ||
if [ -d "./bin" ]; then rm -rf "./bin"; fi | ||
|
||
freshdeps: cleandeps deps | ||
|
||
deps: $(TOOLS) | ||
bin/go/%: | ||
@echo "installing $*" | ||
$(GO) build -o bin/go/$* $* |
Oops, something went wrong.