mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
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:
parent
f6b16e49a3
commit
35d5d6b462
3 changed files with 92 additions and 0 deletions
55
.github/workflows/main.yml
vendored
55
.github/workflows/main.yml
vendored
|
|
@ -8,6 +8,10 @@ on:
|
|||
branches:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
# go needs absolute directories, using the $HOME variable doesn't work here.
|
||||
DOWNLOAD_CACHE: /home/runner/work/download_cache
|
||||
|
||||
jobs:
|
||||
frontend:
|
||||
name: frontend tests on ${{ matrix.os }}
|
||||
|
|
@ -118,3 +122,54 @@ jobs:
|
|||
|
||||
- name: build backend binary
|
||||
run: make build
|
||||
|
||||
proto-compile-check:
|
||||
name: RPC proto compilation check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: set git config
|
||||
run: |
|
||||
git config --global core.eol lf
|
||||
git config --global core.autocrlf false
|
||||
|
||||
- name: git checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: setup nodejs v${{ matrix.node_version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
|
||||
- name: download cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: /home/runner/work/download_cache
|
||||
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
|
||||
restore-keys: |
|
||||
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
|
||||
lnd-${{ runner.os }}-download-
|
||||
|
||||
- name: install protoc and protobuf libraries
|
||||
run: ./scripts/install_protoc.sh
|
||||
|
||||
- name: get yarn cache dir
|
||||
id: yarn-cache-dir
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- name: yarn cache
|
||||
uses: actions/cache@v2
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
|
||||
${{ runner.os }}-yarn-${{ matrix.node_version }}-
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: install dependencies
|
||||
working-directory: ./app
|
||||
run: yarn
|
||||
|
||||
- name: run check
|
||||
run: make protos-check
|
||||
|
|
|
|||
8
Makefile
8
Makefile
|
|
@ -192,6 +192,14 @@ list:
|
|||
grep -v Makefile | \
|
||||
sort
|
||||
|
||||
protos:
|
||||
@$(call print, "Compiling protos.")
|
||||
cd ./app; yarn protos
|
||||
|
||||
protos-check: protos
|
||||
@$(call print, "Verifying compiled protos.")
|
||||
if test -n "$$(git describe --dirty | grep dirty)"; then echo "Protos not properly formatted or not compiled with v3.4.0"; git status; git diff; exit 1; fi
|
||||
|
||||
clean:
|
||||
@$(call print, "Cleaning source.$(NC)")
|
||||
$(RM) ./lightning-terminal-debug
|
||||
|
|
|
|||
29
scripts/install_protoc.sh
Executable file
29
scripts/install_protoc.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue