forked from shipengqi/commitizen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (63 loc) · 1.92 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
73
74
75
76
77
78
.PHONY: all
all: modules lint test build
# ==============================================================================
# Includes
include hack/include/common.mk # make sure include common.mk at the first include line
include hack/include/tools.mk
include hack/include/go.mk
include hack/include/test.mk
include hack/include/release.mk
# ==============================================================================
# Usage
define USAGE_OPTIONS
Options:
VERSION The version information compiled into binaries.
The default is obtained from gsemver or git.
PUBLISH Whether to publish a release to Github. Default is 0.
This option is available when using: make release
GITHUB_TOKEN Token used to access Github.
This option is available when using: make release
V Set to 1 enable verbose build. Default is 0.
DEBUG Whether to generate debug symbols. Default is 0.
endef
export USAGE_OPTIONS
# ==============================================================================
# Targets
## build: build binary file.
.PHONY: build
build: modules
@$(MAKE) go.build
## tag: generate release tag.
.PHONY: tag
tag:
@$(MAKE) release.tag
## release: release a version.
.PHONY: release
release:
@$(MAKE) release.run
## modules: add missing and remove unused modules.
.PHONY: modules
modules:
@go mod tidy
## clean: remove all files that are generated by building.
.PHONY: clean
clean:
@$(MAKE) go.clean
## lint: Check syntax and styling of go sources.
.PHONY: lint
lint:
@$(MAKE) go.lint
## test: run unit test and get test coverage.
.PHONY: test
test:
@$(MAKE) test.cover
## e2e: run e2e test.
.PHONY: e2e
e2e:
@$(MAKE) test.e2e
## help: show help information.
.PHONY: help
help: Makefile
@echo -e "\nUsage: make <TARGETS> <OPTIONS> ...\n\nTargets:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo "$$USAGE_OPTIONS"