github.com/lkingland/gridd@v0.0.0-20230313082622-f3ae21fe9d22/Makefile (about) 1 CODE := $(shell find . -name '*.go') 2 DATE := $(shell date -u +"%Y%m%dT%H%M%SZ") 3 HASH := $(shell git rev-parse --short HEAD 2>/dev/null) 4 VTAG := $(shell git tag --points-at HEAD) 5 VERS := $(shell [ -z $(VTAG) ] && echo 'tip' || echo $(VTAG) ) 6 7 all: build 8 9 help: 10 @echo 'Usage: make <OPTIONS> ... <TARGETS>' 11 @echo '' 12 @echo 'Available targets are:' 13 @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 14 15 ############### 16 # Development # 17 ############### 18 19 ##@ Development 20 21 build: gridd gridctl ## (default) build binaries for current OS 22 23 check: ## Check for linting errors (requires golangci-lint) 24 golangci-lint run -E goimports -E golint -E govet 25 26 cluster: ## Set up a local cluster (requires kind,yq) 27 ./hack/allocate.sh 28 ./hack/configure.sh 29 30 ########### 31 # Testing # 32 ########### 33 34 ##@ Testing 35 36 test: $(CODE) ## Run unit tests 37 go test -race -cover -coverprofile=coverage.out ./... 38 39 integration: $(CODE) ## Run integration tests 40 go test -tags integration ./... 41 42 e2e: $(CODE) ## Run e2e tests 43 @echo "Not Implemented" 44 45 ############# 46 # Artifacts # 47 ############# 48 49 ##@ Artifacts 50 51 gridd: $(CODE) ## Build the 'gridd' Grid daemon 52 go build -ldflags "-X main.date=$(DATE) -X main.vers=$(VERS) -X main.hash=$(HASH)" ./cmd/gridd 53 54 gridctl: $(CODE) ## Build the 'gridctl' Grid CLI 55 go build -ldflags "-X main.date=$(DATE) -X main.vers=$(VERS) -X main.hash=$(HASH)" ./cmd/gridctl 56 57 clean: ## Remove all build and test artifacts 58 @rm -f ./gridd 59 @rm -f ./gridctl 60 @rm -f ./coverage.out 61