@@ -3,39 +3,64 @@ SCRIPTS_BASE ?= $(ROOT_DIR)/scripts
3
3
GOLANG_CI_YAML_PATH ?= ${ROOT_DIR}/golang-ci.yaml
4
4
GOLANG_CI_ARGS ?= --allow-parallel-runners --timeout=5m --config=${GOLANG_CI_YAML_PATH}
5
5
6
+ # #
7
+ # Console Colors
8
+ # #
9
+ GREEN := $(shell printf "\033[0;32m")
10
+ YELLOW := $(shell printf "\033[0;33m")
11
+ WHITE := $(shell printf "\033[0;37m")
12
+ CYAN := $(shell printf "\033[0;36m")
13
+ RESET := $(shell printf "\033[0m")
14
+
15
+
16
+ # #
17
+ # Targets
18
+ # #
19
+ .PHONY : help
20
+ help : # # Show this help
21
+ @echo " Project: stackit-sdk-go"
22
+ @echo ' Usage:'
23
+ @echo " ${GREEN} make${RESET} ${YELLOW} <target>${RESET} "
24
+ @echo ' '
25
+ @echo ' Targets:'
26
+ @awk ' BEGIN {FS = ":.*?## "} { \
27
+ if (/^[a-zA-Z_-]+:.*? # #.*$$/) {printf " ${GREEN}%-21s${YELLOW}%s${RESET}\n", $$1, $$2} \
28
+ else if (/^# # .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
29
+ }' $(MAKEFILE_LIST) | sort
30
+
6
31
# SETUP AND TOOL INITIALIZATION TASKS
7
- project-help :
32
+ project-help : # # Show help for the project
8
33
@$(SCRIPTS_BASE ) /project.sh help
9
34
10
- project-tools :
35
+ project-tools : # # Install project tools
11
36
@$(SCRIPTS_BASE ) /project.sh tools
12
37
13
38
# LINT
14
- lint-golangci-lint :
39
+ lint-golangci-lint : # # Lint Go code
15
40
@echo " >> Linting with golangci-lint"
16
41
@$(SCRIPTS_BASE ) /lint-golangci-lint.sh " ${skip-non-generated-files} " " ${service} "
17
42
18
- lint-scripts :
43
+ lint-scripts : # # Lint scripts
19
44
@echo " >> Linting scripts"
20
45
@cd ${ROOT_DIR} /scripts && golangci-lint run ${GOLANG_CI_ARGS}
21
46
22
- sync-tidy :
47
+ sync-tidy : # # Sync and tidy dependencies
23
48
@echo " >> Syncing and tidying dependencies"
24
49
@$(SCRIPTS_BASE ) /sync-tidy.sh
25
50
26
- lint : sync-tidy
51
+ lint : sync-tidy # # Lint all code
27
52
@$(MAKE ) --no-print-directory lint-golangci-lint skip-non-generated-files=${skip-non-generated-files} service=${service}
28
53
29
54
# TEST
30
- test-go :
55
+ test-go : # # Run Go tests
31
56
@echo " >> Running Go tests"
32
57
@$(SCRIPTS_BASE ) /test-go.sh " ${skip-non-generated-files} " " ${service} "
33
58
34
- test-scripts :
59
+ test-scripts : # # Run tests for scripts
35
60
@echo " >> Running Go tests for scripts"
36
61
@go test $(ROOT_DIR ) /scripts/... ${GOTEST_ARGS}
37
62
38
- test :
63
+ test : # # Run all tests
39
64
@$(MAKE ) --no-print-directory test-go skip-non-generated-files=${skip-non-generated-files} service=${service}
40
65
41
66
# AUTOMATIC TAG
@@ -45,4 +70,3 @@ sdk-tag-services:
45
70
46
71
sdk-tag-core :
47
72
@go run $(SCRIPTS_BASE ) /automatic_tag.go --update-type ${update-type} --ssh-private-key-file-path ${ssh-private-key-file-path} --target core;
48
-
0 commit comments