language: python
cache:
  directories:
    - $HOME/.cache/pip
    - $HOME/.cache/pre-commit

python:
  - "3.6"

addons:
  postgresql: "9.6"
  apt:
    packages:
      - expect-dev # provides unbuffer utility

stages:
  - linting
  - test

jobs:
  include:
    - stage: linting
      name: "pre-commit"
      before_install:
      install: pip install pre-commit
      script: pre-commit run --all --show-diff-on-failure --verbose --color always
      after_success:
    - stage: test
      env:
        - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1"
    - stage: test
      env:
        - TESTS="1" ODOO_REPO="OCA/OCB"

env:
  global:
    - VERSION="13.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"

install:
  - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git
    ${HOME}/maintainer-quality-tools
  - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
  - travis_install_nightly

script:
  - travis_run_tests

after_success:
  - travis_after_tests_success
