@@ -695,12 +695,16 @@ function build_sketch()
695
695
696
696
if [[ " $sketchPath " =~ \. ino$ || " $sketchPath " =~ \. pde$ ]]; then
697
697
# A sketch was specified
698
- if ! build_this_sketch " $sketchPath " " $boardID " " $IDEversion " " $allowFail " ; then
698
+ if ! [[ -f " $sketchPath " ]]; then
699
+ echo " ERROR: Specified sketch: $sketchPath doesn't exist"
700
+ buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
701
+ elif ! build_this_sketch " $sketchPath " " $boardID " " $IDEversion " " $allowFail " ; then
699
702
# build_this_sketch returned a non-zero exit status
700
703
buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
701
704
fi
702
705
else
703
706
# Search for all sketches in the path and put them in an array
707
+ local sketchFound=" false"
704
708
# https://github.com/koalaman/shellcheck/wiki/SC2207
705
709
declare -a sketches
706
710
mapfile -t sketches < <( find " $sketchPath " -name " *.pde" -o -name " *.ino" )
@@ -714,12 +718,18 @@ function build_sketch()
714
718
local sketchNameWithoutPathWithoutExtension
715
719
sketchNameWithoutPathWithoutExtension=" ${sketchNameWithoutPathWithExtension% .* } "
716
720
if [[ " $sketchFolder " == " $sketchNameWithoutPathWithoutExtension " ]]; then
721
+ sketchFound=" true"
717
722
if ! build_this_sketch " $sketchName " " $boardID " " $IDEversion " " $allowFail " ; then
718
723
# build_this_sketch returned a non-zero exit status
719
724
buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
720
725
fi
721
726
fi
722
727
done
728
+
729
+ if [[ " $sketchFound " == " false" ]]; then
730
+ echo " ERROR: No valid sketches were found in the specified path"
731
+ buildSketchExitStatus=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
732
+ fi
723
733
fi
724
734
done
725
735
0 commit comments