-
Notifications
You must be signed in to change notification settings - Fork 102
/
Makefile
94 lines (77 loc) · 2.95 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
.PHONY: test
test: api-test ui-test ## run all Unit Tests
.PHONY: lint
lint: api-lint ui-lint yaml-lint ## check all Lints
.PHONY: api-check
api-check: goa-gen api-test generated api-lint ## all API checks
.PHONY: ui-check
ui-check: ui-test ui-lint ## all UI checks
.PHONY: goa-gen
goa-gen: ## generate API Design
@echo "----------------------------"
@echo "-- Generating API Design... "
@echo "----------------------------"
cd api && go mod vendor && goa gen github.com/tektoncd/hub/api/design
@echo "----------------------------"
@echo "- Generating v1 API Design... "
@echo "----------------------------"
cd api/v1 && go mod vendor && goa gen github.com/tektoncd/hub/api/v1/design
.PHONY: generated
generated: ## update the golden files
@echo "----------------------------"
@echo "-- Generating Golden Files... --"
@echo "----------------------------"
cd api && go mod vendor && bash update-golden-files.sh
.PHONY: api-lint
api-lint: ## run API Lint
@echo "----------------------------"
@echo "-- Linting API Files... --"
@echo "----------------------------"
cd api && golangci-lint run -v ./pkg/... ./v1/service/... --timeout=5m
.PHONY: api-test
api-test: ## run API Unit Test
@echo "----------------------------"
@echo "-- Running API Unit Tests --"
@echo "----------------------------"
@echo "🛢 🛢 🛢 Make sure you have your Database Up and Running 🛢 🛢 🛢"
@echo "----------------------------"
cd api && go mod vendor && go test -p 1 -v ./pkg/... ./v1/service/...
.PHONY: api-build
api-build: ## generate the API binary
@echo "----------------------------"
@echo "-- Running API Build... --"
@echo "----------------------------"
cd api && go mod vendor && go build -mod=vendor ./cmd/...
.PHONY: ui-lint
ui-lint: ## run UI Lint
@echo "----------------------------"
@echo "-- Linting UI Files... --"
@echo "----------------------------"
cd ui && npm clean-install && npm run lint
.PHONY: ui-test
ui-test: ## run UI Unit Test
@echo "----------------------------"
@echo "-- Running UI Unit Tests --"
@echo "----------------------------"
cd ui && npm clean-install && CI=true npm test
.PHONY: ui-build
ui-build: ## generate the UI binary
@echo "----------------------------"
@echo "-- Running UI Build... --"
@echo "----------------------------"
cd ui && npm clean-install && CI=true npm run build
.PHONY: swagger-build
swagger-build: ## generate the UI binary
@echo "----------------------------"
@echo "-- Running Swagger Build... --"
@echo "----------------------------"
cd swagger && npm install --legacy-peer-deps && CI=true npm run build
.PHONY: yaml-lint
yaml-lint: ## run YAML Lint
@echo "----------------------------"
@echo "-- Running Yaml-lint... --"
@echo "----------------------------"
yamllint -c .yamllint ./config.yaml ./config
.PHONY: help
help: ## print this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)