forked from abice/go-enum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (50 loc) · 1.58 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
COVERAGEDIR = coverage
SERVICE=local
ifdef CIRCLE_WORKING_DIRECTORY
COVERAGEDIR = $(CIRCLE_WORKING_DIRECTORY)/coverage
SERVICE=circle-ci
endif
PACKAGES='./generator' './example'
.PHONY: all
all: build fmt test example cover install
.PHONY: install-deps
install-deps:
go get github.com/golang/dep/cmd/dep
go get -v github.com/jteeuwen/go-bindata/...
go get -v golang.org/x/tools/cmd/cover
go get -v github.com/mattn/goveralls
go get -v github.com/modocache/gover
dep ensure
build:
go generate ./generator
if [ ! -d bin ]; then mkdir bin; fi
go build -v -o bin/go-enum .
fmt:
gofmt -l -w -s $$(find . -type f -name '*.go' -not -path "./vendor/*")
test: gen-test generate
if [ ! -d coverage ]; then mkdir coverage; fi
go test -v ./generator -race -cover -coverprofile=$(COVERAGEDIR)/generator.coverprofile
go test -v ./example -race -cover -coverprofile=$(COVERAGEDIR)/example.coverprofile
cover: gen-test test
go tool cover -html=$(COVERAGEDIR)/generator.coverprofile -o $(COVERAGEDIR)/generator.html
go tool cover -html=$(COVERAGEDIR)/example.coverprofile -o $(COVERAGEDIR)/example.html
tc: test cover
coveralls:
if [ ! -d $(COVERAGEDIR) ]; then mkdir $(COVERAGEDIR); fi
gover $(COVERAGEDIR) $(COVERAGEDIR)/coveralls.coverprofile
goveralls -coverprofile=$(COVERAGEDIR)/coveralls.coverprofile -service=$(SERVICE) -repotoken=$(COVERALLS_TOKEN)
clean:
go clean
rm -f bin/go-enum
rm -rf coverage/
.PHONY: generate
generate:
go generate $(PACKAGES)
gen-test: build install
go generate $(PACKAGES)
install:
go install
phony: clean tc build
.PHONY: example
example:
go generate ./example