language: c
sudo: false
env:
  # Target commit for https://github.com/pfalcon/esp-open-sdk/
  OPENSDK_COMMIT=a48b12f
  CROSS_ROOT="${HOME}/toolchain-${OPENSDK_COMMIT}"
  CROSS_BINDIR="${CROSS_ROOT}/bin"
  ESPTOOL2_COMMIT=ec0e2c7
  ESPTOOL2_DIR="${HOME}/esptool2-${ESPTOOL2_COMMIT}"
  PATH=${PATH}:${CROSS_BINDIR}:${ESPTOOL2_DIR}
  CROSS="ccache xtensa-lx106-elf-"
  MAKE_CMD="make WARNINGS_AS_ERRORS=1 -C examples/ build-examples"
cache:
  directories:
    - ${CROSS_ROOT}
    - ${ESPTOOL2_DIR}
addons:
  apt:
    packages:
    - make
    - unrar
    - autoconf
    - automake
    - libtool
    - gcc
    - g++
    - gperf
    - flex
    - bison
    - texinfo
    - gawk
    - libncurses5-dev
    - libexpat1-dev
    - python
    - python-serial
    - sed
    - git

before_install:
  - utils/travis_build/install_esptool2.sh
  - travis_wait 30 utils/travis_build/install_toolchain.sh

script:
  - cd ${TRAVIS_BUILD_DIR}
  # Remove ssid_config requirement for examples
  - sed -i "s%#error%//#error%" include/ssid_config.h
  # Don't verbose-build all examples (too much output), only verbose-build errors
  - ( ${MAKE_CMD} ) || ( ${MAKE_CMD} V=1 )
