-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·78 lines (60 loc) · 2.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
GOFILES = $(shell go list -mod vendor ./... | grep -v vendor)
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: generate
generate: ## Generate the mock client
@go generate -mod=mod ./...
.PHONY: analyze
analyze: lint vet test ## Run lint, vet, and test
.PHONY: lint
lint: ## Lint the code
@ revive -config .revive.toml ./... | grep -v vendor
.PHONY: test
test: unit-test ## Run the test suite(s).
.PHONY: unit-test
unit-test: ## Run the unit tests.
@gotestsum --format=standard-verbose -- -run '(?i)unit' ./...
.PHONY: test-with-coverage
test-with-coverage: unit-test-with-coverage ## Run the test suite(s) and output test coverage data.
.PHONY: unit-test-with-coverage
unit-test-with-coverage: ## Run the unit tests.
@gotestsum --format=standard-verbose -- -run '(?i)unit' ./... -coverprofile=c.out
.PHONY: vet
vet: ## Verify `go vet` passes.
@go vet -mod vendor $(GOFILES)
.PHONY: build
build: ## Build the binary
@go build whats-up.1h.go
.PHONY: create-config
create-config: ## Create the configuration file
cp .whats-up.sample.json .whats-up.json
.PHONY: setup-osx-env
setup-osx-env: brew-deps setup-asdf install-goimports install-gotestsum asdf-reshim setup-pre-commit ## Setup the development environment for OS X
.PHONY: brew-deps
brew-deps: ## Install tools via Homebrew
@echo ">>>> Installing tools"
@brew bundle install --no-lock --file Brewfile
.PHONY: setup-asdf
setup-asdf: ## Install Go via asdf
@echo ">>>> Installing asdf plugins"
-@asdf plugin add golang
@echo ">>>> Installing Go via asdf"
@asdf install
.PHONY: install-goimports
install-goimports: ## Install goimports
@echo ">>>> Installing goimports"
@go install golang.org/x/tools/cmd/goimports@latest
.PHONY: install-gotestsum
install-gotestsum: ## Install gotestsum
@echo ">>>> Installing gotestsum"
@go install gotest.tools/gotestsum@latest
.PHONY: asdf-reshim
asdf-reshim: ## Reshim asdf
@asdf reshim golang
.PHONY: setup-pre-commit
setup-pre-commit: ## Setup pre-commit hooks
@echo ">>>> Setting up pre-commit"
@git config --global init.templateDir ~/.git-template
@pre-commit init-templatedir -t pre-commit -t prepare-commit-msg ~/.git-template
@pre-commit install --install-hooks --allow-missing-config -t pre-commit -t prepare-commit-msg -f