-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
41 lines (32 loc) · 1002 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
39
40
41
.PHONY: deps build test binary
REPO_PATH := github.com/projecteru2/agent
REVISION := $(shell git rev-parse HEAD || unknown)
BUILTAT := $(shell date +%Y-%m-%dT%H:%M:%S)
VERSION := $(shell git describe --tags $(shell git rev-list --tags --max-count=1))
GO_LDFLAGS ?= -X $(REPO_PATH)/version.REVISION=$(REVISION) \
-X $(REPO_PATH)/version.BUILTAT=$(BUILTAT) \
-X $(REPO_PATH)/version.VERSION=$(VERSION)
ifneq ($(KEEP_SYMBOL), 1)
GO_LDFLAGS += -s
endif
all: build
deps:
env GO111MODULE=on go mod download
env GO111MODULE=on go mod vendor
binary:
go build -ldflags "$(GO_LDFLAGS)" -o eru-agent
unit-test:
go vet `go list ./... | grep -v '/vendor/'`
go test -race -count=1 -timeout 240s -cover ./logs/... \
./manager/node/... \
./manager/workload/... \
./types/... \
./utils/...
build: deps binary
test: deps unit-test
lint:
golangci-lint run
.PHONY: mock
mock:
mockery --dir store --output store/mocks --name Store
mockery --dir runtime --output runtime/mocks --name Runtime