-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (46 loc) · 1.43 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
##@ Build
.PHONY: build
build: ## Build cim binaries.
@cargo build --release
.PHONY: fmt
fmt: ## fmt projects
# @cargo fmt -- --check
@cargo fmt
##@ Generate
.PHONY: generate
generate:
.PHONY: migrate
migrate: ## migrate database
@sqlx database create && sqlx migrate run
.PHONY: rs
rs: ## run server
sudo docker build -f ./server/build/Dockerfile -t server:latest . && \
sudo docker run -itd -p 30050:30050 --restart=always --name server server:latest
.PHONY: database
database: ## install database cli
@cargo install sqlx-cli --no-default-features --features rustls,mysql
##@ Test and Lint
.PHONY: test
test: ## Test go code.
@cargo test
.PHONY: check
check: ## check rust code
@cargo check --all
.PHONY: clippy
clippy: ## run rust linter
@cargo clippy
##@ Clean
clean: ## Delete all builds
@cargo clean
FORMATTING_BEGIN_YELLOW = \033[0;33m
FORMATTING_BEGIN_BLUE = \033[36m
FORMATTING_END = \033[0m
.PHONY: help
help:
@awk 'BEGIN {\
FS = ":.*##"; \
printf "Usage: ${FORMATTING_BEGIN_BLUE}OPTION${FORMATTING_END}=<value> make ${FORMATTING_BEGIN_YELLOW}<target>${FORMATTING_END}\n"\
} \
/^[a-zA-Z0-9_-]+:.*?##/ { printf " ${FORMATTING_BEGIN_BLUE}%-46s${FORMATTING_END} %s\n", $$1, $$2 } \
/^.?.?##~/ { printf " %-46s${FORMATTING_BEGIN_YELLOW}%-46s${FORMATTING_END}\n", "", substr($$1, 6) } \
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)