-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (34 loc) · 907 Bytes
/
Copy pathMakefile
File metadata and controls
49 lines (34 loc) · 907 Bytes
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
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
BIN=api
REGISTRY ?= gidraff
VERSION := $(shell git describe --tags --always --dirty)
BUILD_DIR := bin
IMAGE_NAME := taskman
TAG := $(VERSION)__$(OS)_$(ARCH)
IMAGE := $(REGISTRY)/$(IMAGE_NAME):$(TAG)
REPORTS := reports
test: $(REPORTS)
go test -coverprofile=./$(REPORTS)/coverage.out ./...
@echo "Running test with cover"
cover: $(REPORTS)
go tool cover -func=./$(REPORTS)/coverage.out
unittest:
go test -short ./...
engine: $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(BIN) cmd/api/*.go
@echo "Building $(BINARY)"
image: build
docker build -t $(IMAGE) .
push: image
docker push $(IMAGE)
$(BUILD_DIR):
@mkdir -p $@
$(REPORTS):
@mkdir -p $@
clean:
if [ -f ${BIN} ] ; then rm ${BIN} ; fi
bin-clean:
if [ -d ./bin ]; then rm -rf ./bin ; fi
echo "Cleaning bin folder"
.PHONY: build