Skip to content

Commit

Permalink
fix: re-enable make proto-check and update proto options (#1060)
Browse files Browse the repository at this point in the history
* fix: update proto build tooling

* fix: re-enable make proto-check in CI

* chore: proto check that works (#1063)

* wip

* works

* comments

---------

Co-authored-by: Shawn <[email protected]>
  • Loading branch information
MSalopek and shaspitz committed Jun 22, 2023
1 parent ed04399 commit acc494f
Show file tree
Hide file tree
Showing 19 changed files with 280 additions and 272 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: "1.20" # The Go version to download (if necessary) and use.
# - name: Proto Check
# run: make proto-check
- name: Proto Check
run: make proto-check
- name: Unit, integration and difference tests
run: go test ./...
- name: E2E tests
Expand Down
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
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/consumer/v1/consumer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package interchain_security.ccv.consumer.v1;

import "interchain_security/ccv/v1/ccv.proto";

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/consumer/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types";

import "google/protobuf/any.proto";
import "gogoproto/gogo.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/consumer/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package interchain_security.ccv.consumer.v1;

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/consumer/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types";

import "interchain_security/ccv/v1/ccv.proto";
import "interchain_security/ccv/consumer/v1/consumer.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/consumer/v1/query.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";

package interchain_security.ccv.consumer.v1;
option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/consumer/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/provider/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package interchain_security.ccv.provider.v1;

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/provider/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/provider/types";

import "gogoproto/gogo.proto";
import "interchain_security/ccv/v1/ccv.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/provider/v1/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package interchain_security.ccv.provider.v1;

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/provider/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/provider/types";

import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/provider/v1/query.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package interchain_security.ccv.provider.v1;

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/provider/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/provider/types";

import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package interchain_security.ccv.provider.v1;

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/provider/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/provider/types";

import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
Expand Down
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/v1/ccv.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package interchain_security.ccv.v1;

option go_package = "github.com/cosmos/interchain-security/v2/x/ccv/types";
option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/types";

import "cosmos/staking/v1beta1/staking.proto";

Expand Down
2 changes: 1 addition & 1 deletion scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ done
cd ..

# move proto files to the right places
cp -r github.com/cosmos/interchain-security/v2/* ./
cp -r github.com/cosmos/interchain-security/v3/* ./
rm -rf github.com

70 changes: 35 additions & 35 deletions x/ccv/consumer/types/consumer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit acc494f

Please sign in to comment.