xref: /tonic/interop/update_binaries.sh (revision 48d52489)
1set -e
2
3# This script updates server and client go binaries for interop tests.
4# It clones grpc-go, compiles interop clients and servers for linux, windows
5# and macos and finally deletes the cloned repo.
6#
7# It is not meant to be executed on every test run or CI and should run from
8# inside tonic/interop.
9
10command -v go >/dev/null 2>&1 || {
11  echo >&2 "go executable is not available"
12  exit 1
13}
14
15if [ ! -d "./grpc-go" ]; then
16  git clone https://github.com/grpc/grpc-go.git
17fi
18
19cd grpc-go
20
21PLATFORMS="darwin linux windows"
22ROLES="client server"
23ARCH=amd64
24
25for ROLE in $ROLES; do
26  for OS in $PLATFORMS; do
27    FILENAME="${ROLE}_${OS}_${ARCH}"
28    if [[ "${OS}" == "windows" ]]; then FILENAME="${FILENAME}.exe"; fi
29    GOOS=$OS GOARCH=$ARCH go build -o "../bin/$FILENAME" "./interop/$ROLE"
30  done
31done
32
33rm -rf ../grpc-go