2021-12-20 22:16:35 +00:00
|
|
|
include common.mk
|
|
|
|
include tools.mk
|
2021-03-03 23:10:08 +00:00
|
|
|
|
2021-05-25 09:29:38 +00:00
|
|
|
LDFLAGS += -X "$(MODULE)/version.Version=$(VERSION)" -X "$(MODULE)/version.CommitSHA=$(VERSION_HASH)"
|
2021-03-03 23:10:08 +00:00
|
|
|
|
2021-12-20 22:16:35 +00:00
|
|
|
## Build:
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: build
|
2021-12-20 22:16:35 +00:00
|
|
|
build: | build-frontend build-backend ## Build binary
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: build-frontend
|
2021-12-20 22:16:35 +00:00
|
|
|
build-frontend: ## Build frontend
|
2021-03-03 23:10:08 +00:00
|
|
|
$Q cd frontend && npm ci && npm run build
|
|
|
|
|
|
|
|
.PHONY: build-backend
|
2021-12-20 22:16:35 +00:00
|
|
|
build-backend: ## Build backend
|
|
|
|
$Q $(go) build -ldflags '$(LDFLAGS)' -o .
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
2021-12-20 22:16:35 +00:00
|
|
|
test: | test-frontend test-backend ## Run all tests
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: test-frontend
|
2021-12-20 22:16:35 +00:00
|
|
|
test-frontend: ## Run frontend tests
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: test-backend
|
2021-12-20 22:16:35 +00:00
|
|
|
test-backend: ## Run backend tests
|
|
|
|
$Q $(go) test -v ./...
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: lint
|
2024-04-24 20:51:37 +00:00
|
|
|
lint: lint-frontend lint-backend ## Run all linters
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: lint-frontend
|
2021-12-20 22:16:35 +00:00
|
|
|
lint-frontend: ## Run frontend linters
|
2021-03-03 23:10:08 +00:00
|
|
|
$Q cd frontend && npm ci && npm run lint
|
|
|
|
|
|
|
|
.PHONY: lint-backend
|
2021-12-20 22:16:35 +00:00
|
|
|
lint-backend: | $(golangci-lint) ## Run backend linters
|
|
|
|
$Q $(golangci-lint) run -v
|
2021-03-03 23:10:08 +00:00
|
|
|
|
|
|
|
.PHONY: lint-commits
|
2021-12-20 22:16:35 +00:00
|
|
|
lint-commits: $(commitlint) ## Run commit linters
|
2021-03-03 23:10:08 +00:00
|
|
|
$Q ./scripts/commitlint.sh
|
|
|
|
|
2021-12-20 22:16:35 +00:00
|
|
|
fmt: $(goimports) ## Format source files
|
|
|
|
$Q $(goimports) -local $(MODULE) -w $$(find . -type f -name '*.go' -not -path "./vendor/*")
|
|
|
|
|
|
|
|
clean: clean-tools ## Clean
|
|
|
|
|
|
|
|
## Release:
|
2021-12-20 21:36:35 +00:00
|
|
|
|
2021-03-03 23:10:08 +00:00
|
|
|
.PHONY: bump-version
|
2021-12-20 22:16:35 +00:00
|
|
|
bump-version: $(standard-version) ## Bump app version
|
2021-03-03 23:10:08 +00:00
|
|
|
$Q ./scripts/bump_version.sh
|
|
|
|
|
2021-12-20 22:16:35 +00:00
|
|
|
## Help:
|
|
|
|
help: ## Show this help
|
|
|
|
@echo ''
|
|
|
|
@echo 'Usage:'
|
|
|
|
@echo ' ${YELLOW}make${RESET} ${GREEN}<target> [options]${RESET}'
|
|
|
|
@echo ''
|
|
|
|
@echo 'Options:'
|
|
|
|
@$(call global_option, "V [0|1]", "enable verbose mode (default:0)")
|
|
|
|
@echo ''
|
|
|
|
@echo 'Targets:'
|
|
|
|
@awk 'BEGIN {FS = ":.*?## "} { \
|
|
|
|
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
|
|
|
|
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
|
|
|
|
}' $(MAKEFILE_LIST)
|