-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
72 lines (56 loc) · 1.24 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
72
GOMOD = GO111MODULE=on go mod
# --- build vars ---
VERSION = 0.0.2
BUILD_COMMIT := $(shell git rev-parse HEAD)
BUILD_TIME := $(shell date +%Y-%m-%dT%H:%M:%S%z)
DOCKER_REPO = dyweb/go.ice
# --- build vars ---
# --- packages ---
PKGST=./cli
PKGS=./cli/...
# --- packages ---
.PHONY: install
install: fmt test
go install ./cmd/dk
.PHONY: fmt
fmt:
goimports -d -l -w $(PKGST)
# --- test ---
.PHONY: test test-verbose test-cover test-cover-html
test:
go test -cover $(PKGS)
test-verbose:
go test -v -cover $(PKGS)
test-cover:
# https://github.com/codecov/example-go
go test -coverprofile=coverage.txt -covermode=atomic $(PKGS)
test-cover-html: test-cover
go tool cover -html=coverage.txt
.PHONY: test-playground
test-playground:
go test -v ./playground/...
# --- test ---
.PHONY: generate
generate:
gommon generate -v
# --- dependency management ---
.PHONY: dep-install dep-update mod-init mod-update
dep-install:
dep ensure -v
dep-update:
dep ensure -update -v
mod-init:
$(GOMOD) init
mod-update:
$(GOMOD) tidy
# --- dependency management ---
# --- docker ---
.PHONY: docker-build docker-push
docker-build:
docker build -t $(DOCKER_REPO):$(VERSION) .
docker-push:
docker push $(DOCKER_REPO):$(VERSION)
# --- docker ---
.PHONY: loc
loc:
tokei .