-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) · 1.64 KB
/
Makefile
File metadata and controls
68 lines (56 loc) · 1.64 KB
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
PWD := $(shell pwd)
APP_NAME := $(shell basename ${PWD})
GOLANGCI_LINT_VERSION := 1.52.2
GOLANGCI_LINT := bin/golangci-lint-$(GOLANGCI_LINT_VERSION)/golangci-lint
all: help
## run: build and run
.PHONY: run
run: build
@echo "🚀 Running"
./bin/${APP_NAME}
## build: build the application
.PHONY: build
build:
@echo "👷 Building the application"
@go build -o bin/${APP_NAME} github.com/philiplinell/commit-msg/cmd/cli
@echo "✅ Built !"
## test: run tests
.PHONY: test
test:
@echo "🧪 Testing the application"
@go test -race ./...
## coverage: create coverage report in HTML format
.PHONY: coverage
coverage:
@echo "📜 Creating coverage report in HTML format"
@go test -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out
## lint: lint the application
.PHONY: lint
lint: ${GOLANGCI_LINT}
@echo "🕵️ Linting code"
@${GOLANGCI_LINT} run
## expvarmon: start expvarmon tui (github.com/divan/expvarmon)
.PHONY: expvarmon
expvarmon:
expvarmon -ports="40001"
## install-delve: Installs delve debugger
.PHONY: install-delve
install-delve:
go install github.com/go-delve/delve/cmd/dlv@latest
## debug: Starts the delve debugger
.PHONY: debug
debug:
dlv debug github.com/philiplinell/commit-msg/cmd/cli
.PHONY: help
help:
@echo "📓 Run one of the following commands using make <command>"
@echo
@cat Makefile | grep "^##" | column -t -s ":" | sed "s/##/ /"
@echo
${GOLANGCI_LINT}:
@echo "Please install golang ci lint version ${GOLANGCI_LINT_VERSION}"
@echo "into ${GOLANGCI_LINT}"
@echo
@echo "You should be able to find it here: https://github.com/golangci/golangci-lint/releases/tag/v${GOLANGCI_LINT_VERSION}"
@exit 1