language: php
php:
  - '7.1'
sudo: required
dist: trusty

branches:
  only:
    - master
    - develop
env:
  global:
  - TAGDEV=develop
  - TAGMASTER=master

services:
  - mysql
  - docker

before_install: 
  - sudo chmod 777 -R travis-config-files
  - ./travis-config-files/test/before_install.sh
before_script: ./travis-config-files/test/before_script.sh
  
after_failure: ./travis-config-files/test/after_failure.sh
install: ./travis-config-files/test/install.sh


notifications:
  email: true
  
jobs:
  include:
    - stage: test
      script: ./travis-config-files/test/script.sh
      after_script: ./travis-config-files/test/after_script.sh
    - stage: deploy
      env:
      before_install: skip
      install: skip
      before_script: 
        - sudo chmod 777 -R travis-config-files
        - ./travis-config-files/docker/before_script.sh
        
      script: ./travis-config-files/docker/script.sh
      after_script: ./travis-config-files/docker/after_script.sh 
    - stage: deploy
      env:
      before_install: skip
      install: skip
      before_script: 
        - sudo chmod 777 -R travis-config-files
        - ./travis-config-files/heroku/before_script.sh
      script: ./travis-config-files/heroku/script.sh
        
