forked from RedHatInsights/insights-results-aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
114 lines (82 loc) · 2.78 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
SHELL := /bin/bash
.PHONY: default clean build fmt lint vet cyclo ineffassign shellcheck errcheck goconst gosec abcgo json-check openapi-check style run test test-postgres cover integration_tests rest_api_tests sqlite_db license before_commit help godoc
SOURCES:=$(shell find . -name '*.go')
BINARY:=insights-results-aggregator
DOCFILES:=$(addprefix docs/packages/, $(addsuffix .html, $(basename ${SOURCES})))
default: build
clean: ## Run go clean
@go clean
build: ${BINARY} ## Keep this rule for compatibility
${BINARY}: ${SOURCES}
./build.sh
fmt: ## Run go fmt -w for all sources
@echo "Running go formatting"
./gofmt.sh
lint: ## Run golint
@echo "Running go lint"
./golint.sh
vet: ## Run go vet. Report likely mistakes in source code
@echo "Running go vet"
./govet.sh
cyclo: ## Run gocyclo
@echo "Running gocyclo"
./gocyclo.sh
ineffassign: ## Run ineffassign checker
@echo "Running ineffassign checker"
./ineffassign.sh
shellcheck: ## Run shellcheck
./shellcheck.sh
errcheck: ## Run errcheck
@echo "Running errcheck"
./goerrcheck.sh
goconst: ## Run goconst checker
@echo "Running goconst checker"
./goconst.sh ${VERBOSE}
gosec: ## Run gosec checker
@echo "Running gosec checker"
./gosec.sh ${VERBOSE}
abcgo: ## Run ABC metrics checker
@echo "Run ABC metrics checker"
./abcgo.sh ${VERBOSE}
json-check: ## Check all JSONs for basic syntax
@echo "Run JSON checker"
python3 utils/json_check.py
openapi-check:
./check_openapi.sh
style: fmt vet lint cyclo shellcheck errcheck goconst gosec ineffassign abcgo json-check ## Run all the formatting related commands (fmt, vet, lint, cyclo) + check shell scripts
run: ${BINARY} ## Build the project and executes the binary
./$^
automigrate: ${BINARY}
./$^ migrate latest
test: ${BINARY} ## Run the unit tests
./unit-tests.sh
test-postgres: ${BINARY}
./unit-tests.sh postgres
cover: test
@go tool cover -html=coverage.out
integration_tests: ${BINARY} ## Run all integration tests
@echo "Running all integration tests"
@./test.sh
rest_api_tests: ${BINARY} ## Run REST API tests
@echo "Running REST API tests"
@./test.sh rest_api
sqlite_db:
mv aggregator.db aggragator.db.backup
local_storage/create_database_sqlite.sh
license:
GO111MODULE=off go get -u github.com/google/addlicense && \
addlicense -c "Red Hat, Inc" -l "apache" -v ./
before_commit: style test test-postgres integration_tests openapi-check license ## Checks done before commit
./check_coverage.sh
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 ''
docs/packages/%.html: %.go
mkdir -p $(dir $@)
docgo -outdir $(dir $@) $^
godoc: ${DOCFILES}