image: php:7.0-fpm

pipelines:
  default:
    - step:
        caches:
          - composer
        script:
          - apt-get update && apt-get install -qy git curl unzip libmcrypt-dev libpng-dev mysql-client
          - docker-php-ext-install pdo_mysql
          - docker-php-ext-install gd
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
          - ln -f -s .env.pipelines .env
          - php artisan migrate
          - php artisan serve &
          - sleep 5
          - ./vendor/bin/phpunit --no-coverage
          - curl -vk http://localhost:8000
        services:
          - mysql

definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: 'homestead'
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
        MYSQL_USER: 'homestead'
        MYSQL_PASSWORD: 'secret'