forked from systemli/ticker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 1.19 KB
/
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
42
43
44
45
46
47
48
49
GOCMD = go
GOBUILD = $(GOCMD) build
GOCLEAN = $(GOCMD) clean
GOTEST = $(GOCMD) test
GOVET = $(GOCMD) vet
GOGET = $(GOCMD) get
GOX = $(GOPATH)/bin/gox
GOGET = $(GOCMD) get
GIT_VERSION := $(shell git --no-pager describe --tags --always)
GIT_COMMIT := $(shell git rev-parse --verify HEAD)
LD_FLAGS = -X main.GitCommit=$(GIT_COMMIT) -X main.GitVersion=$(GIT_VERSION)
GOX_ARGS = -output="$(BUILD_DIR)/{{.Dir}}-${GIT_VERSION}-{{.OS}}-{{.Arch}}" -osarch="linux/amd64 linux/arm linux/arm64 darwin/amd64 freebsd/amd64"
BUILD_DIR = build
BINARY_NAME = ticker
all: clean vet test build
build:
$(GOBUILD) -ldflags "${LD_FLAGS}" -o $(BUILD_DIR)/$(BINARY_NAME) -v
vet:
${GOVET} ./...
test:
${GOTEST} ./...
coverage:
${GOTEST} -coverprofile=coverage.txt -covermode=atomic ./...
clean:
$(GOCLEAN)
rm -f $(BUILD_DIR)/*
run: build
cp config.yml.dist build/config.yml
./$(BUILD_DIR)/$(BINARY_NAME) -config build/config.yml
release:
${GOGET} -u github.com/mitchellh/gox
${GOX} -ldflags "${LD_FLAGS}" ${GOX_ARGS}
docker:
docker build --rm --force-rm --no-cache -t systemli/ticker .
.PHONY: all vet test coverage clean build run release docker