-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (40 loc) · 1.87 KB
/
Makefile
File metadata and controls
58 lines (40 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
OUTPUT_DIR ?= bin
.PHONY: all build clean lint lint.fix test test.integration fmt changelog hooks.install pre-commit help
## Build -------------------------------------------------------------------
all: build
build: ## Build the binary into bin/
@echo "Building verda ..."
@mkdir -p $(OUTPUT_DIR)
@go build -o $(OUTPUT_DIR)/verda ./cmd/verda/
clean: ## Remove build artifacts
@rm -rf $(OUTPUT_DIR)
## Quality -----------------------------------------------------------------
lint: ## Run golangci-lint on all packages
@golangci-lint run ./...
lint.fix: ## Run golangci-lint with auto-fix
@golangci-lint run --fix ./...
test: ## Run all tests
@go test -count=1 ./...
test.integration: build ## Run integration tests (requires staging credentials in [test] profile)
@cp $(OUTPUT_DIR)/verda /usr/local/bin/verda-test
@VERDA_BIN=$(CURDIR)/$(OUTPUT_DIR)/verda go test -tags=integration -v -count=1 -timeout=5m ./tests/integration/
fmt: ## Format code with gofmt and goimports
@gofmt -w .
@goimports -w -local github/verda-cloud/verda-cli .
@go mod tidy
## Release -----------------------------------------------------------------
changelog: ## Generate CHANGELOG.md (requires VERSION, e.g. make changelog VERSION=v1.0.0)
ifndef VERSION
$(error VERSION is required. Usage: make changelog VERSION=v1.0.0)
endif
@git-cliff --tag $(VERSION) -o CHANGELOG.md
## Git Hooks ---------------------------------------------------------------
hooks.install: ## Configure git to use githooks/ as the hooks directory
@git config core.hooksPath githooks
@echo "Git hooks installed (githooks/)"
pre-commit: ## Run all pre-commit checks manually
@pre-commit run --all-files
## Help --------------------------------------------------------------------
help: ## Show this help
@grep -E '^[a-zA-Z_.]+:.*##' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'