github.com/maypok86/otter@v1.2.1/Makefile (about) 1 .PHONY: setup 2 setup: deps ## Setup development environment 3 cp ./scripts/pre-push.sh .git/hooks/pre-push 4 chmod +x .git/hooks/pre-push 5 6 .PHONY: deps 7 deps: ## Install all the build and lint dependencies 8 bash scripts/deps.sh 9 10 .PHONY: fmt 11 fmt: ## Run format tools on all go files 12 gci write --skip-vendor --skip-generated \ 13 -s standard -s default -s "prefix(github.com/maypok86/otter)" . 14 gofumpt -l -w . 15 16 .PHONY: lint 17 lint: ## Run all the linters 18 golangci-lint run -v ./... 19 20 .PHONY: test 21 test: test.unit ## Run all the tests 22 23 .PHONY: test.unit 24 test.unit: ## Run all unit tests 25 @echo 'mode: atomic' > coverage.txt 26 go test -covermode=atomic -coverprofile=coverage.txt.tmp -coverpkg=./... -v -race ./... 27 cat coverage.txt.tmp | grep -v -E "/generated/|/cmd/" > coverage.txt 28 rm coverage.txt.tmp 29 30 .PHONY: test.32-bit 31 test.32-bit: ## Run tests on 32-bit arch 32 GOARCH=386 go test -v ./... 33 34 .PHONY: cover 35 cover: test.unit ## Run all the tests and opens the coverage report 36 go tool cover -html=coverage.txt 37 38 .PHONY: ci 39 ci: lint test ## Run all the tests and code checks 40 41 .PHONY: generate 42 generate: ## Generate files for the project 43 go run ./cmd/generator ./internal/generated/node 44 45 .PHONY: clean 46 clean: ## Remove temporary files 47 @go clean 48 @rm -rf bin/ 49 @rm -rf coverage.txt lint.txt 50 @echo "SUCCESS!" 51 52 .PHONY: help 53 help: 54 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 55 56 .DEFAULT_GOAL:= help