sudo: required
dist: trusty

language: python
cache: pip
python:
  - "2.7"
  - "3.6"


env:
  matrix:
    - SQLALCHEMY_DATABASE_URI="sqlite://"
    - SQLALCHEMY_DATABASE_URI="postgres://postgres@localhost:5432/abilian_core"

services:
  - redis-server

addons:
  postgresql: "9.3"

# Install OS dependencies
before_install:
  - pip install -U 'pip>=9' setuptools
  - export NPM_CONFIG_PREFIX=~/npm-packages
  - mkdir "${NPM_CONFIG_PREFIX}"
  - npm install -g less eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard eslint-plugin-html
  - export PATH=~/npm-packages/bin:$PATH

# Install Python dependencies
install:
  - pip install -r requirements.txt
  - pip install -e '.[dev]'
  - pip check

# Create DB
before_script:
  - psql -c 'create database abilian_core;' -U postgres

# Run tests
script:
  - pytest --cov abilian abilian tests
  - make lint-ci

# Report coverage
after_success:
  - pip install codecov coveralls
  - coveralls
  - codecov

notifications:
  slack:
    rooms:
      - abilian:dTtRD7DHS4Dw3jfRrqytQWU6#code
    on_success: change
    on_failure: always

