2023-07-05 01:31:59 +03:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
|
|
|
COVER_FILE ?= coverage.out
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: ## Build a command to quickly check compiles.
|
|
|
|
@go build ./...
|
|
|
|
|
|
|
|
.PHONY: check
|
|
|
|
check: lint build test ## Runs all necessary code checks.
|
2024-06-30 23:08:39 +03:00
|
|
|
@go mod tidy
|
2023-07-05 01:31:59 +03:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: ## Run all tests.
|
|
|
|
@go test -race -count=1 -coverprofile=$(COVER_FILE) ./...
|
|
|
|
@go tool cover -func=$(COVER_FILE) | grep ^total | tr -s '\t'
|
|
|
|
|
|
|
|
.PHONY: test-short
|
|
|
|
test-short: ## Run only unit tests, tests without I/O dependencies.
|
|
|
|
@go test -short ./...
|
|
|
|
|
|
|
|
.PHONY: test-env-up
|
|
|
|
test-env-up: ## Run test environment.
|
2023-09-22 21:26:47 +03:00
|
|
|
@docker compose up --exit-code-from migrate migrate
|
2023-07-05 01:31:59 +03:00
|
|
|
|
|
|
|
.PHONY: test-env-down
|
|
|
|
test-env-down: ## Down and cleanup test environment.
|
2023-09-22 21:26:47 +03:00
|
|
|
@docker compose down -v
|
2023-07-05 01:31:59 +03:00
|
|
|
|
|
|
|
.PHONY: lint
|
|
|
|
lint: tools ## Check the project with lint.
|
2023-07-10 23:05:51 +03:00
|
|
|
@golangci-lint run --fix ./...
|
2023-07-05 01:31:59 +03:00
|
|
|
|
2024-06-30 23:10:58 +03:00
|
|
|
.PHONY: tools
|
2023-07-05 01:31:59 +03:00
|
|
|
tools: ## Install all needed tools, e.g.
|
2023-11-14 21:58:06 +03:00
|
|
|
@go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
|
2023-07-05 01:31:59 +03:00
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help: ## Show help for each of the Makefile targets.
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|