# This is a common .travis.yml for generating library release zip files for
# CircuitPython library releases using circuitpython-build-tools.
# See https://github.com/adafruit/circuitpython-build-tools for detailed setup
# instructions.

dist: xenial
language: python
python:
  - "3.6"

cache:
  pip: true

#       if deployment to PyPi is desired, change 'DEPLOY_PYPI' to "true",
#       or remove the env block entirely and remove the condition in the
#       deploy block.
env:
  - DEPLOY_PYPI="true"

deploy:
  - provider: releases
    api_key: "$GITHUB_TOKEN"
    file_glob: true
    file: "$TRAVIS_BUILD_DIR/bundles/*"
    skip_cleanup: true
    overwrite: true
    on:
      tags: true
  # TODO: Use 'travis encrypt --com -r adafruit/<repo slug>' to generate
  #       the encrypted password for adafruit-travis. Paste result below.
  - provider: pypi
    user: fourstix
    password:
      secure: MgHwILmPMRF+gn/Xo+9jbTLFD/GIrkdR8TPrxxUU8iAlCjoqoRWV5WDe4Q9itLyP2qkSvSg+24l30NC9IqYzUH8OzSy9dIMUzv3mUJOryr1cnhT7QhR+8PJafegEPiYtP1g9Laq3b6du6tYjBhOY2yA0uZmp3OY0vhL18ZbWOYwKzEf6GXiruhTY2BrC+4O8SjFaQJC/qBQCQ1LoyM947q2DFGhamYVfxwExLWsEcUHA8eNXYWDz9PTi/l+0qmN89uDDFpZMWTXRnnuhlJ6bbirG+Dz+Z8crBKNh/GT840OzqF5zyEUR7QQz2Eg932dulRuPiJgT6TXpgplwlzHl+sa6kke3LuCUoZB5GXHG4DwR84SQlSGvAEAzN6lMzRzduqJal202xlOVS529ASV+72OtLtMNAAOHEhbg/pAiY0rYZFK7yHDQnJRrIzaaMs7EzYA+ZqrclIuGrY2PENM59uGybm4BX2BCI9FTGWIatfC70RdnCzDrTF6EE12ikwcYPZfErYFXabqQhcWMDGYnJw86HYi5K5xGmGfwnfxwoa4vGBW1gtx6uOHU57VmN2gXUICWgtrmLsx3jhIIVAYIY5J+eCI4c3rJh2OwyEGE1VR4RCSXJ5XBJXoKzcvvjYsOxq7upywcL9zOHlyf8e2WGJ3BoreVPFdPRV3eFWSgD0U=
    on:
      tags: true
      condition: $DEPLOY_PYPI = "true"

install:
  - pip install -r requirements.txt
  - pip install circuitpython-build-tools Sphinx sphinx-rtd-theme
  - pip install --force-reinstall pylint==1.9.2

script:
  - pylint sparkfun_qwiictwist.py
  - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
  - circuitpython-build-bundles --filename_prefix sparkfun-circuitpython-qwiictwist --library_location .
  - cd docs && sphinx-build -E -W -b html . _build/html && cd ..
