-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (64 loc) · 1.88 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
79
80
81
82
83
PROJ = gambol
ORG_PATH = github.com/nuccitheboss
REPO_PATH = $(ORG_PATH)/$(PROJ)
export GOBIN=$(CURDIR)/bin
##@ Build
build: bin/gambol ## Build executable binary
bin/gambol:
@mkdir -p bin/
@go install -v $(REPO_PATH)/cmd/gambol
.PHONY: snap
snap: ## Build snap package
@cp -ra build/snap snap
@snapcraft -v pack
@rm -rf snap
##@ Lint
.PHONY: fmt
fmt: ## Format source code
@go fmt -x ./...
@golangci-lint run --fix
.PHONY: lint
lint: ## Lint source code
@golangci-lint run
##@ Test
define E2E_TESTS
e2e-simple
e2e-error
e2e-hostpath
e2e-advanced
endef
.PHONY: e2e
e2e: $(E2E_TESTS) ## Run end to end integration tests
.PHONY: e2e-simple
e2e-simple:
@echo Running e2e test: simple
@cd $(CURDIR)/test/e2e/simple && ${GOBIN}/gambol -v run simple.yaml
.PHONY: e2e-error
e2e-error:
@echo Running e2e test: error
@cd $(CURDIR)/test/e2e/error && ${GOBIN}/gambol -v run error.yaml
.PHONY: e2e-hostpath
e2e-hostpath:
@echo Running e2e test: hostpath
@cd $(CURDIR)/test/e2e/hostpath && ${GOBIN}/gambol -v run hostpath.yaml
.PHONY: e2e-advanced
e2e-advanced:
@echo Running e2e test: advanced
@cd $(CURDIR)/test/e2e/advanced && ${GOBIN}/gambol -v run advanced.yaml
##@ Clean
.PHONY: clean
clean: ## Delete all builds and downloaded dependencies
@rm -rf bin/
@rm -rf snap/
FORMATTING_BEGIN_YELLOW = \033[0;33m
FORMATTING_BEGIN_BLUE = \033[36m
FORMATTING_END = \033[0m
.PHONY: help
help:
@awk 'BEGIN {\
FS = ":.*##"; \
printf "Usage: ${FORMATTING_BEGIN_BLUE}OPTION${FORMATTING_END}=<value> make ${FORMATTING_BEGIN_YELLOW}<target>${FORMATTING_END}\n"\
} \
/^[a-zA-Z0-9_-]+:.*?##/ { printf " ${FORMATTING_BEGIN_BLUE}%-46s${FORMATTING_END} %s\n", $$1, $$2 } \
/^.?.?##~/ { printf " %-46s${FORMATTING_BEGIN_YELLOW}%-46s${FORMATTING_END}\n", "", substr($$1, 6) } \
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)