forked from boson-project/grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (26 loc) · 839 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
REPO := quay.io/boson/grid
BIN := grid
CODE := $(shell find . -name '*.go')
DATE := $(shell date -u +"%Y%m%dT%H%M%SZ")
HASH := $(shell git rev-parse --short HEAD 2>/dev/null)
VTAG := $(shell git tag --points-at HEAD)
VERS := $(shell [ -z $(VTAG) ] && echo 'tip' || echo $(VTAG) )
all: $(BIN)
build: all
$(BIN): $(CODE)
go build -ldflags "-X main.date=$(DATE) -X main.vers=$(VERS) -X main.hash=$(HASH)" ./cmd/$(BIN)
test:
go test -race -cover -coverprofile=coverage.out ./...
check:
golangci-lint run --enable=unconvert,prealloc
image: Dockerfile
docker build -t $(REPO):$(VERS) \
-t $(REPO):$(HASH) \
-t $(REPO):$(DATE)-$(VERS)-$(HASH) .
push: image
docker push $(REPO):$(VERS)
docker push $(REPO):$(HASH)
docker push $(REPO):$(DATE)-$(VERS)-$(HASH)
clean:
-@rm -f $(BIN)
-@rm -f coverage.out