  language: php

  ##  PHP versions to test  against
  php:
      - "7.1"
      - "7.0"
      - "5.6"
      - "5.5"
      - "5.4"
      - "5.3"
  sudo: false
  dist: precise
  install:
    - export WPCS=/tmp/wpcs/
    - export PLUGIN_DIR=/tmp/plugin/
    - export PATH="$HOME/.composer/vendor/bin:$PATH"
    - mkdir -p $PLUGIN_DIR
    - mkdir -p $WPCS
    - plugin_slug=$(basename $(pwd))
    - cd ..
    - mv $plugin_slug $PLUGIN_DIR
    - cd $WPCS
    - composer global require "squizlabs/php_codesniffer=2.9.0"
    - mkdir wordpress-coding-standards && curl -L https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/archive/master.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards
    - phpenv rehash
    - phpcs --config-set installed_paths $WPCS/wordpress-coding-standards
    - phpenv rehash
    - cd $PLUGIN_DIR/$plugin_slug

  script:
    - find -L . -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l;
    - phpcs -p -s -v -n . --standard=phpcs.xml --extensions=php;