image: php:7.1.1

pipelines:
  default:
    - step:
        caches:
          - composer
        script:
          - apt-get update && apt-get install -qy git curl libmcrypt-dev mysql-client
          - docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql
          - apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
          - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
          - docker-php-ext-install -j$(nproc) gd
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install --optimize-autoloader --no-interaction -vvv
          - vendor/bin/phpunit
        services:
          - mysql

definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_ROOT_PASSWORD: 'secret'
        MYSQL_DATABASE: 'testing'
        MYSQL_USER: 'homestead'
        MYSQL_PASSWORD: 'secret'
