-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (43 loc) · 1.85 KB
/
Makefile
File metadata and controls
61 lines (43 loc) · 1.85 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
SHELL := /bin/bash
.PHONY: help clean build lint run test style license godoc install_docgo install_addlicense before_commit pre-commit
SOURCES:=$(shell find . -name '*.go')
DOCFILES:=$(addprefix docs/packages/, $(addsuffix .html, $(basename ${SOURCES})))
pre-commit: ## Run pre-commit hooks on all files
pre-commit run --all-files
lint: pre-commit ## Run linting via pre-commit hooks
style: pre-commit ## Run all formatting and linting via pre-commit hooks
test: clean build ## Run the unit tests
@go test -coverprofile coverage.out $(shell go list ./...)
benchmark: ## Run benchmarks
@echo "Running benchmarks"
./benchmark.sh
cover: test ## Display test coverage on generated HTML pages
@go tool cover -html=coverage.out
coverage: ## Display test coverage onto terminal
@go tool cover -func=coverage.out
before_commit: pre-commit test license ## Checks done before commit
./check_coverage.sh
license: install_addlicense ## Add license in every file in repository
addlicense -c "Red Hat, Inc" -l "apache" -v ./
docs/packages/%.html: %.go
mkdir -p $(dir $@)
docgo -outdir $(dir $@) $^
addlicense -c "Red Hat, Inc" -l "apache" -v $@
godoc: export GO111MODULE=off
godoc: install_docgo install_addlicense ${DOCFILES} docs/sources.md
docs/sources.md: docs/sources.tmpl.md ${DOCFILES}
./gen_sources_md.sh
install_docgo: export GO111MODULE=off
install_docgo:
[[ `command -v docgo` ]] || GO111MODULE=off go get -u github.com/dhconnelly/docgo
install_addlicense: export GO111MODULE=off
install_addlicense:
[[ `command -v addlicense` ]] || GO111MODULE=off go get -u github.com/google/addlicense
help: ## Show this help screen
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@echo 'Available targets are:'
@echo ''
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo ''