-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (45 loc) · 1.73 KB
/
Makefile
File metadata and controls
64 lines (45 loc) · 1.73 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
59
60
61
62
63
64
NAME="github.com/raystack/compass"
COMMIT := $(shell git rev-parse --short HEAD)
TAG := "$(shell git rev-list --tags --max-count=1)"
VERSION := "$(shell git describe --tags ${TAG})-next"
BUILD_DIR=dist
PROTON_COMMIT := "eefb04d"
.PHONY: all build clean test tidy vet proto setup format generate lint install
all: clean test build format lint
tidy: ## Tidy go.mod
@go mod tidy -v
install: ## Install compass binary
@go install
format: ## Format Go source files
@go fmt ./...
lint: ## Run lint checks
@golangci-lint run
clean: ## Clean build artifacts
@rm -rf coverage.out ${BUILD_DIR}
test: ## Run tests with coverage
@go test ./... -race -coverprofile=coverage.out
e2e: ## Run e2e tests
@go test ./test/... --tags=e2e
coverage: test ## Generate coverage report
@go tool cover -html=coverage.out
build: ## Build the compass binary
@CGO_ENABLED=0 go build -ldflags "-X ${NAME}/cli.Version=${VERSION}"
buildr: setup ## Build release snapshot
@goreleaser release --snapshot --skip=publish --clean
vet: ## Run go vet
@go vet ./...
download: ## Download go modules
@go mod download
generate: ## Run go generate
@go generate ./...
config: ## Generate sample config file
@cp internal/config/config.example.yaml config.yaml
proto: ## Generate protobuf files
@rm -rf proto/
@buf generate https://github.com/raystack/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path raystack/compass -v
setup: ## Install required dependencies
@go mod tidy
@go install github.com/vektra/mockery/v2@latest
@go install github.com/bufbuild/buf/cmd/buf@latest
help: ## Display this help message
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'