Skip to content

Commit

Permalink
chore: introduce protobuf gen parity CI check (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci authored May 16, 2024
1 parent 4b374d9 commit 5266b68
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Setup Cache
Expand All @@ -74,19 +75,21 @@ jobs:
check-latest: true
cache-dependency-path: go.work.sum

- name: Workspace Modules
- name: Determine Workspace Modules
run: |
echo $(go list -f '{{.Dir}}' -m)
echo "GO_LINT_DIRS=$(go list -f '{{.Dir}}/...' -m | grep -v '/external/geth' | tr '\n' ' ')" >> $GITHUB_ENV
- name: Run Gofmt
run: go list -f '{{.Dir}}' -m | xargs gofmt -d -e -l

- name: Run Tidy
run: go list -f '{{.Dir}}' -m | xargs -L1 go mod tidy -C

- name: Run Sync
run: go work sync
- name: Run Tidy & Workspace Sync
run: |
go list -f '{{.Dir}}' -m | xargs -L1 go mod tidy -C
go work sync
git checkout ${{ github.event.pull_request.head.ref }}
git diff --name-only --exit-code . || (echo "Golang modules/workspace not in sync with go.mod/go.sum/go.work files" && exit 1)
git reset --hard HEAD
- name: Run Lint
uses: golangci/golangci-lint-action@v4
Expand All @@ -102,6 +105,20 @@ jobs:
- name: Run Test
run: go list -f '{{.Dir}}/...' -m | grep -v '/external/geth' | xargs go test -short -race

- name: Setup Protobuf
uses: bufbuild/[email protected]

- name: Protobuf version
run: buf --version

- name: Check Protobuf Parity
run: |
make bufgen
git checkout ${{ github.event.pull_request.head.ref }}
git diff --name-only --exit-code . || (echo "Generated files not in parity with the source files." && exit 1)
git reset --hard HEAD
working-directory: p2p

foundry:
name: Foundry Checks and Reports
runs-on: ubuntu-latest
Expand Down Expand Up @@ -188,5 +205,6 @@ jobs:
run: |
bash script.sh
git checkout ${{ github.event.pull_request.head.ref }}
git diff --name-only --exit-code .
git diff --name-only --exit-code . || (echo "Generated files not in parity with the source files." && exit 1)
git reset --hard HEAD
working-directory: contracts-abi
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
go 1.22

use (
./infrastructure/tools/keystore-generator
./bridge/standard/bridge-v1
./contracts-abi
./external/geth
./infrastructure/tools/keystore-generator
./oracle
./p2p
./x
Expand Down
1 change: 0 additions & 1 deletion infrastructure/tools/keystore-generator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.21.2

require (
github.com/ethereum/go-ethereum v1.13.11
github.com/urfave/cli v1.22.14
github.com/urfave/cli/v2 v2.27.1
)

Expand Down
9 changes: 0 additions & 9 deletions infrastructure/tools/keystore-generator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUp
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs=
github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA=
github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
Expand Down Expand Up @@ -111,11 +110,6 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
Expand All @@ -126,8 +120,6 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
Expand All @@ -148,7 +140,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
Expand Down
2 changes: 1 addition & 1 deletion p2p/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.22
require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20240221180331-f05a6f4403ce.1
github.com/Masterminds/semver/v3 v3.2.1
github.com/armon/go-radix v1.0.0
github.com/bufbuild/protovalidate-go v0.6.0
github.com/ethereum/go-ethereum v1.13.14
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
Expand Down Expand Up @@ -33,7 +34,6 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
Expand Down

0 comments on commit 5266b68

Please sign in to comment.