mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
d5dcfe73b2
* start makefile refactor to smaller units; break out proto-dep updating; add check-proto-deps target for use in CI in order to determine if depdencies have diverged * add proto check workflow * download go modules before checking proto deps * clean up -- hide output and add error message for check target * add error message for check-rsync * update any type, and ibc-go protos for v3.4.0 * add buf generate files for gogo, docs, and swagger * update swagger dirs and run with latest swagger gen * ignore new build directories * refactor proto makefile logic -- use buf instead of scripts * remove old protobuf scripts * run all proto checks on push * remove moved file * set default value for protoc machine * install build deps seperately * fetch master for buf check breaking * checkout from https url in CI for buf breaking * fix rsync file permissions on darwin * ignore build dirs * fix issue with apple provided make; clean up build deps; switch to buf format * remove clang format file -- using buf format now * run make proto-format (buf format changes) * update generated files for proto format changes
61 lines
2.4 KiB
Makefile
61 lines
2.4 KiB
Makefile
.PHONY: proto-lint check-proto-lint
|
|
proto-lint check-proto-lint: install-build-deps
|
|
@echo "Linting proto file"
|
|
@$(BUF) lint
|
|
|
|
.PHONY: proto-gen
|
|
proto-gen: install-build-deps
|
|
@echo "Generating go proto files"
|
|
@$(BUF) generate --template proto/buf.gen.gogo.yaml proto
|
|
@cp -r out/github.com/kava-labs/kava/* ./
|
|
@rm -rf out/github.com
|
|
|
|
.PHONY: check-proto-gen
|
|
check-proto-gen: proto-gen ## Return error code 1 if proto gen changes files
|
|
@git diff --exit-code **/*.pb.go > /dev/null || (echo "Protobuf generated go files are not up to date! Please run \`make proto-gen\`."; exit 1)
|
|
|
|
.PHONY: proto-gen-doc
|
|
proto-gen-doc: install-build-deps
|
|
@echo "Generating proto doc"
|
|
@$(BUF) generate --template proto/buf.gen.doc.yaml proto
|
|
|
|
.PHONY: check-proto-gen-doc
|
|
check-proto-gen-doc: proto-gen-doc ## Return error code 1 if proto gen changes files
|
|
@git diff --exit-code docs/core/proto-docs.md > /dev/null || (echo "Protobuf doc is not up to date! Please run \`make proto-gen-doc\`."; exit 1)
|
|
|
|
.PHONY: proto-gen-swagger
|
|
proto-gen-swagger: install-build-deps
|
|
@echo "Generating proto swagger"
|
|
@$(BUF) generate --template proto/buf.gen.swagger.yaml proto
|
|
@$(SWAGGER_COMBINE) client/docs/config.json -o client/docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true
|
|
@rm -rf out/swagger
|
|
|
|
.PHONY: check-proto-gen-swagger
|
|
check-proto-gen-swagger: proto-gen-swagger ## Return error code 1 if proto gen changes files
|
|
@git diff --exit-code client/docs/swagger-ui/swagger.yaml > /dev/null || (echo "Protobuf swagger is not up to date! Please run \`make proto-gen-swagger\`."; exit 1)
|
|
|
|
.PHONY: proto-format
|
|
@echo "Formatting proto files"
|
|
proto-format: install-build-deps
|
|
@$(BUF) format -w proto
|
|
|
|
.PHONY: check-proto-format
|
|
check-proto-format: proto-format
|
|
@git diff --exit-code proto/**/*.proto > /dev/null || (echo "Protobuf format is not up to date! Please run \`make proto-format\`."; exit 1)
|
|
|
|
.PHONY: check-proto-breaking
|
|
check-proto-breaking: install-build-deps
|
|
@echo "Checking for proto backward compatibility"
|
|
@$(BUF) breaking --against '.git#branch=master'
|
|
|
|
.PHONY: check-proto-breaking-remote
|
|
check-proto-breaking-remote: install-build-deps
|
|
@echo "Checking for proto backward compatibility"
|
|
@$(BUF) breaking --against '$(HTTPS_GIT)#branch=master'
|
|
|
|
.PHONY: proto-gen-all
|
|
proto-gen-all: proto-gen proto-gen-doc proto-gen-swagger
|
|
|
|
.PHONY: proto-all
|
|
proto-all: proto-update-deps proto-lint proto-format check-proto-breaking proto-gen-all
|