@@ -169,31 +169,8 @@ function build_sketches_with_platformio()
169169 set -e
170170}
171171
172- function run_travis_ci_build ()
172+ function install_arduino ()
173173{
174- # Build documentation using Sphinx
175- echo -e " travis_fold:start:docs"
176- cd $TRAVIS_BUILD_DIR /doc
177- build_docs
178- echo -e " travis_fold:end:docs"
179-
180- # Build release package
181- echo -e " travis_fold:start:build_package"
182- cd $TRAVIS_BUILD_DIR /package
183- build_package
184- echo -e " travis_fold:end:build_package"
185-
186- if [ " $TRAVIS_TAG " != " " ]; then
187- echo " Skipping tests for tagged build"
188- return 0;
189- fi
190-
191- # Run host side tests
192- echo -e " travis_fold:start:host_tests"
193- cd $TRAVIS_BUILD_DIR /tests
194- run_host_tests
195- echo -e " travis_fold:end:host_tests"
196-
197174 # Install Arduino IDE and required libraries
198175 echo -e " travis_fold:start:sketch_test_env_prepare"
199176 cd $TRAVIS_BUILD_DIR
@@ -202,7 +179,10 @@ function run_travis_ci_build()
202179 cd $TRAVIS_BUILD_DIR
203180 install_libraries
204181 echo -e " travis_fold:end:sketch_test_env_prepare"
182+ }
205183
184+ function build_sketches_with_arduino()
185+ {
206186 # Compile sketches
207187 echo -e " travis_fold:start:sketch_test"
208188 build_sketches $HOME /arduino_ide $TRAVIS_BUILD_DIR /libraries " -l $HOME /Arduino/libraries"
@@ -212,20 +192,28 @@ function run_travis_ci_build()
212192 echo -e " travis_fold:start:size_report"
213193 cat size.log
214194 echo -e " travis_fold:end:size_report"
215-
216- # PlatformIO
217- echo -e " travis_fold:start:install_platformio"
218- install_platformio
219- echo -e " travis_fold:end:install_platformio"
220-
221- echo -e " travis_fold:start:build_sketches_with_platformio"
222- build_sketches_with_platformio $TRAVIS_BUILD_DIR /libraries " --board nodemcuv2 --verbose"
223- echo -e " travis_fold:end:build_sketches_with_platformio"
224195}
225196
226197set -e
227198
228199if [ " $BUILD_TYPE " = " build" ]; then
229- run_travis_ci_build
200+ install_arduino
201+ build_sketches_with_arduino
202+ elif [ " $BUILD_TYPE " = " platformio" ]; then
203+ # PlatformIO
204+ install_platformio
205+ build_sketches_with_platformio $TRAVIS_BUILD_DIR /libraries " --board nodemcuv2 --verbose"
206+ elif [ " $BUILD_TYPE " = " docs" ]; then
207+ # Build documentation using Sphinx
208+ cd $TRAVIS_BUILD_DIR /doc
209+ build_docs
210+ elif [ " $BUILD_TYPE " = " package" ]; then
211+ # Build release package
212+ cd $TRAVIS_BUILD_DIR /package
213+ build_package
214+ elif [ " $BUILD_TYPE " = " host_tests" ]; then
215+ # Run host side tests
216+ cd $TRAVIS_BUILD_DIR /tests
217+ run_host_tests
230218fi
231219
0 commit comments