This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (56 loc) · 1.48 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
NAME := openio_exporter
sources := $(shell find . -type d -name tmp -prune -o -type f -name '*.go' -print)
GOBIN := $(shell go env GOPATH)/bin
export CGO_ENABLED := 0
$(NAME): $(sources)
go build -v -o $@
.PHONY: all
all: check $(NAME)
.PHONY: check
check: lint vet test
.PHONY: lint
lint:
$(GOBIN)/golint ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: test
test:
go test -v ./...
.PHONY: long-test
long-test:
cd ./test && make test
.PHONY: setup
setup: deps
go get golang.org/x/lint/golint
.PHONY: deps
deps:
go get -v -t -d ./...
.PHONY: clean
clean:
go clean
rm -f $(NAME)
# See .goreleaser.yml for what these means
git_branch := $(shell git symbolic-ref --short HEAD 2>/dev/null)
export BRANCH := $(if $(git_branch),$(git_branch),HEAD)
git_user_name := $(shell git config user.name 2>/dev/null)
git_user_email := $(shell git config user.email 2>/dev/null)
git_user := $(strip $(git_user_name) $(if $(git_user_email),<$(git_user_email)>,))
export BUILD_USER := $(if $(git_user),$(git_user),$(shell whoami)@$(shell hostname))
export BUILD_DATE := $(shell date +"%Y%m%d-%H:%M:%S")
.PHONY: dist
dist: GORELEASER_FLAGS ?= --snapshot --skip-publish --rm-dist
dist:
goreleaser $(GORELEASER_FLAGS)
.PHONY: echo_branch echo_build_user echo_build_date
echo_branch:
@echo $(BRANCH)
echo_build_user:
@echo $(BUILD_USER)
echo_build_date:
@echo $(BUILD_DATE)
# Shortcuts to control the development container
DEV_TARGETS = start stop attach exec
.PHONY: $(DEV_TARGETS)
$(DEV_TARGETS):
cd ./dev && make $@