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