-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
39 lines (32 loc) · 1.02 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
## help: print this help message
help:
@echo "Usage:"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ":" | sed -e 's/^/ /'
## lint: runs golangci lint based on .golangci.yml configuration
.PHONY: lint
lint:
golangci-lint run -c .golangci.yml --fix -v
## unit-test: runs tests
.PHONY: unit-test
unit-test:
go test -v ./... -coverprofile=unit_coverage.out
## unit-coverage-html: extract unit tests coverage to html format
.PHONY: unit-coverage-html
unit-coverage-html:
make unit-test
go tool cover -html=unit_coverage.out -o unit_coverage.html
## before-commit: run golangci lint and unit tests before commit
.PHONY: before-commit
before-commit: lint unit-test
## build-cli: build the cli application
.PHONY: build-cli
build-cli:
go build -o vx cmd/vx/main.go
## precommit-install: install pre-commit scripts to .git/hooks
.PHONY: precommit-install
precommit-install:
pre-commit install
## precommit-run: runs pre-commit scripts without commiting the changes
.PHONY: precommit-run
precommit-run:
pre-commit run --all-files