mirror of https://github.com/linkerd/linkerd2.git
Diff generated code from proto files (#4863)
Add a static check that ensures the generated files from the proto definitions have not changed. Fix #4669 Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
This commit is contained in:
parent
ac2bfb387b
commit
2e7c00aa37
|
@ -30,6 +30,17 @@ jobs:
|
||||||
uses: actions/checkout@722adc6
|
uses: actions/checkout@722adc6
|
||||||
- name: Format
|
- name: Format
|
||||||
run: bin/fmt
|
run: bin/fmt
|
||||||
|
proto_diff:
|
||||||
|
name: Proto diff
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
container:
|
||||||
|
image: golang:1.13.4
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
# actions/checkout@v2
|
||||||
|
uses: actions/checkout@722adc6
|
||||||
|
- name: Diff proto files
|
||||||
|
run: bin/protoc-diff
|
||||||
shellcheck:
|
shellcheck:
|
||||||
name: shellcheck
|
name: shellcheck
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Install unzip if not already installed (Linux only)
|
||||||
|
system=$(uname -s)
|
||||||
|
if [ "$system" = Linux ] && ! [ -x "$(command -v unzip)" ]; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install unzip
|
||||||
|
fi
|
||||||
|
|
||||||
|
bin/protoc-go.sh
|
||||||
|
|
||||||
|
dir_dirty=$(git diff HEAD)
|
||||||
|
if [ -z "$dir_dirty" ]; then
|
||||||
|
echo "Protobuf definitions match generated code"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Protobuf definitions diverge from generated code:"
|
||||||
|
echo "$(git status)"
|
||||||
|
exit 64
|
||||||
|
fi
|
Loading…
Reference in New Issue