Skip to content

Commit

Permalink
multi: remove proto install script
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Jan 28, 2021
1 parent e9a0f36 commit 9c6e208
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 164 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
DOWNLOAD_CACHE: /home/runner/work/download_cache
BITCOIN_VERSION: 0.20.1

# If you change this value, please change it in the following files as well:
Expand Down Expand Up @@ -54,18 +53,6 @@ jobs:
with:
go-version: '~${{ env.GO_VERSION }}'

- name: download cache
uses: actions/cache@v1
with:
path: /home/runner/work/download_cache
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
restore-keys: |
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
lnd-${{ runner.os }}-download-
- name: install protoc and protobuf libraries
run: ./scripts/install_travis_proto.sh

- name: run check
run: make rpc-check

Expand Down Expand Up @@ -195,18 +182,6 @@ jobs:
with:
go-version: '~${{ env.GO_VERSION }}'

- name: download cache
uses: actions/cache@v1
with:
path: /home/runner/work/download_cache
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
restore-keys: |
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
lnd-${{ runner.os }}-download-
- name: install protoc and protobuf libraries
run: ./scripts/install_travis_proto.sh

- name: build mobile RPC bindings
run: make mobile-rpc

Expand Down Expand Up @@ -239,15 +214,6 @@ jobs:
with:
go-version: '~${{ env.GO_VERSION }}'

- name: download cache
uses: actions/cache@v1
with:
path: /home/runner/work/download_cache
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
restore-keys: |
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
lnd-${{ runner.os }}-download-
- name: check all command line flags exist in sample-lnd.conf file
run: make sample-conf-check

Expand Down
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: go
cache:
directories:
- $DOWNLOAD_CACHE
- $GOCACHE
- $GOPATH/pkg/mod
- $GOPATH/src/github.com/btcsuite
Expand All @@ -27,7 +26,6 @@ go:
env:
global:
- GOCACHE=$HOME/.go-build
- DOWNLOAD_CACHE=$HOME/download_cache
- BITCOIN_VERSION=0.20.1

sudo: required
Expand All @@ -36,11 +34,6 @@ jobs:
include:
- stage: Sanity Check
name: Lint and compile
before_script:
# Install the RPC tools as a before step so Travis collapses the output
# after it's done.
- ./scripts/install_travis_proto.sh

script:
# Step 1: Make sure no diff is produced when compiling with the correct
# version.
Expand Down
60 changes: 12 additions & 48 deletions lnrpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,58 +153,21 @@ description):

## Generate protobuf definitions

### Linux
To compile the `lnrpc/**/*.proto` files and generate the protobuf definitions,
you need to have [Docker](https://docs.docker.com/get-docker/) and `make`
installed.

For linux there is an easy install script that is also used for the Travis CI
build. Just run the following command (requires `sudo` permissions and the tools
`make`, `go`, `wget` and `unzip` to be installed) from the repository's root
folder:

```shell
⛰ ./scripts/install_travis_proto.sh
```

### MacOS / Unix like systems

1. Download [v.3.4.0](https://github.com/google/protobuf/releases/tag/v3.4.0) of
`protoc` for your operating system and add it to your `PATH`.
For example, if using macOS:
```shell
⛰ curl -LO https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip
⛰ unzip protoc-3.4.0-osx-x86_64.zip -d protoc
export PATH=$PWD/protoc/bin:$PATH
```

2. Install `golang/protobuf` at version `v1.3.2`.
```shell
⛰ git clone https://github.com/golang/protobuf $GOPATH/src/github.com/golang/protobuf
cd $GOPATH/src/github.com/golang/protobuf
⛰ git reset --hard v1.3.2
⛰ make
```

3. Install 'genproto' at commit `20e1ac93f88cf06d2b1defb90b9e9e126c7dfff6`.
```shell
⛰ go get google.golang.org/genproto
cd $GOPATH/src/google.golang.org/genproto
⛰ git reset --hard 20e1ac93f88cf06d2b1defb90b9e9e126c7dfff6
```

4. Install `grpc-ecosystem/grpc-gateway` at version `v1.14.3`.
```shell
⛰ git clone https://github.com/grpc-ecosystem/grpc-gateway $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
⛰ git reset --hard v1.14.3
⛰ go install ./protoc-gen-grpc-gateway ./protoc-gen-swagger
```

5. Run [`gen_protos.sh`](https://github.com/lightningnetwork/lnd/blob/master/lnrpc/gen_protos.sh)
or `make rpc` to generate new protobuf definitions.
Simply run `make rpc` to start the compilation process.

## Format .proto files

We use `clang-format` to make sure the `.proto` files are formatted correctly.
You can install the formatter on Ubuntu by running `apt install clang-format` or on Mac by running `brew install clang-format`.

When running the `make rpc` command, the `.proto` files are also formatted. To
format the files without also compiling them, you can install the `clang-format`
formatter on Ubuntu by running `apt install clang-format` or on Mac by running
`brew install clang-format`.
The `make format` command should then produce the correct result.

Consult [this page](http://releases.llvm.org/download.html) to find binaries
for other operating systems or distributions.
Expand All @@ -213,7 +176,8 @@ for other operating systems or distributions.

The following commands are available with `make`:

* `rpc`: Compile `.proto` files (calls `lnrpc/gen_protos.sh`).
* `rpc`: Compile and format all `.proto` files using Docker (calls
`lnrpc/gen_protos_docker.sh`).
* `rpc-format`: Formats all `.proto` files according to our formatting rules.
Requires `clang-format`, see previous chapter.
* `rpc-check`: Runs both previous commands and makes sure the git work tree is
Expand Down
75 changes: 0 additions & 75 deletions scripts/install_travis_proto.sh

This file was deleted.

0 comments on commit 9c6e208

Please sign in to comment.