multi: check compiled protos in GH actions

To make sure the compiled protos in the git repository are always up to
date, we add a GitHub action that checks them by compiling and diffing
the files.
This commit is contained in:
Oliver Gugger 2020-12-09 17:47:14 +01:00
parent f6b16e49a3
commit 35d5d6b462
No known key found for this signature in database
GPG key ID: 8E4256593F177720
3 changed files with 92 additions and 0 deletions

29
scripts/install_protoc.sh Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Abort on error (-e) and print commands (-v).
set -ev
# See README.md in lnrpc (of the lnd repository) why we need these specific
# versions/commits.
PROTOC_VERSION=3.4.0
# This script is specific to GitHub Actions so we only need to support linux x64.
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip"
PROTOC_DL_CACHE_DIR="${DOWNLOAD_CACHE:-/tmp/download_cache}/protoc"
# install_protoc copies the cached protoc binary to the $PATH or downloads it
# if no cached version is found.
install_protoc() {
if [ -f "${PROTOC_DL_CACHE_DIR}/bin/protoc" ]; then
echo "Using cached version of protoc"
else
wget -O /tmp/protoc.zip $PROTOC_URL
mkdir -p "${PROTOC_DL_CACHE_DIR}"
unzip -o /tmp/protoc.zip -d "${PROTOC_DL_CACHE_DIR}"
chmod -R a+rx "${PROTOC_DL_CACHE_DIR}/"
fi
sudo cp "${PROTOC_DL_CACHE_DIR}/bin/protoc" /usr/local/bin
sudo cp -r "${PROTOC_DL_CACHE_DIR}/include" /usr/local
}
install_protoc