-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (27 loc) · 896 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
.PHONY: deps binary build test cloc unit-test
REPO_PATH := github.com/projecteru2/core
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
deps:
go mod vendor
binary:
go build -ldflags "$(GO_LDFLAGS)" -o resource-storage
build: deps binary
test: deps unit-test
.ONESHELL:
cloc:
cloc --exclude-dir=vendor,3rdmocks,mocks,tools,gen --not-match-f=test .
unit-test:
go vet `go list ./... | grep -v '/vendor/' | grep -v '/tools'` && \
go test -race -timeout 600s -count=1 -vet=off -cover \
./storage/schedule... \
./storage/.
lint:
golangci-lint run