dist: bionic
sudo: required
language: python

before_install:
  - sudo apt-get update
  - sudo apt-get install -y ffmpeg libturbojpeg
  - pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git

install:
  - pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
  - rm -rf .eggs && pip install -e .

cache:
  pip: true

env:
  global:
    - COLUMNS=80

python:
  - "3.5"
  - "3.6"
  - "3.7"
  - "3.8"

before_script:
  - pip install codecov flake8 yapf isort lmdb
  - flake8 .
  - isort -rc --check-only --diff mmcv/ tests/ examples/
  - yapf -r -d mmcv/ tests/ examples/

script: coverage run --branch --source=mmcv -m pytest tests/

after_success:
  - coverage report -m
  - if [[ $TRAVIS_PYTHON_VERSION == "3.7" ]]; then codecov; fi

deploy:
  provider: pypi
  user: kchen
  password:
    secure: "roexTpCf6tzmOY52XjXiFu31IEa+WPT/ETmDoOJgurN0fw2Dzh5YZfeh80gMF7CfaZdWNJB7vJhPO242wnkYkbOkEM/MITnnDVM3dBav9LpOslqP8UhmIMTk9huK7uI/DYAOmoDuZ7b2xoe7EolpGY4Ea+OO1absM2x7imKY1F2FPfLYOIlJcqfWYtmuxNJjSCUkJaLUDllED6n6DS2+/hBWZUz9WYlmgmQDff2lQjN9vy442zlY8W83kqtzNom7FvsP2aksHz2DRSwulxzRmQpVcvIk6R/D1Kdtt018J+RCadIg7DEztcmVewYuIe4I/4mqh/CzDu636jrxN6KaYnbsxTuT7wPAh4hy12wr9e4J5sowCIgw/DawYooJQ+8XndUn8MOxIq5ZGWrVeinbYeW6xbhxIPf9PVYTfQ3P4cQDrPvotCYJrzKxZUVexyO9CSaqNam9gU8IrR+yrJUdfdyzf/AHeHKLtHufSfVfnVUbB27590jpYgUT9YdoVU6A6tN66RhNOjD0UFEJxzSOgsMaFSNbmDlZZa0SsJizRqUJ4K7XXAlomTxeUkp9HTXdIu5DGwNl0oS/QdrWJvWN4I/6BhFX3gd1f4XupgHHwvhLP1PMeUz+ahlClUVlUqGvQcfxLI7+Pcj+hmETWq5tpZOqPATg8ZwYt4CwwOnzW5c="
  on:
    branch: master
    tags: true
    python: "3.7"
    distributions: sdist  # bdist_wheel is not supported due to the cpp extension
    skip_cleanup: true
    skip_upload_docs: true
