inocode:
  image: "java:8"
  variables:
      ESPURL:    "http://arduino.esp8266.com/stable/package_esp8266com_index.json"
      MEMORY:    "custom_FlashSize=nodemcuv2_4M3M"
      INSTBOARD: "esp8266:esp8266"
      BOARD:     "${INSTBOARD}:nodemcuv2"
      ARDVER:    "1.8.5"
  before_script:
      - apt update
      - apt -y install xvfb
      - Xvfb :1 -nolisten tcp -screen :1 1280x800x24 &
      - export DISPLAY=":1"
      - cd /
      - wget --quiet "https://downloads.arduino.cc/arduino-${ARDVER}-linux64.tar.xz" -O "arduino-${ARDVER}-linux64.tar.xz"
      - tar axf "arduino-${ARDVER}-linux64.tar.xz"
      - /arduino-${ARDVER}/arduino --pref "boardsmanager.additional.urls=${ESPURL}" --save-prefs
      - /arduino-${ARDVER}/arduino --install-boards "${INSTBOARD}"
      - /arduino-${ARDVER}/arduino --pref "compiler.warning_level=all" --pref "${MEMORY}" --board "${BOARD}" --save-prefs
  script:
      - cd "${CI_PROJECT_DIR}/arduino/${CI_PROJECT_NAME}"
      - cp "${CI_PROJECT_NAME}.example.h" "${CI_PROJECT_NAME}.h"
      - /arduino-${ARDVER}/arduino --install-library "FastLED"
      - /arduino-${ARDVER}/arduino --install-library "PubSubClient"
      - /arduino-${ARDVER}/arduino --verify "${CI_PROJECT_NAME}.ino"

yaml:
  image: "python:alpine"
  before_script:
      - pip install "PyYAML"
  script:
      - cd "${CI_PROJECT_DIR}/home-assistant"
      - python -c "from yaml import load, Loader; load(open('ha_configuration.yml'), Loader=Loader)"
