diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 83eb33b..165208f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,15 +27,15 @@ env: GO_VERSION: 1.19.2 jobs: - rpc-check: - name: RPC check - runs-on: ubuntu-latest - steps: - - name: git checkout - uses: actions/checkout@v3 + rpc-check: + name: RPC check + runs-on: ubuntu-latest + steps: + - name: git checkout + uses: actions/checkout@v3 - - name: Generate RPC stubs and check REST annotations - run: make rpc-check + - name: Generate RPC stubs and check REST annotations + run: make rpc-check ######################## # lint code diff --git a/Makefile b/Makefile index 866b488..420b249 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ rpc-format: rpc-check: rpc @$(call print, "Verifying protos.") - cd ./pricesrpc; ../scripts/check-rest-annotations.sh + cd ./pricesrpc; ../pricesrpc/check-rest-annotations.sh if test -n "$$(git status --porcelain)"; then echo "Protos not properly formatted or not compiled with correct version"; git status; git diff; exit 1; fi clean: diff --git a/pricesrpc/check-rest-annotations.sh b/pricesrpc/check-rest-annotations.sh new file mode 100755 index 0000000..380e097 --- /dev/null +++ b/pricesrpc/check-rest-annotations.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +for proto in $(find . -name "*.proto"); do + for rpc in $(awk '/ rpc /{print $2}' "$proto"); do + yaml=${proto%%.proto}.yaml + if ! grep -q "$rpc" "$yaml"; then + echo "RPC $rpc not added to $yaml file" + exit 1 + fi + done +done