-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (76 loc) · 2.92 KB
/
Makefile
File metadata and controls
92 lines (76 loc) · 2.92 KB
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
84
85
86
87
88
89
90
91
92
OS = $(shell uname)
# COLORS
RED = $(shell printf "\33[31m")
GREEN = $(shell printf "\33[32m")
WHITE = $(shell printf "\33[37m")
YELLOW = $(shell printf "\33[33m")
RESET = $(shell printf "\33[0m")
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# HELP
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
.DEFAULT: help
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# SETUP
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
install:
@echo "${YELLOW}Installing dependencies${RESET}"
go list -f '{{range .Imports}}{{.}} {{end}}' ./... | xargs go get ${install_flags}
@echo "${GREEN}✔ successfully installed dependencies${RESET}\n"
update:
@echo "${YELLOW}Updating dependencies${RESET}"
go list -f '{{range .Imports}}{{.}} {{end}}' ./... | xargs go get -u ${install_flags}
@echo "${GREEN}✔ successfully updated dependencies${RESET}\n"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# TEST
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
test_all: ##@test Run all test steps
@echo "${YELLOW}Running all tests${RESET}\n"
@${MAKE} test_lib
@${MAKE} test_cli
@${MAKE} fmt_check
@echo "${GREEN}✔ well done!${RESET}\n"
test_lib:
@echo "${YELLOW}Running lib tests${RESET}"
@go test -v ./conoha/.
@echo "${GREEN}✔ Lib tests successfully passed${RESET}\n"
test_cli: ##@test Run CLI tests
@echo "${YELLOW}Running CLI tests${RESET}"
go test -v ./cli/cmd/. -args ${test_args}
@echo "${GREEN}✔ CLI tests successfully passed${RESET}\n"
fmt_check: ##@test Check formatting
@echo "${YELLOW}Checking formatting${RESET}"
@exit `gofmt -l -s -e . | wc -l`
@echo "${GREEN}✔ code was formatted as expected${RESET}\n"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# CLI
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
cli_build:
@echo "${YELLOW}Building cli${RESET}"
@cd cli && go build -o conoha
@echo "${GREEN}✔ successfully built CLI${RESET}\n"
cli_build_all:
@echo "${YELLOW}Building CLI for various platforms${RESET}"
cd cli && GOOS=darwin GOARCH=amd64 go build -o build/conoha-darwin-amd64
cd cli && GOOS=linux GOARCH=amd64 go build -o build/conoha-linux-amd64
cd cli && GOOS=linux GOARCH=386 go build -o build/conoha-linux-386
cd cli && GOOS=linux GOARCH=arm go build -o build/conoha-linux-arm
cd cli && GOOS=linux GOARCH=arm64 go build -o build/conoha-linux-arm64
@echo "${GREEN}✔ successfully built CLI flavors${RESET}\n"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# MISC
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
fmt: ##@misc Format code
@echo "${YELLOW}Formatting code${RESET}"
@gofmt -l -w -s .
@go fix ./...
@echo "${GREEN}✔ code was successfully formatted${RESET}\n"