This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
58 lines (44 loc) · 2.57 KB
/
Makefile
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
FILES = $(shell find . -type f -name '*.go')
RELEASE_VERSION ?= v0.0.0-$(shell git rev-parse --short HEAD)
RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD)
LD_FLAGS = -ldflags " \
-X 'github.com/percona/percona-everest-cli/pkg/version.ProjectName=everestctl' \
-X 'github.com/percona/percona-everest-cli/pkg/version.Version=$(RELEASE_VERSION)' \
-X 'github.com/percona/percona-everest-cli/pkg/version.FullCommit=$(RELEASE_FULLCOMMIT)' \
"
default: help
help: ## Display this help message
@echo "Please use \`make <target>\` where <target> is one of:"
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}'
init: ## Install development tools
cd tools && go generate -x -tags=tools
build: ## Build binaries
go build -race $(LD_FLAGS) -o bin/everest ./cmd/everest
gen: ## Generate code
go generate ./...
make format
format: ## Format source code
bin/gofumpt -l -w $(FILES)
bin/goimports -local github.com/percona/percona-everest-cli -l -w $(FILES)
bin/gci write --section Standard --section Default --section "Prefix(github.com/percona/percona-everest-cli)" $(FILES)
check: ## Run checks/linters for the whole project
bin/go-consistent -pedantic ./...
LOG_LEVEL=error bin/golangci-lint run
test: ## Run tests
go test -race -timeout=30s ./...
test-cover: ## Run tests and collect per-package coverage information
go test -race -timeout=30s -count=1 -coverprofile=cover.out -covermode=atomic ./...
test-crosscover: ## Run tests and collect cross-package coverage information
go test -race -timeout=30s -count=1 -coverprofile=crosscover.out -covermode=atomic -p=1 -coverpkg=./... ./...
k8s: ## Create a local minikube cluster
minikube start --nodes=3 --cpus=4 --memory=4g --apiserver-names host.docker.internal
minikube addons disable storage-provisioner
kubectl delete storageclass standard
kubectl apply -f ./dev/kubevirt-hostpath-provisioner.yaml
release:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v $(LD_FLAGS) -o ./dist/everestctl-linux-amd64 ./cmd/everest
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -v $(LD_FLAGS) -o ./dist/everestctl-linux-arm64 ./cmd/everest
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -v $(LD_FLAGS) -o ./dist/everestctl-darwin-amd64 ./cmd/everest
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -v $(LD_FLAGS) -o ./dist/everestctl-darwin-arm64 ./cmd/everest
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v $(LD_FLAGS) -o ./dist/everestctl.exe ./cmd/everest