-
Notifications
You must be signed in to change notification settings - Fork 70
/
Makefile
147 lines (118 loc) · 4.71 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
146
147
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: up
up: ## Start the dependencies via docker compose. `export COMPOSE_PROFILES=dev,redis,...`
$(call print-target)
docker compose up -d
.PHONY: down
down: ## Stop the dependencies via docker compose
$(call print-target)
docker compose down --remove-orphans --volumes
.PHONY: update-openapi
update-openapi: ## Update OpenAPI spec
$(call print-target)
dagger call --source .:default generate openapi -o ./api/openapi.yaml
go generate ./api/...
.PHONY: update-openapi-cloud
update-openapi-cloud: ## Update OpenAPI spec
$(call print-target)
dagger call --source .:default generate openapicloud -o ./api/openapi.cloud.yaml
go generate ./api/...
.PHONY: gen-api
gen-api: update-openapi update-openapi-cloud ## Generate API and SDKs
$(call print-target)
dagger call generate node-sdk -o api/client/node
dagger call generate web-sdk -o api/client/web
# dagger call generate python-sdk -o api/client/python
.PHONY: migrate-check
migrate-check: ## Validate migrations
$(call print-target)
dagger call --source .:default migrate check
.PHONY: generate
generate: ## Generate code
$(call print-target)
go generate ./...
.PHONY: build-server
build-server: ## Build server binary
$(call print-target)
go build -o build/server ./cmd/server
.PHONY: build-sink-worker
build-sink-worker: ## Build sink-worker binary
$(call print-target)
go build -o build/sink-worker ./cmd/sink-worker
.PHONY: build-benthos-collector
build-benthos-collector: ## Build benthos collector binary
$(call print-target)
go build -o build/benthos-collector ./cmd/benthos-collector
.PHONY: build-balance-worker
build-balance-worker: ## Build balance-worker binary
$(call print-target)
go build -o build/balance-worker ./cmd/balance-worker
.PHONY: build-billing-worker
build-billing-worker: ## Build billing-worker binary
$(call print-target)
go build -o build/billing-worker ./cmd/billing-worker
.PHONY: build-notification-service
build-notification-service: ## Build notification-service binary
$(call print-target)
go build -o build/notification-service ./cmd/notification-service
config.yaml:
cp config.example.yaml config.yaml
.PHONY: server
server: ## Run sink-worker
@ if [ config.yaml -ot config.example.yaml ]; then diff -u config.yaml config.example.yaml || (echo "!!! The configuration example changed. Please update your config.yaml file accordingly (or at least touch it). !!!" && false); fi
$(call print-target)
air -c ./cmd/server/.air.toml
.PHONY: sink-worker
sink-worker: ## Run sink-worker
@ if [ config.yaml -ot config.example.yaml ]; then diff -u config.yaml config.example.yaml || (echo "!!! The configuration example changed. Please update your config.yaml file accordingly (or at least touch it). !!!" && false); fi
$(call print-target)
air -c ./cmd/sink-worker/.air.toml
.PHONY: balance-worker
balance-worker: ## Run balance-worker
@ if [ config.yaml -ot config.example.yaml ]; then diff -u config.yaml config.example.yaml || (echo "!!! The configuration example changed. Please update your config.yaml file accordingly (or at least touch it). !!!" && false); fi
$(call print-target)
air -c ./cmd/balance-worker/.air.toml
.PHONY: billing-worker
billing-worker: ## Run billing-worker
@ if [ config.yaml -ot config.example.yaml ]; then diff -u config.yaml config.example.yaml || (echo "!!! The configuration example changed. Please update your config.yaml file accordingly (or at least touch it). !!!" && false); fi
$(call print-target)
air -c ./cmd/billing-worker/.air.toml
.PHONY: notification-service
notification-service: ## Run notification-service
@ if [ config.yaml -ot config.example.yaml ]; then diff -u config.yaml config.example.yaml || (echo "!!! The configuration example changed. Please update your config.yaml file accordingly (or at least touch it). !!!" && false); fi
$(call print-target)
air -c ./cmd/notification-service/.air.toml
.PHONY: etoe
etoe: ## Run e2e tests
$(call print-target)
dagger call etoe
.PHONY: test
test: ## Run tests
$(call print-target)
dagger call test
.PHONY: lint
lint: ## Run linters
$(call print-target)
dagger call lint all
.PHONY: fmt
fmt: ## Format code
$(call print-target)
golangci-lint run --fix
.PHONY: mod
mod: ## go mod tidy
$(call print-target)
go mod tidy
.PHONY: seed
seed: ## Seed OpenMeter with test data
$(call print-target)
benthos -c etc/seed/seed.yaml
.PHONY: help
.DEFAULT_GOAL := help
help:
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# Variable outputting/exporting rules
var-%: ; @echo $($*)
varexport-%: ; @echo $*=$($*)
define print-target
@printf "Executing target: \033[36m$@\033[0m\n"
endef