-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (97 loc) · 2.96 KB
/
Makefile
File metadata and controls
124 lines (97 loc) · 2.96 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
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
OUTPUT_DIR = deploy/output
SERVICES = apidoc gateway auth transaction user wallet
SERVICES_WITH_DB = auth user transaction wallet
include Makefile.help.mk
##@ Format
.PHONY: format
format: ## Format golang and proto files.
tool/script/format.sh
.PHONY: tidy
tidy: ## Format golang and proto files.
tool/script/tidy.sh
.PHONY: lint.struct
lint.struct: ## Run fieldalignment.
tool/script/lint-struct.sh
.PHONY: lint.cleancache
lint.cleancache: ## Clean golangci-lint cache.
golangci-lint cache clean
.PHONY: lint
lint: ## Lint proto files using buf and golang files using golangci-lint.
lint: lint.cleancache
tool/script/lint.sh ${svc}
.PHONY: pretty
pretty: ## Prettify golang and proto files. Basically, it runs tidy, format, and lint command.
pretty: tidy gen.db gen.proto gen.mock format lint lint.struct
.PHONY: check.import
check.import: ## Check if import blocks are separated accordingly.
tool/script/check-import.sh
.PHONY: check.proto
check.proto: ## Check if proto is formatted well.
tool/script/check-proto.sh
##@ Generator
.PHONY: gen.proto
gen.proto: ## Generate golang files from proto.
tool/script/generate-proto.sh
.PHONY: gen.mock
gen.mock: ## Generate mock from all golang interfaces.
tool/script/generate-mock.sh
.PHONY: gen.db
gen.db: ## Generate db using sqlc.
tool/script/generate-db.sh
.PHONY: gen.req
gen.req: ## Generate requirement document.
tool/script/requirement.sh $(name)
##@ Build
.PHONY: compile
compile: ## Compile service.
tool/script/compile.sh $(svc)
.PHONY: compile.all
compile.all: ## Compile all services.
for svc in $(SERVICES); do \
tool/script/compile.sh $$svc; \
done
.PHONY: build
build: ## Build docker for service.
tool/script/docker-build.sh $(svc)
.PHONY: build.all
build.all: ## Build docker for all services.
for svc in $(SERVICES); do \
tool/script/docker-build.sh $$svc; \
done
##@ Test
.PHONY: test.unit
test.unit: ## Run unit test.
tool/script/test.sh unit $(svc)
.PHONY: test.cover
test.cover: ## Run unit test.
tool/script/test.sh cover $(svc)
.PHONY: test.e2e
test.e2e: ## Run e2e test using Godog.
tool/script/test.sh e2e
##@ Migration
.PHONY: migration
migration: ## Create database migration using atlas.
for svc in $(SERVICES_WITH_DB); do \
tool/script/create-migration.sh $$svc; \
done
.PHONY: migrate
migrate: ## Run database migrations.
atlas migrate apply --dir file://service/$(svc)/db/migrations --url "postgresql://postgresuser:postgrespassword@postgres:5432/arjuna_$(svc)?sslmode=disable"
.PHONY: seed
seed: ## Run database seeder.
for svc in $(SERVICES); do \
tool/script/seed.sh $$svc; \
done
##@ Run
.PHONY: up
up: ## Run all containers in compose.yaml
docker compose --profile "*" up
.PHONY: down
down: ## Tear down all containers in compose.yaml
docker compose --profile "*" down
.PHONY: up.infra
up.infra: ## Run all containers in compose.yaml
docker compose --profile "infra" up
.PHONY: down.infra
down.infra: ## Tear down all containers in compose.yaml
docker compose --profile "infra" down