-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
145 lines (116 loc) · 3.86 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
SHELL := /bin/bash
.DEFAULT_GOAL := all
.PHONY: all
all: ## build pipeline
all: mod build
.PHONY: ci
ci: ## CI build pipeline
ci: all
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: clean
clean: ## remove files created during build pipeline
$(call print-target)
rm -rf dist
rm -f coverage.*
rm -f '"$(shell go env GOCACHE)/../golangci-lint"'
go clean -i -cache -testcache -modcache -fuzzcache -x
.PHONY: mod
mod: ## go mod tidy
$(call print-target)
go mod tidy
.PHONY: build
build: ## go build
$(call print-target)
go build ./...
.PHONY: spell
spell: ## misspell
$(call print-target)
go get -u github.com/client9/misspell/cmd/misspell
misspell -error -locale=US **/*.md
# .PHONY: test
# test: ## go test
# $(call print-target)
# go test -race -covermode=atomic -coverprofile=coverage.out -coverpkg=./... ./...
# go tool cover -html=coverage.out -o coverage.html
# .PHONY: diff
# diff: ## git diff
# $(call print-target)
# git diff --exit-code
# RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi
define print-target
@printf "Executing target: \033[36m$@\033[0m\n"
endef
.PHONY: up-mongo
up-mongo: ## docker-compose up for mongo
$(call print-target)
docker compose -f docker/docker-compose.mongo.yaml up --build -d
.PHONY: down-mongo
down-mongo: ## docker-compose down for mongo
$(call print-target)
docker compose -f docker/docker-compose.mongo.yaml down
.PHONY: up-influx
up-influx: ## docker-compose up for influx
$(call print-target)
docker compose -f docker/docker-compose.influx.yaml up --build -d
.PHONY: down-influx
down-influx: ## docker-compose down for influx
$(call print-target)
docker compose -f docker/docker-compose.influx.yaml down
.PHONY: up-timescale
up-timescale: ## docker-compose up for timescale
$(call print-target)
docker compose -f docker/docker-compose.timescale.yaml up --build -d
.PHONY: down-timescale
down-timescale: ## docker-compose down for timescale
$(call print-target)
docker compose -f docker/docker-compose.timescale.yaml down
.PHONY: up-loki
up-loki: ## docker-compose up for loki
$(call print-target)
docker compose -f docker/docker-compose.loki.yaml up --build -d
.PHONY: down-loki
down-loki: ## docker-compose down for loki
$(call print-target)
docker compose -f docker/docker-compose.loki.yaml down
.PHONY: up-kafka
up-kafka: ## docker-compose up for kafka
$(call print-target)
docker compose -f docker/docker-compose.kafka.yaml up --build -d
.PHONY: down-kafka
down-kafka: ## docker-compose down for kafka
$(call print-target)
docker compose -f docker/docker-compose.kafka.yaml down
.PHONY: up-elastic
up-elastic: ## docker-compose up for elastic
$(call print-target)
docker-compose -f docker/docker-compose.elastic.yaml up --build -d
.PHONY: down-elastic
down-elastic: ## docker-compose down for elastic
$(call print-target)
docker-compose -f docker/docker-compose.elastic.yaml down
.PHONY: logs-mongo
logs-mongo: ## docker-compose logs for mongo
$(call print-target)
docker compose -f docker/docker-compose.mongo.yaml logs -f
.PHONY: logs-influx
logs-influx: ## docker-compose logs for influx
$(call print-target)
docker compose -f docker/docker-compose.influx.yaml logs -f
.PHONY: logs-timescale
logs-timescale: ## docker-compose logs for timescale
$(call print-target)
docker compose -f docker/docker-compose.timescale.yaml logs -f
.PHONY: logs-loki
logs-loki: ## docker-compose logs for loki
$(call print-target)
docker compose -f docker/docker-compose.loki.yaml logs -f
.PHONY: logs-kafka
logs-kafka: ## docker-compose logs for kafka
$(call print-target)
docker compose -f docker/docker-compose.kafka.yaml logs -f
.PHONY: logs-elastic
logs-elastic: ## docker-compose logs for elastic
$(call print-target)
docker-compose -f docker/docker-compose.elastic.yaml logs -f