From ab4f1c3b5a10dddc52c9887cc620cb633a69ecdc Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 8 Oct 2020 09:10:59 +0200 Subject: [PATCH] github+make: check all CLI flags are in sample-lnd.conf We add a GitHub action to our workflow that makes sure all command line flags of lnd that are available with the default build tags are contained in the sample-lnd.conf file. --- .github/workflows/main.yml | 38 ++++++++++++++++++++++++++++++++++++++ Makefile | 4 ++++ 2 files changed, 42 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a6f7d70..3ee4fa2b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -202,6 +202,44 @@ jobs: - name: build mobile specific code run: go build --tags="mobile" ./mobile + ######################## + # sample configuration check + ######################## + sample-conf-check: + name: sample configuration check + runs-on: ubuntu-latest + steps: + - name: git checkout + uses: actions/checkout@v2 + + - name: go cache + uses: actions/cache@v1 + with: + path: /home/runner/work/go + key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }} + lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}- + lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}- + lnd-${{ runner.os }}-go- + + - name: setup go ${{ env.GO_VERSION }} + uses: actions/setup-go@v2 + with: + go-version: '~${{ env.GO_VERSION }}' + + - name: download cache + uses: actions/cache@v1 + with: + path: /home/runner/work/download_cache + key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }} + restore-keys: | + lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }} + lnd-${{ runner.os }}-download- + + - name: check all command line flags exist in sample-lnd.conf file + run: make sample-conf-check + ######################## # run unit tests ######################## diff --git a/Makefile b/Makefile index 46c560ac..f28bef3d 100644 --- a/Makefile +++ b/Makefile @@ -254,6 +254,10 @@ rpc-check: rpc for rpc in $$(find lnrpc/ -name "*.proto" | $(XARGS) awk '/ rpc /{print $$2}'); do if ! grep -q $$rpc lnrpc/rest-annotations.yaml; then echo "RPC $$rpc not added to lnrpc/rest-annotations.yaml"; exit 1; fi; done 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 +sample-conf-check: + @$(call print, "Making sure every flag has an example in the sample-lnd.conf file") + for flag in $$(GO_FLAGS_COMPLETION=1 go run -tags="$(RELEASE_TAGS)" $(PKG)/cmd/lnd -- | grep -v help | cut -c3-); do if ! grep -q $$flag sample-lnd.conf; then echo "Command line flag --$$flag not added to sample-lnd.conf"; exit 1; fi; done + mobile-rpc: falafel goimports @$(call print, "Creating mobile RPC from protos.") cd ./mobile; ./gen_bindings.sh $(FALAFEL_COMMIT)