-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
63 lines (49 loc) · 1.69 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
SERVICE=charon
VERSION=$(shell git describe --tags --always --dirty)
ifeq ($(version),)
TAG=${VERSION}
else
TAG=$(version)
endif
PACKAGE=github.com/piotrkowalczuk/charon
PACKAGE_CMD_DAEMON=$(PACKAGE)/cmd/$(SERVICE)d
PACKAGE_CMD_CONTROL=$(PACKAGE)/cmd/$(SERVICE)ctl
PACKAGE_CMD_GENERATOR=$(PACKAGE)/cmd/$(SERVICE)g
LDFLAGS = -X 'main.version=$(VERSION)'
.PHONY: all version build install gen test cover get publish
all: get install
version:
echo ${VERSION} > publish/VERSION.txt
build:
CGO_ENABLED=0 GOOS=linux go build -ldflags "${LDFLAGS}" -a -o bin/${SERVICE}g ${PACKAGE_CMD_GENERATOR}
CGO_ENABLED=0 GOOS=linux go build -ldflags "${LDFLAGS}" -a -o bin/${SERVICE}d ${PACKAGE_CMD_DAEMON}
CGO_ENABLED=0 GOOS=linux go build -ldflags "${LDFLAGS}" -a -o bin/${SERVICE}ctl ${PACKAGE_CMD_CONTROL}
install:
go install -ldflags "${LDFLAGS}" ${PACKAGE_CMD_GENERATOR}
go install -ldflags "${LDFLAGS}" ${PACKAGE_CMD_DAEMON}
go install -ldflags "${LDFLAGS}" ${PACKAGE_CMD_CONTROL}
gen:
#./scripts/generate.sh
bash ./.circleci/scripts/generate.sh golang
test:
./.circleci/scripts/test.sh
go tool cover -func=cover.out | tail -n 1
cover: test
go tool cover -html=cover.out
get:
bash ./.circleci/scripts/get_tool.sh github.com/golang/protobuf/proto v1.2.0
go get -u gotest.tools/gotestsum
go get -u github.com/vektra/mockery/cmd/mockery
go get -u github.com/golang/dep/cmd/dep
dep ensure
publish:
docker build \
--build-arg VCS_REF=${VCS_REF} \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-t piotrkowalczuk/${SERVICE}:${TAG} .
docker push piotrkowalczuk/${SERVICE}:${TAG}
setup-python:
python3 -m venv venv
source ./venv/bin/activate.fish
pip install grpc_tools
pip install grpcio-tools