From 5cbfa2778e0a4825a0841d1f2cc822af1afb96ff Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Thu, 30 Apr 2020 17:45:48 +0200 Subject: [PATCH] Use github action to install protoc --- .github/workflows/ci.yml | 3 +++ scripts/setup/install-go-gen | 6 ++++++ scripts/setup/install-protobuf | 11 +++-------- setup-dev.sh | 3 +-- 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100755 scripts/setup/install-go-gen diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f201feb..ca7b8eea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,9 @@ jobs: - name: Checkout code into the Go module directory uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@master + - name: Get dependencies run: ./setup-dev.sh diff --git a/scripts/setup/install-go-gen b/scripts/setup/install-go-gen new file mode 100755 index 00000000..b61d1785 --- /dev/null +++ b/scripts/setup/install-go-gen @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +go get -u github.com/gogo/protobuf/proto +go get -u github.com/gogo/protobuf/jsonpb +go get -u github.com/golang/protobuf/protoc-gen-go +go get -u github.com/stevvooe/protobuild diff --git a/scripts/setup/install-protobuf b/scripts/setup/install-protobuf index fc4a1305..0ee612e1 100755 --- a/scripts/setup/install-protobuf +++ b/scripts/setup/install-protobuf @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - # # Downloads and installs protobuf # @@ -32,13 +31,13 @@ arm64) unzip $PROTOBUF_DIR/protobuf -d /usr/local ;; -amd64|386) +amd64 | 386) if [ "$GOOS" = windows ]; then wget -O $PROTOBUF_DIR/protobuf "https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-win32.zip" elif [ "$GOOS" = linux ]; then wget -O $PROTOBUF_DIR/protobuf "https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip" - elif [ "$GOOS" = darwin ]; then - curl -Lo $PROTOBUF_DIR/protobuf "https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-osx-x86_64.zip" + elif [ "$GOOS" = darwin ]; then + curl -Lo $PROTOBUF_DIR/protobuf "https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-osx-x86_64.zip" fi unzip $PROTOBUF_DIR/protobuf -x readme.txt -d /usr/local ;; @@ -60,7 +59,3 @@ ppc64le) ;; esac rm -rf $PROTOBUF_DIR - -go get github.com/gogo/protobuf/proto -go get github.com/gogo/protobuf/jsonpb -go get -u github.com/golang/protobuf/protoc-gen-go diff --git a/setup-dev.sh b/setup-dev.sh index cb0e8a1b..64450555 100755 --- a/setup-dev.sh +++ b/setup-dev.sh @@ -26,5 +26,4 @@ # THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ./scripts/setup/install-protobuf - -go get github.com/stevvooe/protobuild +./scripts/setup/install-go-gen