sudo: false

language: php

matrix:
  include:
    - php: 5.3
      env: AUTOLOAD=1
      dist: precise
    - php: 5.3
      env: AUTOLOAD=0
      dist: precise
    - php: 5.4
      env: AUTOLOAD=1
    - php: 5.4
      env: AUTOLOAD=0
    - php: 5.5
      env: AUTOLOAD=1
    - php: 5.5
      env: AUTOLOAD=0
    - php: 5.6
      env: AUTOLOAD=1
    - php: 5.6
      env: AUTOLOAD=0
    - php: 7.0
      env: AUTOLOAD=1
    - php: 7.0
      env: AUTOLOAD=0
    - php: 7.1
      env: AUTOLOAD=1
    - php: 7.1
      env: AUTOLOAD=0
    - php: 7.2
      env: AUTOLOAD=1
    - php: 7.2
      env: AUTOLOAD=0
    - php: hhvm
      env: AUTOLOAD=1
    - php: hhvm
      env: AUTOLOAD=0

cache:
  directories:
    - $HOME/.composer/cache/files
    - stripe-mock

env:
  global:
    - STRIPE_MOCK_VERSION=0.5.0

before_install:
  # Unpack and start stripe-mock so that the test suite can talk to it
  - |
    if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
      mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
      curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
      tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
    fi
  - |
    stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null &
    STRIPE_MOCK_PID=$!

script: ./build.php ${AUTOLOAD}

after_script: ./vendor/bin/coveralls -v
