-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
44 lines (32 loc) · 1.61 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
version := $(shell git describe --always --tags --long --abbrev=8)
buildtime := $(shell date -u +%Y%m%d.%H%M%S)
GOBUILD_OPTS := -v -ldflags "-X main.version=$(version)-$(buildtime)"
all: cmds
lint:
@gometalinter --disable-all --enable=vet --enable=vetshadow --enable=structcheck \
--enable=deadcode --enable=gotype --enable=goconst --enable=golint --enable=varcheck \
--enable=unconvert --enable=staticcheck --enable=gas --enable=dupl --enable=ineffassign \
--enable=gocyclo --cyclo-over=20 --vendor ./...
docker:
docker build -t prune/gohellogrpcstream:$(version) --build-arg VERSION=$(version) --build-arg BUILDTIME=$(buildtime) .
docker-push: docker
docker push prune/gohellogrpcstream:$(version)
docker tag prune/gohellogrpcstream:$(version) prune/gohellogrpcstream:latest
docker push prune/gohellogrpcstream:latest
protos: helloworld/helloworld.pb.go
helloworld/helloworld.pb.go:
# cd helloworld/helloworld && go generate
cd helloworld && protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative helloworld/helloworld.proto
greeter_client: test
cd helloworld/greeter_client && CGO_ENABLED=0 GOOS=linux go build $(GOBUILD_OPTS)
greeter_server: test
cd helloworld/greeter_server && CGO_ENABLED=0 GOOS=linux go build $(GOBUILD_OPTS)
loadtest_client: test
cd helloworld/loadtest_client && CGO_ENABLED=0 GOOS=linux go build $(GOBUILD_OPTS)
cmds: greeter_client greeter_server loadtest_client
test:
go test ./...
clean:
rm -f ./helloworld/greeter_server/greeter_server \
./helloworld/greeter_client/greeter_client \
./helloworld/loadtest_client/loadtest_client