Skip to content

Commit

Permalink
install protoc
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Sep 22, 2024
1 parent 4fe9a65 commit 847197e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ jobs:
go-version: 1.19
- name: Fetch dependencies
run: go mod download -x
- name: Setup protoc
env:
PROTOBUF_VERSION: ${{ matrix.protobuf_version }}
run: ./install-protoc.sh
- name: Install tools
run: go install -x github.com/goccmack/gocc github.com/awalterschulze/goderive github.com/gogo/protobuf
run: go install -x github.com/goccmack/gocc github.com/awalterschulze/goderive github.com/gogo/protobuf/protoc-gen-gogo
- name: Generate
run: make regenerate
- name: Build
Expand Down
28 changes: 28 additions & 0 deletions install_protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -ex

die() {
echo "$@" >&2
exit 1
}

cd ${HOME}

case "$PROTOBUF_VERSION" in
2*)
basename=protobuf-$PROTOBUF_VERSION
wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz
tar xzf $basename.tar.gz
cd protobuf-$PROTOBUF_VERSION
./configure --prefix=${HOME} && make -j2 && make install
;;
3*)
basename=protoc-$PROTOBUF_VERSION-linux-x86_64
wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.zip
unzip $basename.zip
;;
*)
die "unknown protobuf version: $PROTOBUF_VERSION"
;;
esac

0 comments on commit 847197e

Please sign in to comment.