From 6644e149b243650f86953e00ad3f4fd1ee2daa40 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 19 Nov 2021 14:09:40 +0100 Subject: [PATCH] ci: properly fail if protobuf compilation or diff check fails --- tools/build_protobuf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/build_protobuf b/tools/build_protobuf index 808ed4a3a..f081889ae 100755 --- a/tools/build_protobuf +++ b/tools/build_protobuf @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e cd $(dirname $0)/.. PROTOB=common/protob @@ -71,6 +72,7 @@ do_rebuild() { do_check() { # rebuild protobuf in tmpdir and check result against specified directory local TMPDIR=$(mktemp -d proto-check.XXXXXX) + trap "rm -r $TMPDIR" RETURN local FILE_OR_DIR="$1" shift @@ -85,10 +87,7 @@ do_check() { fi do_rebuild "$FILE_OR_DIR" "$TMPDEST" "$@" - DIFF=$(diff -ur --exclude __pycache__ "$OUTPUT" "$TMPDEST") - rm -r "$TMPDIR" - if [ -n "$DIFF" ]; then - echo "$DIFF" + if ! diff -ur --exclude __pycache__ "$OUTPUT" "$TMPDEST"; then RETURN=1 fi }