Skip to content

Commit 440fb31

Browse files
committed
ref(makefile): cleanup the Makefile
1 parent 62454a8 commit 440fb31

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Makefile

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
11
help: ## Show help messages.
2-
@grep -E '^[0-9a-zA-Z_-]+:(.*?## .*)?$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2+
@grep -E '^[0-9a-zA-Z_-]+:(.*?## .*)?$$' $(MAKEFILE_LIST) | sed 's/^Makefile://' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
33

44
run="."
55
dir="./..."
66
short="-short"
77
flags=""
8-
timeout=40s
8+
timeout=1m
99

10-
.PHONY: tests
11-
tests: ## Run unit tests in watch mode. You can set: [run, timeout, short, dir, flags]. Example: make tests flags="-race".
10+
.PHONY: unit_test
11+
unit_test: ## Run unit tests. You can set: [run, timeout, short, dir, flags]. Example: make unit_test flags="-race".
12+
@go mod tidy; go test -trimpath --timeout=$(timeout) $(short) $(dir) -run $(run) $(flags)
13+
14+
.PHONY: unit_test_watch
15+
unit_test_watch: ## Run unit tests in watch mode. You can set: [run, timeout, short, dir, flags]. Example: make unit_test flags="-race".
1216
@echo "running tests on $(run). waiting for changes..."
13-
@-zsh -c "go test -trimpath --timeout=$(timeout) $(short) $(dir) -run $(run) $(flags); repeat 100 printf '#'; echo"
14-
@reflex -d none -r "(\.go$$)|(go.mod)" -- zsh -c "go test -trimpath --timeout=$(timeout) $(short) $(dir) -run $(run) $(flags); repeat 100 printf '#'"
17+
@-zsh -c "go mod tidy; go test -trimpath --timeout=$(timeout) $(short) $(dir) -run $(run) $(flags); repeat 100 printf '#'; echo"
18+
@reflex -d none -r "(\.go$$)|(go.mod)|(\.sql$$)" -- zsh -c "go mod tidy; go test -trimpath --timeout=$(timeout) $(short) $(dir) -run $(run) $(flags); repeat 100 printf '#'"
1519

1620
.PHONY: lint
17-
lint: ## Run linters.
21+
lint: ## list the code
1822
go fmt ./...
1923
go vet ./...
2024
golangci-lint run ./...
2125

26+
.PHONY: ci_tests
27+
ci_tests: ## Run tests for CI.
28+
go test -trimpath --timeout=10m -failfast -v -tags=integration -race -covermode=atomic -coverprofile=coverage.out ./...
29+
2230
.PHONY: dependencies
2331
dependencies: ## Install dependencies requried for development operations.
24-
@go get -u github.com/cespare/reflex
2532
@go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2
33+
@go install github.com/cespare/reflex@latest
2634
@go get github.com/stretchr/testify/mock
2735
@go get github.com/vektra/mockery/.../
2836
@go mod tidy
2937

30-
.PHONY: ci_tests
31-
ci_tests: ## Run tests for CI.
32-
go test -trimpath --timeout=10m -failfast -v -race -covermode=atomic -coverprofile=coverage.out ./...
33-
3438
.PHONY: clean
3539
clean: ## Clean test caches and tidy up modules.
3640
@go clean -testcache

0 commit comments

Comments
 (0)