forked from mvisonneau/vac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (40 loc) · 1.49 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
NAME := vac
COVERAGE_FILE := coverage.out
REPOSITORY := mvisonneau/$(NAME)
.DEFAULT_GOAL := help
.PHONY: fmt
fmt: ## Format source code
go run mvdan.cc/[email protected] -w $(shell git ls-files **/*.go)
go run github.com/daixiang0/[email protected] write -s standard -s default -s "prefix(github.com/mvisonneau)" .
.PHONY: lint
lint: ## Run all lint related tests upon the codebase
go run github.com/golangci/golangci-lint/cmd/[email protected] run -v --fast
.PHONY: test
test: ## Run the tests against the codebase
@rm -rf $(COVERAGE_FILE)
go test -v -count=1 -race ./... -coverprofile=$(COVERAGE_FILE)
@go tool cover -func $(COVERAGE_FILE) | awk '/^total/ {print "coverage: " $$3}'
.PHONY: coverage
coverage: ## Prints coverage report
go tool cover -func $(COVERAGE_FILE)
.PHONY: install
install: ## Build and install locally the binary (dev purpose)
go install ./cmd/$(NAME)
.PHONY: build
build: ## Build the binaries using local GOOS
go build ./cmd/$(NAME)
.PHONY: prerelease
prerelease: setup ## Build & prerelease the binaries (edge)
@\
REPOSITORY=$(REPOSITORY) \
NAME=$(NAME) \
GITHUB_TOKEN=$(GITHUB_TOKEN) \
.github/prerelease.sh
.PHONY: clean
clean: ## Remove binary if it exists
rm -f $(NAME)
.PHONY: all
all: lint test build coverage ## Test, builds and ship package for all supported platforms
.PHONY: help
help: ## Displays this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'