forked from mattkelly/cerebral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (65 loc) · 2.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
SHELL=/bin/bash
PROJECT_NAME ?= "cerebral"
IMAGE_NAME ?= "containership/$(PROJECT_NAME)"
IMAGE_TAG ?= "latest"
PKG_LIST := $(shell go list ./...)
GO_FILES := $(shell find . -type f -not -path './vendor/*' -name '*.go')
# TODO generated fakes can get a vet error for a copied lock
VET_LIST := $(shell go list ./... | grep -v '/pkg/client/clientset/versioned/fake')
.PHONY: all
all: build ## (default) Build
.PHONY: fmt-check
fmt-check: ## Check the file format
@gofmt -s -e -d $(GO_FILES) | read; \
if [ $$? == 0 ]; then \
echo "gofmt check failed:"; \
gofmt -s -e -d $(GO_FILES); \
exit 1; \
fi
.PHONY: lint
lint: ## Lint the files
@golint -set_exit_status ${PKG_LIST}
.PHONY: test
test: ## Run unit tests
@go test -short ${PKG_LIST}
.PHONY: coverage
coverage: ## Run unit tests with coverage checking / codecov integration
@go test -short -coverprofile=coverage.txt -covermode=count ${PKG_LIST}
.PHONY: vet
vet: ## Vet the files
@go vet ${VET_LIST}
## Read about data race https://golang.org/doc/articles/race_detector.html
## to not test file for race use `// +build !race` at top
.PHONY: race
race: ## Run data race detector
@go test -race -short ${PKG_LIST}
.PHONY: msan
msan: ## Run memory sanitizer (only works on linux/amd64)
@go test -msan -short ${PKG_LIST}
.PHONY: help
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: dep
dep:
@dep ensure
.PHONY: gen
gen: ## Generate autogenerated files
@./hack/update-codegen.sh
.PHONY: verify
verify: ## Verify autogenerated files
@./hack/verify-codegen.sh
.PHONY: build
build: ## Build the project in Docker
@docker image build -t $(IMAGE_NAME):$(IMAGE_TAG) . \
--build-arg GIT_DESCRIBE=`git describe --dirty` \
--build-arg GIT_COMMIT=`git rev-parse --short HEAD` \
.PHONY: release
release: ## Build release image for controller (must be on semver tag)
@./hack/build-release.sh
### Commands for local development
.PHONY: deploy
deploy: ## Deploy Cerebral (without any prereqs)
kubectl apply -f examples/engines/containership/10-deployment-cerebral-containership.yaml
.PHONY: undeploy
undeploy: ## Delete Cerebral
kubectl delete -f examples/engines/containership/10-deployment-cerebral-containership.yaml