Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}<target>${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
Expand All @@ -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;

Loading