-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (47 loc) · 1.16 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
COMMIT = $$(git describe --always)
PKG = github.com/yuuki/diamondb
PKGS = $$(go list ./... | grep -v vendor)
all: build
.PHONY: deps
deps:
go get golang.org/x/tools/cmd/goyacc
go get github.com/golang/mock/mockgen
.PHONY: gen
gen:
go generate $(PKGS)
.PHONY: build
build: gen
go build -ldflags "-X main.GitCommit=\"$(COMMIT)\"" $(PKG)/cmd/...
.PHONY: test
test:
go test -v $(PKGS)
.PHONY: test-race
test-race:
go test -v -race $(PKGS)
.PHONY: test-integration
test-integration:
docker-compose -f docker-compose.yml -f test/docker-compose.test.yml build
docker-compose -f docker-compose.yml -f test/docker-compose.test.yml run --rm sut
.PHONY: test-all
test-all: vet test-race test-integration
.PHONY: cover
cover: gen
go test -cover $(PKGS)
.PHONY: fmt
fmt:
gofmt -s -w $$(git ls | grep -e '\.go$$' | grep -v -e vendor)
.PHONY: imports
imports:
goimports -w $$(git ls | grep -e '\.go$$' | grep -v -e vendor)
.PHONY: lint
lint:
golint $(PKGS)
.PHONY: vet
vet:
go tool vet -all -printfuncs=Wrap,Wrapf,Errorf $$(find . -maxdepth 1 -mindepth 1 -type d | grep -v -e "^\.\/\." -e vendor)
.PHONY: up
up:
docker-compose up --build
.PHONY: down
down:
docker-compose down