Skip to content

Commit 5866149

Browse files
committed
CI: Make sure ci-validate exits when ANY command fails
1 parent 23055cd commit 5866149

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/scripts/validate_sample.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
set -e
4+
set -x
5+
36
# shellcheck disable=SC2034
47
declare -r GREEN='\033[0;32m'
58
declare -r BOLD='\033[1m'
@@ -14,14 +17,11 @@ echo "========================================================================"
1417
printf "Validate sample '${BOLD}%s${RESET}' using: " "$sampleDir"
1518
cd "$sampleDir" || exit
1619
if [[ $(find . -name ${CI_VALIDATE_SCRIPT} -maxdepth 1) ]]; then
17-
echo -e "Custom ${BOLD}${CI_VALIDATE_SCRIPT}${RESET} script..."
18-
./${CI_VALIDATE_SCRIPT} || exit
19-
elif [[ $(find . -name 'build.gradle*' -maxdepth 1) ]]; then
20-
echo -e "${BOLD}Gradle${RESET} build..."
21-
./gradlew build || ./gradlew build --info # re-run to get better failure output
20+
echo -e "Run ${BOLD}${CI_VALIDATE_SCRIPT}${RESET} script..."
21+
./${CI_VALIDATE_SCRIPT}
2222
else
23-
echo -e "${BOLD}SwiftPM${RESET} build..."
24-
swift build || exit
23+
echo -e "${BOLD}Missing ${CI_VALIDATE_SCRIPT} file!${RESET}"
24+
exit
2525
fi
2626

2727
echo -e "Validated sample '${BOLD}${sampleDir}${RESET}': ${BOLD}passed${RESET}."
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
./gradlew run

0 commit comments

Comments
 (0)