sudo: false

language: bash

os:
  - linux

before_script:
  - wget http://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz
  - tar xf arduino-1.8.5-linux64.tar.xz
  - mv arduino-1.8.5 $HOME/arduino_ide
  - cd $HOME/arduino_ide/hardware
  - mkdir esp8266com
  - cd esp8266com
  - git clone -b 2.5.2 https://github.com/esp8266/Arduino.git esp8266
  - cd esp8266/tools
  - python get.py
  - cd $HOME/arduino_ide/hardware
  - mkdir esp32
  - cd esp32
  - git clone https://github.com/espressif/arduino-esp32.git esp32
  - cd esp32/tools
  - python get.py
  - mv $TRAVIS_BUILD_DIR/libraries/ESPAsyncWebServer $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/ESPAsyncTCP $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/AsyncTCP $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/oled-ssd1306 $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/ESP32SSDP $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/arduinoWebSockets $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/DHT_sensor_library_for_ESPx $HOME/arduino_ide/libraries/
  - mv $TRAVIS_BUILD_DIR/libraries/ESP32NETBIOS $HOME/arduino_ide/libraries/
    
script:
  - cd $TRAVIS_BUILD_DIR
  - source command.sh
  - export PATH="$HOME/arduino_ide:$PATH"
  - rm -f $HOME/.arduino15/preferences.txt
  - arduino --board esp8266com:esp8266:generic:eesz=4M3M,xtal=160,FlashMode=dio,FlashFreq=40,sdk=nonosdk221,ip=lm2f,dbg=Disabled,vt=flash,exception=disabled,ssl=basic --save-prefs
  - build_sketch  $TRAVIS_BUILD_DIR/esp3d/esp3d.ino
  - rm -f $HOME/.arduino15/preferences.txt
  - arduino --board esp32:esp32:esp32:PartitionScheme=min_spiffs,FlashFreq=80,PSRAM=disabled,CPUFreq=240,FlashMode=qio,FlashSize=4M,DebugLevel=none --pref compiler.warning_level=all --save-prefs
  - build_sketch  $TRAVIS_BUILD_DIR/esp3d/esp3d.ino
  - sed -i "s/\/\/#define AUTHENTICATION_FEATURE /#define AUTHENTICATION_FEATURE/g" $TRAVIS_BUILD_DIR/esp3d/config.h
  - rm -f $HOME/.arduino15/preferences.txt
  - arduino --board esp8266com:esp8266:generic:eesz=4M3M,xtal=160,FlashMode=dio,FlashFreq=40,sdk=nonosdk221,ip=lm2f,dbg=Disabled,vt=flash,exception=disabled,ssl=basic --save-prefs
  - build_sketch  $TRAVIS_BUILD_DIR/esp3d/esp3d.ino
  - rm -f $HOME/.arduino15/preferences.txt
  - arduino --board esp32:esp32:esp32:PartitionScheme=min_spiffs,FlashFreq=80,PSRAM=disabled,CPUFreq=240,FlashMode=qio,FlashSize=4M,DebugLevel=none --pref compiler.warning_level=all --save-prefs
  - build_sketch  $TRAVIS_BUILD_DIR/esp3d/esp3d.ino
  - sed -i "s/\/\/#define ASYNCWEBSERVER /#define ASYNCWEBSERVER/g" $TRAVIS_BUILD_DIR/esp3d/config.h
  - rm -f $HOME/.arduino15/preferences.txt
  - arduino --board esp8266com:esp8266:generic:eesz=4M3M,xtal=160,FlashMode=dio,FlashFreq=40,sdk=nonosdk221,ip=lm2f,dbg=Disabled,vt=flash,exception=disabled,ssl=basic --save-prefs
  - build_sketch  $TRAVIS_BUILD_DIR/esp3d/esp3d.ino
  - rm -f $HOME/.arduino15/preferences.txt
  - arduino --board esp32:esp32:esp32:PartitionScheme=min_spiffs,FlashFreq=80,PSRAM=disabled,CPUFreq=240,FlashMode=qio,FlashSize=4M,DebugLevel=none --pref compiler.warning_level=all --save-prefs
  - build_sketch  $TRAVIS_BUILD_DIR/esp3d/esp3d.ino
  
notifications:
  email:
    on_success: change
    on_failure: change
