You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Call disable_verbosity before returning early from a public function. Otherwise verbosity would be left in whatever state was set by the enable_verbosity call at the start of the function.
- Automatically take the correct action regarding errexit.
- If returning success and errexit is enabled then disable it.
- If returning failure then don't disable errexit. errexit must be left enabled when returning failure from a function called from any "build lifecycle stage" other than "install", otherwise Travis CI will continue merrily along without failing the build.
Copy file name to clipboardExpand all lines: arduino-ci-script.sh
+26-9Lines changed: 26 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,23 @@ function disable_verbosity()
130
130
}
131
131
132
132
133
+
# Verbosity and, in some cases, errexit must be disabled before an early return from a public function, this allows it to be done in a single line instead of two
134
+
functionreturn_handler()
135
+
{
136
+
local -r exitStatus="$1"
137
+
138
+
# If exit status is success and errexit is enabled then it must be disabled before exiting the script because errexit must be disabled by default and only enabled in the functions that specifically require it.
139
+
# If exit status is not success then errexit should not be disabled, otherwise Travis CI won't fail the build even though the exit status was failure.
140
+
if [[ "$exitStatus"=="$ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS" ]] &&shopt -q -o errexit;then
141
+
set +o errexit
142
+
fi
143
+
144
+
disable_verbosity
145
+
146
+
return"$exitStatus"
147
+
}
148
+
149
+
133
150
functionset_application_folder()
134
151
{
135
152
enable_verbosity
@@ -209,7 +226,7 @@ function install_ide()
209
226
210
227
if [[ "$ARDUINO_CI_SCRIPT_APPLICATION_FOLDER"=="" ]];then
211
228
echo"ERROR: Application folder was not set. Please use the set_application_folder function to define the location of the application folder."
# Check if the newest installed IDE version supports --install-boards
466
483
local -r unsupportedInstallBoardsOptionVersionsRange1regex="1.5.[0-9]"
467
484
local -r unsupportedInstallBoardsOptionVersionsRange2regex="1.6.[0-3]"
468
485
if [[ "$NEWEST_INSTALLED_IDE_VERSION"=~$unsupportedInstallBoardsOptionVersionsRange1regex||"$NEWEST_INSTALLED_IDE_VERSION"=~$unsupportedInstallBoardsOptionVersionsRange2regex ]];then
469
486
echo"ERROR: --install-boards option is not supported by the newest version of the Arduino IDE you have installed. You must have Arduino IDE 1.6.4 or newer installed to use this function."
# Check if the newest installed IDE version supports --install-library
562
579
local -r unsupportedInstallLibraryOptionVersionsRange1regex="1.5.[0-9]"
563
580
local -r unsupportedInstallLibraryOptionVersionsRange2regex="1.6.[0-3]"
564
581
if [[ "$NEWEST_INSTALLED_IDE_VERSION"=~$unsupportedInstallLibraryOptionVersionsRange1regex||"$NEWEST_INSTALLED_IDE_VERSION"=~$unsupportedInstallLibraryOptionVersionsRange2regex ]];then
565
582
echo"ERROR: --install-library option is not supported by the newest version of the Arduino IDE you have installed. You must have Arduino IDE 1.6.4 or newer installed to use this function."
echo"ERROR: Gist URL not specified. Failed to publish build report. See https://github.com/per1234/arduino-ci-script#publishing-job-reports for instructions."
0 commit comments