-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (45 loc) · 1.49 KB
/
Copy pathMakefile
File metadata and controls
57 lines (45 loc) · 1.49 KB
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
SERVICE=mnemosyne
VERSION=$(shell git describe --tags --always --dirty)
ifeq ($(version),)
TAG=${VERSION}
else
TAG=$(version)
endif
PACKAGE=github.com/piotrkowalczuk/mnemosyne
PACKAGE_CMD_DAEMON=$(PACKAGE)/cmd/$(SERVICE)d
PACKAGE_CMD_STRESS=$(PACKAGE)/cmd/$(SERVICE)stress
LDFLAGS = -X 'main.version=$(VERSION)'
.PHONY: all gen build install test cover get
all: get install
version:
echo ${VERSION} > VERSION.txt
gen:
bash ./.circleci/scripts/generate.sh golang
bash ./scripts/generate.sh
build:
CGO_ENABLED=0 GOOS=linux go build -ldflags "${LDFLAGS}" -installsuffix cgo -a -o bin/${SERVICE}d ${PACKAGE_CMD_DAEMON}
CGO_ENABLED=0 GOOS=linux go build -ldflags "${LDFLAGS}" -installsuffix cgo -a -o bin/${SERVICE}stress ${PACKAGE_CMD_STRESS}
install:
go install -ldflags "${LDFLAGS}" ${PACKAGE_CMD_DAEMON}
go install -ldflags "${LDFLAGS}" ${PACKAGE_CMD_STRESS}
test:
./.circleci/scripts/test.sh
go tool cover -func=cover.out | tail -n 1
cover: test
go tool cover -html=cover.out
get:
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u github.com/axw/gocov/gocov
go get -u gotest.tools/gotestsum
go get -u github.com/vektra/mockery/cmd/...
publish: build
ifneq ($(skiplogin),true)
docker login
endif
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}