Skip to content

Commit

Permalink
Replace prototool with buf
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Feb 3, 2021
1 parent 855ff2f commit c74f699
Show file tree
Hide file tree
Showing 12 changed files with 797 additions and 367 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ executors:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD
environment:
PROTOTOOL_VER: 1.10.0
BUF_VER: 0.36.0
PROTOC_VER: 3.14.0
working_directory: /go/src/github.com/improbable-eng/grpc-web

jobs:
Expand All @@ -23,7 +24,8 @@ jobs:
steps:
- checkout
- run: sudo apt-get install unzip
- run: . ./install-prototool.sh
- run: . ./install-buf.sh
- run: . ./install-protoc.sh
- run: echo 'export GOBIN=/go/bin' >> $BASH_ENV
- run: go get -u golang.org/x/tools/cmd/goimports
- run: go get -u github.com/robertkrimen/godocdown/godocdown
Expand Down Expand Up @@ -114,4 +116,4 @@ workflows:
- BROWSER=ie11_win DISABLE_WEBSOCKET_TESTS=true
- BROWSER=nodejs
requires:
- initial-unit-test-lint-prebuild
- initial-unit-test-lint-prebuild
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export GOPATH=$(pwd)
# Checkout project sources into your new go workspace
go get -u github.com/improbable-eng/grpc-web/go
cd $GOPATH/src/github.com/improbable-eng/grpc-web
cd $GOPATH/src/github.com/improbable-eng/grpc-web
# Install go dependencies
dep ensure
Expand All @@ -23,9 +23,9 @@ nvm use
npm install
```

Note you will also need to [install prototool](https://github.com/uber/prototool/blob/dev/docs/install.md) and add it to your `PATH` environment variable if you wish to re-generate the integration test proto files.
Note you will also need to [install buf](https://github.com/bufbuild/buf) and add it to your `PATH` environment variable if you wish to re-generate the integration test proto files.

## Testing Prerequisites
## Testing Prerequisites
Before you run the tests for the first time, please follow these steps:

### Installing the Local Certificate
Expand All @@ -38,7 +38,7 @@ In order to run the Karma (Integration) tests, you will need to add the certific
4. Select `misc/localhost.crt`
5. Double click on the new `GRPC Web example dev server` certificate
6. Expand the `Trust' section
7. Change the `When using this certificate` option to `Always Trust`
7. Change the `When using this certificate` option to `Always Trust`
8. Close the certificate details pop-up.

Repeat the above process for `misc/localhostCA.pem`.
Expand Down Expand Up @@ -75,4 +75,4 @@ This is your prompt to open a web browser on https://localhost:9876 at which poi
2. Update `CHANGELOG.md` by comparing commits to master since the last Github Release
3. Raise a pull request for your changes, have it reviewed and landed into master.
4. Switch your local checkout back to the master branch, pull your merged changes and run `./publish-release.sh`.
5. Create the ARM binaries and attach them to the Github release.
5. Create the ARM binaries and attach them to the Github release.
25 changes: 25 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: v1beta1
build:
roots:
- integration_test/proto
lint:
use:
- DEFAULT
ignore_only:
ENUM_VALUE_PREFIX:
- improbable/grpcweb/test/test.proto
ENUM_ZERO_VALUE_SUFFIX:
- improbable/grpcweb/test/test.proto
FIELD_LOWER_SNAKE_CASE:
- improbable/grpcweb/test/test.proto
PACKAGE_VERSION_SUFFIX:
- improbable/grpcweb/test/test.proto
RPC_REQUEST_RESPONSE_UNIQUE:
- improbable/grpcweb/test/test.proto
RPC_REQUEST_STANDARD_NAME:
- improbable/grpcweb/test/test.proto
RPC_RESPONSE_STANDARD_NAME:
- improbable/grpcweb/test/test.proto
breaking:
use:
- FILE
17 changes: 17 additions & 0 deletions install-buf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Installs buf; used for generating and linting protofiles.
# This script is intended to be run by CI

set -ex

if [[ -z "$BUF_VER" ]]; then
echo "BUF_VER environment variable not set"
exit 1
fi

curl -sSL \
https://github.com/bufbuild/buf/releases/download/v${BUF_VER}/buf-$(uname -s)-$(uname -m) \
-o ./buf && \
chmod +x ./buf

echo 'export PATH=$PATH:$PWD' >> $BASH_ENV
21 changes: 21 additions & 0 deletions install-protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Installs protoc; used for generating JS protobuf stubs.
# This script is intended to be run by CI

set -ex

if [[ -z "$PROTOC_VER" ]]; then
echo "PROTOC_VER environment variable not set"
exit 1
fi

curl -sSL \
https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-$(uname -m).zip \
-o protoc.zip
rm -rf protoc
mkdir -p protoc
unzip protoc.zip -d protoc
rm protoc.zip
chmod +x ./protoc/bin/protoc

echo 'export PATH=$PATH:$PWD/protoc/bin' >> $BASH_ENV
17 changes: 0 additions & 17 deletions install-prototool.sh

This file was deleted.

Loading

0 comments on commit c74f699

Please sign in to comment.