|
1 | 1 | 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}' |
3 | 3 |
|
4 | 4 | run="." |
5 | 5 | dir="./..." |
6 | 6 | short="-short" |
7 | 7 | flags="" |
8 | | -timeout=40s |
| 8 | +timeout=1m |
9 | 9 |
|
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". |
12 | 16 | @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 '#'" |
15 | 19 |
|
16 | 20 | .PHONY: lint |
17 | | -lint: ## Run linters. |
| 21 | +lint: ## list the code |
18 | 22 | go fmt ./... |
19 | 23 | go vet ./... |
20 | 24 | golangci-lint run ./... |
21 | 25 |
|
| 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 | + |
22 | 30 | .PHONY: dependencies |
23 | 31 | dependencies: ## Install dependencies requried for development operations. |
24 | | - @go get -u github.com/cespare/reflex |
25 | 32 | @go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2 |
| 33 | + @go install github.com/cespare/reflex@latest |
26 | 34 | @go get github.com/stretchr/testify/mock |
27 | 35 | @go get github.com/vektra/mockery/.../ |
28 | 36 | @go mod tidy |
29 | 37 |
|
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 | | - |
34 | 38 | .PHONY: clean |
35 | 39 | clean: ## Clean test caches and tidy up modules. |
36 | 40 | @go clean -testcache |
|
0 commit comments