dist: xenial
addons:
  apt:
    packages:
      - libv8-dev
language: python

jobs:
  include:
    - language: python
      python:
        - "3.7"
      cache: pip
      install:
        - pip install --upgrade pip
        - pip install -U -r python/requirements.txt dask[dataframe] distributed
      script:
        - cd python && python setup.py develop test
        - python setup.py clean
        - rm -rf prophet/stan_model
        - wget https://github.com/stan-dev/cmdstan/releases/download/v2.22.1/cmdstan-2.22.1.tar.gz -O /tmp/cmdstan.tar.gz > /dev/null
        - tar -xvf /tmp/cmdstan.tar.gz -C /tmp > /dev/null
        - make -C /tmp/cmdstan-2.22.1/ build > /dev/null
        - CMDSTAN=/tmp/cmdstan-2.22.1 STAN_BACKEND=CMDSTANPY python setup.py develop test

    - language: r
      r:
        - devel
      cache: packages
      install:
        - R -e 'install.packages("devtools")'
        - R -e 'devtools::install_deps("R", dependencies = TRUE)'
        - cd R
        - R CMD build .
        - R CMD INSTALL *tar.gz
      script:
        - R -e 'library(prophet); library(devtools); devtools::test()'

