sudo: required
language: php
services:
  - docker
env:
  - TRAVIS_ERROR_LEVEL=22519 # E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT
before_install:
  - sudo rm /usr/local/bin/docker-compose
  - curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` > docker-compose
  - chmod +x docker-compose
  - sudo mv docker-compose /usr/local/bin
before_script:
  - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
  - docker pull "$IMAGE_NAME" || true
script:
  - docker-compose up -d
  - docker-compose exec phpunit /bin/bash -c "chmod +x ./build.sh && ./build.sh 5 && ./build.sh 6 && ./build.sh 6.0 && ./build.sh 6.1"
before_deploy:
  - ssh-keyscan $DEPLOYMENT_SERVER >> $HOME/.ssh/known_hosts
  - (umask  077 ; echo $DEPLOYMENT_SSH_KEY | base64 --decode > /tmp/deploy_rsa)
  - eval "$(ssh-agent -s)"
  - chmod 600 /tmp/deploy_rsa
  - ssh-add /tmp/deploy_rsa
deploy:
  - provider: script
    skip_cleanup: true
    script: ./deploy.sh
    on:
      branch: develop
  - provider: script
    skip_cleanup: true
    script: ./deploy-package.sh ${GH_API_KEY} ${TRAVIS_TAG}
    on:
      tags: true