diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index e681f887700..25fbc62e268 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -258,6 +258,8 @@ jobs: uses: ./.github/actions/setup-go with: only-modules: "true" + - name: Install protoc-gen-go-wsrpc + run: curl https://github.com/smartcontractkit/wsrpc/raw/main/cmd/protoc-gen-go-wsrpc/protoc-gen-go-wsrpc --output $HOME/go/bin/protoc-gen-go-wsrpc && chmod +x $HOME/go/bin/protoc-gen-go-wsrpc - name: Setup NodeJS uses: ./.github/actions/setup-nodejs - run: make generate # generate install go deps diff --git a/.tool-versions b/.tool-versions index 2a2362dcfa0..e52a1f25a81 100644 --- a/.tool-versions +++ b/.tool-versions @@ -5,4 +5,4 @@ postgres 13.3 helm 3.10.3 zig 0.10.1 golangci-lint 1.55.2 -protoc 23.2 +protoc 25.1 diff --git a/GNUmakefile b/GNUmakefile index 1a5fe5f24aa..5d804a75a5c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -88,7 +88,7 @@ abigen: ## Build & install abigen. ./tools/bin/build_abigen .PHONY: generate -generate: abigen codecgen mockery ## Execute all go:generate commands. +generate: abigen codecgen mockery protoc ## Execute all go:generate commands. go generate -x ./... .PHONY: testscripts @@ -124,6 +124,11 @@ mockery: $(mockery) ## Install mockery. codecgen: $(codecgen) ## Install codecgen go install github.com/ugorji/go/codec/codecgen@v1.2.10 +.PHONY: protoc +protoc: ## Install protoc + core/scripts/install-protoc.sh 25.1 / + go install google.golang.org/protobuf/cmd/protoc-gen-go@`go list -m -json google.golang.org/protobuf | jq -r .Version` + .PHONY: telemetry-protobuf telemetry-protobuf: $(telemetry-protobuf) ## Generate telemetry protocol buffers. protoc \ diff --git a/core/scripts/install-protoc.sh b/core/scripts/install-protoc.sh new file mode 100755 index 00000000000..8d9dc4085c6 --- /dev/null +++ b/core/scripts/install-protoc.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -x + + +VERSION=$1 + +if [ "$VERSION" == "" ]; then + echo "version required" + exit 1 +fi + +os=$(uname) +arch=$(uname -m) + +install_dir=$HOME/.local +$install_dir/bin/protoc --version | grep $VERSION +rc=$? +if [ $rc -eq 0 ]; then + # we have the current VERSION + echo "protoc up-to-date @ $VERSION" + exit 0 +fi + + +if [ "$os" == "Linux" ] ; then + os="linux" + if [$arch != "x86_64"]; then + echo "unsupported os $os-$arch update $0" + exit 1 + fi +elif [ "$os" == "Darwin" ] ; then + os="osx" + # make life simply and download the universal binary + arch="universal_binary" +else + echo "unsupported os $os. update $0" + exit 1 +fi + +workdir=$(mktemp -d) +pushd $workdir +pb_url="https://github.com/protocolbuffers/protobuf/releases" +artifact=protoc-$VERSION-$os-$arch.zip +curl -LO $pb_url/download/v${VERSION}/$artifact +if [[ ! -d $install_dir ]]; then + mkdir $install_dir +fi +unzip -uo $artifact -d $install_dir +rm $artifact + +echo "protoc $VERSION installed in $install_dir" +echo "Add $install_dir/bin to PATH" +export PATH=$install_dir/bin:$PATH +popd diff --git a/core/services/relay/evm/mercury/wsrpc/pb/generate.go b/core/services/relay/evm/mercury/wsrpc/pb/generate.go new file mode 100644 index 00000000000..2bb95012d1c --- /dev/null +++ b/core/services/relay/evm/mercury/wsrpc/pb/generate.go @@ -0,0 +1,2 @@ +//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-wsrpc_out=. --go-wsrpc_opt=paths=source_relative mercury.proto +package pb diff --git a/core/services/relay/evm/mercury/wsrpc/pb/mercury.pb.go b/core/services/relay/evm/mercury/wsrpc/pb/mercury.pb.go index 2f421931a18..ce4125bd579 100644 --- a/core/services/relay/evm/mercury/wsrpc/pb/mercury.pb.go +++ b/core/services/relay/evm/mercury/wsrpc/pb/mercury.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v4.23.2 +// protoc v4.25.1 // source: mercury.proto package pb diff --git a/core/services/relay/evm/mercury/wsrpc/pb/mercury_wsrpc.pb.go b/core/services/relay/evm/mercury/wsrpc/pb/mercury_wsrpc.pb.go index 23c78abf533..0c31a1d7ac9 100644 --- a/core/services/relay/evm/mercury/wsrpc/pb/mercury_wsrpc.pb.go +++ b/core/services/relay/evm/mercury/wsrpc/pb/mercury_wsrpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-wsrpc. DO NOT EDIT. // versions: // - protoc-gen-go-wsrpc v0.0.1 -// - protoc v4.23.2 +// - protoc v4.25.1 package pb