sudo: false
matrix:
  allow_failures:
    - os: osx
    - python: 3.9-dev
    - env: TRAVIS_NODE_VERSION=7.4
  include:
    - language: python
      python: 2.7
      env: TRAVIS_NODE_VERSION=4.9
    - language: python
      python: 3.4
      env: TRAVIS_NODE_VERSION=8.9
    - language: python
      python: 3.5
      env: TRAVIS_NODE_VERSION=8.11
    - language: python
      python: 3.6
      env: TRAVIS_NODE_VERSION=6.9
    - language: python
      python: 3.7
      dist: xenial
      sudo: true
      env: TRAVIS_NODE_VERSION=10
    - language: python
      python: 3.8
      dist: xenial
      sudo: true
      env: TRAVIS_NODE_VERSION=10
    - language: python
      python: 3.9-dev
      dist: xenial
      sudo: true
      env: TRAVIS_NODE_VERSION=10
    - language: python
      python: pypy
      env: TRAVIS_NODE_VERSION=6.9
    - language: python
      python: pypy3
      env: TRAVIS_NODE_VERSION=8.11
    # test different versions of Node.js on osx
    - language: node_js
      node_js: 4.9
      os: osx
      env: TRAVIS_PYTHON_VERSION=3.4.10
    - language: node_js
      node_js: 6.14
      os: osx
      env: TRAVIS_PYTHON_VERSION=3.5.7
    - language: node_js
      node_js: 8.11
      os: osx
      env: TRAVIS_PYTHON_VERSION=3.6.9
    - language: node_js
      node_js: 10
      os: osx
      env: TRAVIS_PYTHON_VERSION=3.7.5
    - language: node_js
      node_js: 10
      os: osx
      env: TRAVIS_PYTHON_VERSION=3.8.0

before_install:
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
      brew update || brew update ;
      brew install pyenv ;
      brew outdated pyenv || brew upgrade pyenv ;
      pyenv install $TRAVIS_PYTHON_VERSION ;
      pyenv global $TRAVIS_PYTHON_VERSION ;
      eval "$(pyenv init -)" ;
      python --version ;
      python -m pip install --user virtualenv ;
      python -m virtualenv ~/.venv ;
      source ~/.venv/bin/activate ;
    else
      rm -rf ~/.nvm ;
      git clone https://github.com/creationix/nvm.git ~/.nvm ;
      (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags` );
      source ~/.nvm/nvm.sh ;
      nvm install "$TRAVIS_NODE_VERSION" ;
    fi
  - node --version
  - npm --version

install:
  - pip install coverage flake8
  - python setup.py develop
script:
  - flake8
  - python -OO -m unittest calmjs.parse.tests.make_suite
  - coverage run --include=src/* -m unittest calmjs.parse.tests.make_suite
  - coverage report -m
after_success:
  # only submit coverage when testing under linux.
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
      pip install coveralls ;
      coveralls ;
    fi
branches:
  only:
    - testing
    - master
    - 1.0.x
    - 1.1.x
    - 1.2.x
    - 1.2.5
    - 2.0.x
