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

Fix: API build with buf #85

Merged
merged 3 commits into from
Jun 26, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ $(gen_sum): $(gen_src)
--workdir="/go/src/berty.tech/weshnet" \
--entrypoint="sh" \
--rm \
bertytech/buf:1 \
bertytech/buf:2 \
-xec 'make generate_local'; \
$(MAKE) tidy \
)
Expand Down
2 changes: 1 addition & 1 deletion account_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"os"
"testing"

mocknet "github.com/berty/go-libp2p-mock"
"github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

orbitdb "berty.tech/go-orbit-db"
Expand Down
2 changes: 1 addition & 1 deletion deactivate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

libp2p_mocknet "github.com/berty/go-libp2p-mock"
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

"berty.tech/weshnet"
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(gen_sum): $(gen_src)
--workdir="/go/src/berty.tech/berty/docs" \
--entrypoint="sh" \
--rm \
bertytech/buf:1 \
bertytech/buf:2 \
-xec 'make generate_local' \
)
.PHONY: generate
Expand Down
2 changes: 1 addition & 1 deletion docs/gen.sum

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

2 changes: 1 addition & 1 deletion gen.sum

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

2 changes: 1 addition & 1 deletion internal/handshake/handshake_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"testing"
"time"

p2pmocknet "github.com/berty/go-libp2p-mock"
ggio "github.com/gogo/protobuf/io"
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
p2pnetwork "github.com/libp2p/go-libp2p/core/network"
p2ppeer "github.com/libp2p/go-libp2p/core/peer"
p2pmocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"

"berty.tech/weshnet/pkg/ipfsutil"
Expand Down
2 changes: 1 addition & 1 deletion orbitdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"testing"
"time"

mocknet "github.com/berty/go-libp2p-mock"
datastore "github.com/ipfs/go-datastore"
sync_ds "github.com/ipfs/go-datastore/sync"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
201 changes: 125 additions & 76 deletions pkg/protocoltypes/protocoltypes_grpc.pb.go

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions pkg/pushtypes/pushtypes_grpc.pb.go

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

2 changes: 1 addition & 1 deletion pkg/rendezvous/emitterio_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"testing"
"time"

mocknet "github.com/berty/go-libp2p-mock"
rendezvous "github.com/berty/go-libp2p-rendezvous"
db "github.com/berty/go-libp2p-rendezvous/db/sqlcipher"
"github.com/berty/go-libp2p-rendezvous/test_utils"
"github.com/libp2p/go-libp2p/core/host"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

Expand Down
22 changes: 16 additions & 6 deletions pkg/replicationtypes/bertyreplication_grpc.pb.go

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

2 changes: 1 addition & 1 deletion pkg/tinder/driver_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/driver_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"testing"
"time"

mocknet "github.com/berty/go-libp2p-mock"
rendezvous "github.com/berty/go-libp2p-rendezvous"
dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/service_mocked_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"testing"
"time"

mocknet "github.com/berty/go-libp2p-mock"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
2 changes: 1 addition & 1 deletion pkg/tinder/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"testing"
"time"

mocknet "github.com/berty/go-libp2p-mock"
rendezvous "github.com/berty/go-libp2p-rendezvous"
dbrdvp "github.com/berty/go-libp2p-rendezvous/db/sqlite"
p2putil "github.com/libp2p/go-libp2p-testing/netutil"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
mocknet "github.com/berty/go-libp2p-mock"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"testing"
"time"

libp2p_mocknet "github.com/berty/go-libp2p-mock"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
datastore "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
libp2p_mocknet "github.com/berty/go-libp2p-mock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down
18 changes: 13 additions & 5 deletions tool/docker-protoc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
FROM moul/protoc-gen-gotemplate:latest as pgg

# build image
FROM golang:1.18-alpine as builder
FROM golang:1.19-alpine as builder
# install deps
RUN apk --no-cache add make git go rsync libc-dev openssh docker npm
RUN apk --no-cache add make git go rsync libc-dev openssh docker npm bash curl
# ensure we use bash for all RUN commands
SHELL ["/bin/bash", "-c"]
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0 && \
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
# install compilers
WORKDIR $GOPATH/src/berty.tech/weshnet
COPY go.mod go.sum ./
COPY go.mod go.sum .tool-versions ./
# ensure modifications to bashrc are properly sourced
ENV BASH_ENV=~/.bashrc
# @TODO(gfanton): use asdf version
RUN go install -mod=readonly \
github.com/bufbuild/buf/cmd/buf \ # @TODO(gfanton): use asdf version
google.golang.org/protobuf/cmd/protoc-gen-go \
github.com/gogo/protobuf/protoc-gen-gogo \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc \
golang.org/x/tools/cmd/goimports
RUN asdf plugin add buf && asdf install buf && \
cp $(asdf which buf) /go/bin/buf

# runtime
FROM golang:1.18-alpine
FROM golang:1.19-alpine
RUN apk --no-cache add git openssh make protobuf gcc libc-dev nodejs npm yarn sudo perl-utils tar sed grep \
&& mkdir -p /.cache/go-build \
&& chmod -R 777 /.cache \
Expand Down
2 changes: 1 addition & 1 deletion tool/docker-protoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IMAGE ?= bertytech/buf
VERSION ?= 1
VERSION ?= 2

build:
cd ../../ && docker build -f ./tool/docker-protoc/Dockerfile -t $(IMAGE):$(VERSION) -t $(IMAGE):latest .
Expand Down
Loading