diff --git a/Makefile b/Makefile index 9a3c3c0b6..9db05bfca 100644 --- a/Makefile +++ b/Makefile @@ -3,39 +3,64 @@ SCRIPTS_BASE ?= $(ROOT_DIR)/scripts GOLANG_CI_YAML_PATH ?= ${ROOT_DIR}/golang-ci.yaml GOLANG_CI_ARGS ?= --allow-parallel-runners --timeout=5m --config=${GOLANG_CI_YAML_PATH} +## +# Console Colors +## +GREEN := $(shell printf "\033[0;32m") +YELLOW := $(shell printf "\033[0;33m") +WHITE := $(shell printf "\033[0;37m") +CYAN := $(shell printf "\033[0;36m") +RESET := $(shell printf "\033[0m") + + +## +# Targets +## +.PHONY: help +help: ## Show this help + @echo "Project: stackit-sdk-go" + @echo 'Usage:' + @echo " ${GREEN}make${RESET} ${YELLOW}${RESET}" + @echo '' + @echo 'Targets:' + @awk 'BEGIN {FS = ":.*?## "} { \ + if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${GREEN}%-21s${YELLOW}%s${RESET}\n", $$1, $$2} \ + else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \ + }' $(MAKEFILE_LIST) | sort + # SETUP AND TOOL INITIALIZATION TASKS -project-help: +project-help: ## Show help for the project @$(SCRIPTS_BASE)/project.sh help -project-tools: +project-tools: ## Install project tools @$(SCRIPTS_BASE)/project.sh tools # LINT -lint-golangci-lint: +lint-golangci-lint: ## Lint Go code @echo ">> Linting with golangci-lint" @$(SCRIPTS_BASE)/lint-golangci-lint.sh "${skip-non-generated-files}" "${service}" -lint-scripts: +lint-scripts: ## Lint scripts @echo ">> Linting scripts" @cd ${ROOT_DIR}/scripts && golangci-lint run ${GOLANG_CI_ARGS} -sync-tidy: +sync-tidy: ## Sync and tidy dependencies @echo ">> Syncing and tidying dependencies" @$(SCRIPTS_BASE)/sync-tidy.sh -lint: sync-tidy +lint: sync-tidy ## Lint all code @$(MAKE) --no-print-directory lint-golangci-lint skip-non-generated-files=${skip-non-generated-files} service=${service} # TEST -test-go: +test-go: ## Run Go tests @echo ">> Running Go tests" @$(SCRIPTS_BASE)/test-go.sh "${skip-non-generated-files}" "${service}" -test-scripts: +test-scripts: ## Run tests for scripts @echo ">> Running Go tests for scripts" @go test $(ROOT_DIR)/scripts/... ${GOTEST_ARGS} -test: +test: ## Run all tests @$(MAKE) --no-print-directory test-go skip-non-generated-files=${skip-non-generated-files} service=${service} # AUTOMATIC TAG @@ -45,4 +70,3 @@ sdk-tag-services: sdk-tag-core: @go run $(SCRIPTS_BASE)/automatic_tag.go --update-type ${update-type} --ssh-private-key-file-path ${ssh-private-key-file-path} --target core; -