Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: proto check that works #1063

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,27 @@ proto-gen:
@$(protoImage) sh ./scripts/protocgen.sh;

proto-check:
@if git diff --quiet; then \
echo "No files were modified before running 'make proto-gen'."; \
@if git diff --quiet --exit-code main...HEAD -- proto; then \
echo "Pass! No committed changes found in /proto directory between the currently checked out branch and main."; \
else \
echo "Error: Uncommitted changes exist before running 'make proto-gen'. Please commit or stash your changes."; \
exit 1; \
fi
@$(MAKE) proto-gen
@if git diff --quiet; then \
echo "No files were modified after running 'make proto-gen'. Pass!"; \
else \
echo "Error: Files were modified after running 'make proto-gen'. Please commit changes to .pb files"; \
exit 1; \
fi
echo "Committed changes found in /proto directory between the currently checked out branch and main."; \
modified_protos=$$(git diff --name-only main...HEAD proto); \
modified_pb_files= ; \
for proto_file in $${modified_protos}; do \
proto_name=$$(basename "$${proto_file}" .proto); \
pb_files=$$(find x/ccv -name "$${proto_name}.pb.go"); \
for pb_file in $${pb_files}; do \
if git diff --quiet --exit-code main...HEAD -- "$${pb_file}"; then \
echo "Missing committed changes in $${pb_file}"; \
exit 1; \
else \
modified_pb_files+="$${pb_file} "; \
fi \
done \
done; \
echo "Pass! Correctly modified pb files: "; \
echo $${modified_pb_files}; \
fi

proto-format:
@echo "Formatting Protobuf files"
Expand Down