language: python
python:
    - "2.7"
sudo: false

# Cache the pip directory. "cache: pip" doesn't work due to install override. See https://github.com/travis-ci/travis-ci/issues/3239.
cache:
  - bundler
  - directories:
    - $HOME/.cache/pip
    - node_modules
    - ecommerce/static/bower_components
addons:
    apt:
        packages:
            - lcov
before_install:
    - "export DISPLAY=:99.0"
    - "sh -e /etc/init.d/xvfb start"
    - "export DJANGO_SETTINGS_MODULE=ecommerce.settings.test"
install:
    - pip install -U codecov
    - pip install -U pip wheel
    - pip install -r requirements/test.txt
    - pip install -r requirements/docs.txt
    - make requirements.js
script:
    # Ensure documentation can be compiled
    - cd docs && make html
    - cd ..

    # Compile assets and run validation
    - make clean_static
    - make static
    - make validate_python
    - make validate_js
after_success:
    - codecov
