Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 54cacd7

Browse files
authored
ci.sh: exit successfully if there are no affected buildable files. (#55)
Also some cosmetic fixes.
1 parent 1eee992 commit 54cacd7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tools/ci.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ else
3333
# that the file is not tracked by bazel (e.g. documentation, tools)
3434
# and can be ignored.
3535
mapfile -O ${#files[@]} -t files <<< \
36-
"$(bazel query $file 2>/dev/null| sed s/:BUILD/:all/)"
36+
"$(bazel query $file 2>/dev/null | sed s/:BUILD/:all/)"
3737
bazel query $file 2>/dev/null
3838
done
3939
fi
4040
41-
if [[ -z "${files[*]}" ]]; then
42-
echo "No buildable files affected."
41+
if [[ -z "${files}" ]]; then
42+
echo "(no buildable files affected)"
4343
exit 0
4444
fi
4545
@@ -49,10 +49,11 @@ trap "exit_code=1" ERR
4949
# We can't use --noshow_progress on build/test commands because Travis
5050
# terminates the build after 10 mins without output.
5151
buildables=$(bazel query -k --noshow_progress \
52-
"kind(rule, rdeps(//..., set(${files[*]})))" \
52+
"kind(rule, rdeps(//..., set(${files[*]})))" 2>/dev/null \
5353
| grep -v :_)
5454
if [[ ! -z $buildables ]]; then
55-
echo "Building targets"
55+
echo ""
56+
echo "Building targets:"
5657
echo "$buildables"
5758
bazel build --experimental_ui_actions_shown=1 -k $buildables
5859
fi
@@ -62,10 +63,11 @@ fi
6263
tests=$(bazel query -k --noshow_progress \
6364
"kind(test, rdeps(//..., set(${files[*]}))) \
6465
except attr('tags', 'noci', //...) \
65-
except attr('tags', 'manual', //...)" \
66+
except attr('tags', 'manual', //...)" 2>/dev/null \
6667
| grep -v :_)
6768
if [[ ! -z $tests ]]; then
68-
echo "Running tests"
69+
echo ""
70+
echo "Running tests:"
6971
echo "$tests"
7072
bazel test --experimental_ui_actions_shown=1 -k $tests
7173
fi

0 commit comments

Comments
 (0)