language: r

r:
  - release

deploy.skip_cleanup: true

sudo: required
dist: trusty
cache:
  - packages
  - ccache

latex: false

addons:
  apt:
    sources:
      - sourceline: 'ppa:opencpu/jq'
      - sourceline: 'ppa:ubuntugis/ubuntugis-unstable'
    packages:
      - libgdal-dev
      - libgeos-dev
      - libproj-dev
      - libudunits2-dev
      - libv8-dev
      - libjq-dev
      - libprotobuf-dev
      - protobuf-compiler
      - libssl-dev
      - libcairo2-dev
      - libnetcdf-dev
      - netcdf-bin
      - libjson-c-dev

before_install:
  - R -e 'install.packages("rgdal", repos="http://R-Forge.R-project.org")'
  - R -q -e 'install.packages("remotes"); remotes::install_github("ropenscilabs/tic"); tic::prepare_all_stages()'

install: R -q -e 'tic::install()'
script: R -q -e 'tic::script()'
before_deploy: R -q -e 'tic::before_deploy()'
deploy:
   provider: script
   script: R -q -e 'tic::deploy()'
   on:
     branch: master
     condition:
       - $TRAVIS_PULL_REQUEST = false
       - $TRAVIS_EVENT_TYPE != cron
       - $TRAVIS_R_VERSION_STRING = release

after_success: R -q -e 'tic::after_success()'
