-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (56 loc) · 2.64 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
define KO
MVERSION=$$(go run github.com/LilithGames/moxa/tools/pkghash -short -pkg github.com/LilithGames/moxa/master_shard) \
SVERSION=$$(go run github.com/LilithGames/moxa/tools/pkghash -short -pkg github.com/LilithGames/moxa/sub_shard) \
ko
endef
.PHONY: proto
proto:
@protoc -I. -Iproto --go_out=paths=source_relative:. ./master_shard/state.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. --dragonboat_out=paths=source_relative:. ./master_shard/api.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. ./cluster/member.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. ./cluster/event.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. ./cluster/snapshot.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. ./cluster/config.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. ./service/config.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. ./utils/sync.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. ./service/api.proto
@protoc -I. -Iproto --grpc-gateway_out=. --grpc-gateway_opt=logtostderr=true --grpc-gateway_opt=paths=source_relative --grpc-gateway_opt=generate_unbound_methods=true ./service/api.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. --dragonboat_out=paths=source_relative:. ./sub_shard/api.proto
@protoc -I. -Iproto --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. ./sub_service/api.proto
@protoc -I. -Iproto --grpc-gateway_out=. --grpc-gateway_opt=logtostderr=true --grpc-gateway_opt=paths=source_relative --grpc-gateway_opt=generate_unbound_methods=true ./sub_service/api.proto
.PHONY: clean-proto
clean-proto:
@rm -f master_shard/*.pb*.go
@rm -f sub_shard/*.pb*.go
@rm -f cluster/*.pb*.go
@rm -f service/*.pb*.go
.PHONY: build-image
build-image: proto
@$(KO) build -B github.com/LilithGames/moxa/cmd/moxa
.PHONY: build-linux
build-linux: proto
@GOOS=linux go build -o bin/ github.com/LilithGames/moxa/cmd/...
.PHONY: build-base-mage
build-base-mage: build-linux
@docker-compose -f deploy/docker-compose.yaml build moxactl
.PHONY: build
build: proto
@go build -o bin/ github.com/LilithGames/moxa/cmd/...
.PHONY: test
test:
@go test -count=3 github.com/LilithGames/moxa/...
.PHONY: run
run: build-base-mage
@docker run -it --rm --entrypoint=bash $$($(KO) build -B github.com/LilithGames/moxa/cmd/moxa)
.PHONY: run-ctl
run-ctl: build
@bin/moxactl.exe $@
.PHONY: install
install: build-base-mage
@kubectl kustomize deploy | $(KO) resolve -B -f - | kubectl apply -f -
.PHONY: clean
clean:
@kubectl delete -k deploy
.PHONY: deploy
deploy: install
@kubectl rollout status statefulset.apps/moxa -n temp