-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
38 lines (27 loc) · 945 Bytes
/
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
.PHONY: test docker clean all
COMMIT=`git rev-parse HEAD`
BUILD=`date +%FT%T%z`
LDFLAG_LOCATION=github.com/keikoproj/governor/cmd/governor/app
LDFLAGS=-ldflags "-X ${LDFLAG_LOCATION}.buildDate=${BUILD} -X ${LDFLAG_LOCATION}.gitCommit=${COMMIT}"
TARGETOS ?= linux
TARGETARCH ?= amd64
GIT_TAG=$(shell git rev-parse --short HEAD)
IMAGE ?= governor:latest
all: clean build test
build:
GO111MODULE=on CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build ${LDFLAGS} -o _output/bin/governor github.com/keikoproj/governor/cmd/governor
docker-build:
docker build -t $(IMAGE) .
# Push the docker image
docker-push:
docker push ${IMAGE}
clean:
rm -rf _output
test:
CGO_ENABLED=0 go test -v ./... -coverprofile ./coverage.txt
vtest:
go test -v ./... -coverprofile ./coverage.txt --logging-enabled
coverage:
mkdir -p ./_output
go test -coverprofile ./coverage.txt -v ./...
go tool cover -html=./coverage.txt -o _output/cover.html