64 lines
2.2 KiB
Makefile
64 lines
2.2 KiB
Makefile
.PHONY: dev test build proto proto-go proto-python proto-tools proto-check web-install web-build compose-up compose-down integration-smoke loadtest
|
|
|
|
PROTOC_GEN_GO_VERSION := v1.36.5
|
|
PROTOC_GEN_GO_GRPC_VERSION := v1.5.1
|
|
GRPCIO_TOOLS_VERSION := 1.71.0
|
|
PROTO_FILE := api/proto/configcenter/v1/config.proto
|
|
PROTO_GO_FILES := pkg/proto/v1/config.pb.go pkg/proto/v1/config_grpc.pb.go
|
|
PROTO_PY_FILES := sdk/python/configcenter/v1/config_pb2.py sdk/python/configcenter/v1/config_pb2_grpc.py
|
|
PROTO_TOOLS_STAMP := .tools/.proto-tools-$(PROTOC_GEN_GO_VERSION)-$(PROTOC_GEN_GO_GRPC_VERSION)-$(GRPCIO_TOOLS_VERSION)
|
|
|
|
dev:
|
|
go run ./cmd/server
|
|
|
|
test:
|
|
GOCACHE=/tmp/configcenter-go-cache go test ./...
|
|
|
|
build:
|
|
mkdir -p bin
|
|
GOCACHE=/tmp/configcenter-go-cache go build -buildvcs=false -trimpath -o bin/configcenter ./cmd/server
|
|
|
|
proto-tools: $(PROTO_TOOLS_STAMP)
|
|
|
|
$(PROTO_TOOLS_STAMP):
|
|
rm -rf .tools/bin .tools/python
|
|
mkdir -p .tools/bin .tools/python
|
|
GOBIN=$(CURDIR)/.tools/bin go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
|
|
GOBIN=$(CURDIR)/.tools/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC_VERSION)
|
|
python3 -m pip install --disable-pip-version-check --target .tools/python grpcio-tools==$(GRPCIO_TOOLS_VERSION)
|
|
touch $(PROTO_TOOLS_STAMP)
|
|
|
|
proto-go: proto-tools
|
|
PATH="$(CURDIR)/.tools/bin:$$PATH" protoc -I api/proto \
|
|
--go_out=. --go_opt=module=github.com/longpeng/configcenter \
|
|
--go-grpc_out=. --go-grpc_opt=module=github.com/longpeng/configcenter \
|
|
$(PROTO_FILE)
|
|
|
|
proto-python: proto-tools
|
|
PYTHONPATH="$(CURDIR)/.tools/python" python3 -m grpc_tools.protoc -I api/proto \
|
|
--python_out=sdk/python --grpc_python_out=sdk/python $(PROTO_FILE)
|
|
touch sdk/python/configcenter/v1/__init__.py
|
|
|
|
proto: proto-go proto-python
|
|
|
|
proto-check: proto
|
|
git diff --exit-code -- $(PROTO_FILE) $(PROTO_GO_FILES) $(PROTO_PY_FILES) sdk/python/configcenter/v1/__init__.py
|
|
|
|
web-install:
|
|
npm --prefix web install
|
|
|
|
web-build:
|
|
npm --prefix web run build
|
|
|
|
compose-up:
|
|
docker compose up --build
|
|
|
|
compose-down:
|
|
docker compose down
|
|
|
|
integration-smoke:
|
|
sh scripts/integration-smoke.sh
|
|
|
|
loadtest:
|
|
GOCACHE=/tmp/configcenter-go-cache go run ./cmd/loadtest -duration=30s -concurrency=32
|