Skip to content

Commit 084f370

Browse files
committed
ci: Ensure build channels get run even if FILTER is unset
In 59a18de("ci: Set `-u` (error on unset)..."), `-u` started being passed to the `set` call in shell scripts. This broke the `FILTER` logic since now the command always fails. Make this a bit less fragile by explicitly setting to an empty string, as well as adding a check that at least one test got run.
1 parent 78598d2 commit 084f370

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ci/build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set -eux
1111
: "${OS?The OS environment variable must be set.}"
1212

1313
rust="$TOOLCHAIN"
14+
filter="${FILTER:-}"
1415

1516
echo "Testing Rust $rust on $OS"
1617

@@ -196,13 +197,15 @@ case "${OS}" in
196197
esac
197198

198199
for target in $targets; do
199-
if echo "$target" | grep -q "$FILTER"; then
200+
if echo "$target" | grep -q "$filter"; then
200201
if [ "${OS}" = "windows" ]; then
201202
TARGET="$target" sh ./ci/install-rust.sh
202203
test_target build "$target"
203204
else
204205
test_target build "$target"
205206
fi
207+
208+
test_run=1
206209
fi
207210
done
208211

@@ -276,8 +279,10 @@ x86_64-wrs-vxworks \
276279
if [ "${rust}" = "nightly" ] && [ "${OS}" = "linux" ]; then
277280
for target in $rust_linux_no_core_targets; do
278281
if echo "$target" | grep -q "$FILTER"; then
279-
test_target build "$target" 1
282+
test_target "$target" 1
280283
fi
284+
285+
test_run=1
281286
done
282287
fi
283288

@@ -290,7 +295,15 @@ i386-apple-ios \
290295
if [ "${rust}" = "nightly" ] && [ "${OS}" = "macos" ]; then
291296
for target in $rust_apple_no_core_targets; do
292297
if echo "$target" | grep -q "$FILTER"; then
293-
test_target build "$target" 1
298+
test_target "$target" 1
294299
fi
300+
301+
test_run=1
295302
done
296303
fi
304+
305+
# Make sure we didn't accidentally filter everything
306+
if [ "${test_run:-}" != 1 ]; then
307+
echo "No tests were run"
308+
exit 1
309+
fi

0 commit comments

Comments
 (0)