language: php

# Add php version so composer doesn't complain
php:
  - 7.1

services:
  - docker

env:
  - DRUPAL_ROOT=/var/www/html

before_script:
  - docker pull statonlab/tripal3
  - wget ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.2.30/ncbi-blast-2.2.30+-x64-linux.tar.gz
  - tar xzf ncbi-blast-2.2.30+-x64-linux.tar.gz
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build --debug
  - GIT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
  - GIT_COMMIT_SHA=$TRAVIS_PULL_REQUEST_SHA
after_script:
  - ./cc-test-reporter after-build clover.xml --debug -t clover -p /var/www/html/sites/all/modules/custom/tripal_eutils --exit-code $TRAVIS_TEST_RESULT
script:
  - docker run -it -d --rm --name tripal -v "$(pwd)":/modules/tripal_blast statonlab/tripal3
  - sleep 30 # We pause here so postgres and apache complete booting up
 #install blast
  - docker exec -it tripal bash -c "cp /modules/tripal_blast/ncbi-blast-2.2.30+/bin/* /usr/local/bin"
  - docker exec -it tripal drush pm-enable -y blast_ui
  - docker exec -it tripal yum install -y php-pecl-xdebug.x86_64
  - docker exec -it tripal bash -c "cd /modules/tripal_blast && composer install && DRUPAL_ROOT=/var/www/html ./vendor/bin/phpunit --coverage-clover ./clover.xml"
