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

Feature: generating protoflles with docker. #4427

Merged
merged 8 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ install:
- git clone https://github.com/harmony-one/harmony-test.git $GOPATH/src/github.com/harmony-one/harmony-test
- (cd $GOPATH/src/github.com/harmony-one/mcl; make -j4)
- (cd $GOPATH/src/github.com/harmony-one/bls; make BLS_SWAP_G=1 -j4)
- go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
- go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
# - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.1
- make go-get
- go install golang.org/x/tools/cmd/goimports@latest
- go install github.com/harmony-ek/gencodec@latest
- scripts/install_build_tools.sh
script:
- ${TEST}
after_success:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ go-test:

docker:
docker build --pull -t harmonyone/$(PKGNAME):latest -f scripts/docker/Dockerfile .

travis_go_checker:
bash ./scripts/travis_go_checker.sh
4 changes: 3 additions & 1 deletion api/proto/message/gen.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
protoc -I ./ message.proto --go_out=. --go-grpc_out=.
#!/bin/bash

docker run --platform linux/amd64 -v ${PWD}:/tmp ${PROTOC_IMAGE} /tmp/message.proto
2 changes: 1 addition & 1 deletion api/proto/message/message.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package message

//go:generate protoc message.proto --go_out=. --go-grpc_out=.
//go:generate ./gen.sh
82 changes: 41 additions & 41 deletions api/proto/message/message.pb.go

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

12 changes: 10 additions & 2 deletions api/proto/message/message_grpc.pb.go

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

9 changes: 9 additions & 0 deletions api/service/legacysync/downloader/Proto.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.19-bullseye

RUN apt update
RUN apt install -y protobuf-compiler
RUN protoc --version
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3

ENTRYPOINT ["protoc", "-I=/tmp", "--go_out=/tmp", "--go-grpc_out=/tmp"]
4 changes: 4 additions & 0 deletions api/service/legacysync/downloader/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# if command fails, try this
# docker buildx create --use
docker buildx build -t frozen621/harmony-proto:latest --platform linux/amd64,linux/arm64 -f Proto.Dockerfile --progress=plain .
5 changes: 0 additions & 5 deletions api/service/legacysync/downloader/gen.sh

This file was deleted.

3 changes: 2 additions & 1 deletion api/service/legacysync/downloader/proto/downloader.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package downloader

///go:generate protoc downloader.proto --go_out=plugins=grpc:.
//go:generate protoc downloader.proto --go_out=. --go-grpc_out=.
///go:generate protoc downloader.proto --go_out=. --go-grpc_out=.
//go:generate ./gen.sh
4 changes: 2 additions & 2 deletions api/service/legacysync/downloader/proto/downloader.pb.go

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

Loading