@@ -25,6 +25,9 @@ readonly ARDUINO_CI_SCRIPT_HIGHEST_ACCEPTABLE_ARDUINO_EXIT_CODE=4
25
25
readonly ARDUINO_CI_SCRIPT_SKETCH_VERIFY_RETRIES=3
26
26
readonly ARDUINO_CI_SCRIPT_REPORT_PUSH_RETRIES=10
27
27
28
+ readonly ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS=0
29
+ readonly ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS=1
30
+
28
31
29
32
# Create the folder if it doesn't exist
30
33
function create_folder()
@@ -621,7 +624,7 @@ function build_sketch()
621
624
local -r endIDEversion=" $5 "
622
625
623
626
# Set default value for buildSketchExitCode
624
- local buildSketchExitCode=0
627
+ local buildSketchExitCode=" $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS "
625
628
626
629
generate_ide_version_list_array " $INSTALLED_IDE_VERSION_LIST_ARRAY " " $startIDEversion " " $endIDEversion "
627
630
@@ -709,23 +712,23 @@ function build_this_sketch()
709
712
local verifyCount=$(( verifyCount + 1 ))
710
713
done
711
714
712
- if [[ " $arduinoExitCode " != " 0 " ]]; then
715
+ if [[ " $arduinoExitCode " != " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " ]]; then
713
716
# Sketch build failed
714
717
if [[ " $allowFail " == " true" || " $allowFail " == " require" ]]; then
715
718
# Failure is allowed for this test
716
- local -r buildThisSketchExitCode=0
719
+ local -r buildThisSketchExitCode=" $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS "
717
720
else
718
721
# Failure is not allowed for this test, fail the Travis build after completing all sketch builds
719
- local -r buildThisSketchExitCode=1
722
+ local -r buildThisSketchExitCode=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
720
723
fi
721
724
else
722
725
# Sketch build succeeded
723
726
if [[ " $allowFail " == " require" ]]; then
724
727
# Failure is required for this test, fail the Travis build after completing all sketch builds
725
- local -r buildThisSketchExitCode=1
728
+ local -r buildThisSketchExitCode=" $ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS "
726
729
else
727
730
# Success is allowed
728
- local -r buildThisSketchExitCode=0
731
+ local -r buildThisSketchExitCode=" $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS "
729
732
fi
730
733
731
734
# Parse through the output from the sketch verification to count warnings and determine the compile size
@@ -832,15 +835,15 @@ function publish_report_to_repository()
832
835
git commit $ARDUINO_CI_SCRIPT_QUIET_OPTION $ARDUINO_CI_SCRIPT_VERBOSITY_OPTION --message=" Add Travis CI job ${TRAVIS_JOB_NUMBER} report (${jobSuccessMessage} )" --message=" Job log: https://travis-ci.org/${TRAVIS_REPO_SLUG} /jobs/${TRAVIS_JOB_ID} " --message=" Commit: https://github.com/${TRAVIS_REPO_SLUG} /commit/${TRAVIS_COMMIT} " --message=" $TRAVIS_COMMIT_MESSAGE " --message=" [skip ci]"
833
836
local gitPushExitCode=" 1"
834
837
local pushCount=0
835
- while [[ " $gitPushExitCode " != " 0 " && $pushCount -le $ARDUINO_CI_SCRIPT_REPORT_PUSH_RETRIES ]]; do
838
+ while [[ " $gitPushExitCode " != " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " && $pushCount -le $ARDUINO_CI_SCRIPT_REPORT_PUSH_RETRIES ]]; do
836
839
pushCount=$(( pushCount + 1 ))
837
840
# Do a pull now in case another job has finished about the same time and pushed a report since the last pull. This would require a merge or rebase. Rebase should be safe since the commits will be separate files.
838
841
git pull $ARDUINO_CI_SCRIPT_QUIET_OPTION --rebase
839
842
git push $ARDUINO_CI_SCRIPT_QUIET_OPTION $ARDUINO_CI_SCRIPT_VERBOSITY_OPTION " https://${token} @${repositoryURL#*// } "
840
843
gitPushExitCode=" $? "
841
844
done
842
845
rm --recursive --force " ${HOME} /report-repository"
843
- if [[ " $gitPushExitCode " == " 0 " ]]; then
846
+ if [[ " $gitPushExitCode " == " $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS " ]]; then
844
847
if [[ " $doLinkComment " == " true" ]]; then
845
848
# Only comment if it's job 1
846
849
local -r firstJobRegex=" \.1$"
0 commit comments