dist: trusty

language: php

sudo: false

php:
    - 5.6
    - 7.0

env:
    matrix:
        - TEST_SUITE=unit
        - TEST_SUITE=static

matrix:
    exclude:
        - php: 7.0
          env: TEST_SUITE=static

cache:
    directories:
        - $HOME/.composer/cache

install:
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer install --prefer-dist; fi"
    - sh -c "if [ '$TEST_SUITE' = 'static' ]; then npm install; fi"

script:
  - wget https://gist.githubusercontent.com/cdiacon/457f0e09fb936e5cc859/raw/a9d46ee07b550b9a742a3cb418c28b5d49b1753b/auth.json
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpdoc run -d Block,Helper,Model,Observer -t build/doc; fi"
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpcs; fi"
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpmd Block/,Helper/,Model/,Observer/,Test/ text cleancode,codesize,controversial,design,naming,unusedcode; fi"
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpcpd Block/ Helper/ Model/ Observer/ Test/; fi"
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi"
    - sh -c "if [ '$TEST_SUITE' = 'static' ]; then ./node_modules/.bin/grunt ci; fi"

after_script:
    - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/coveralls; fi"
