# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2

jobs:
  "php-7.1":
    docker:
      - image: circleci/php:7.1
    steps:
      - checkout
      - restore_cache:
          keys:
            - php71-{{ checksum "composer.json" }}
      - run: composer update -n --prefer-dist
      - save_cache:
          key: php71-{{ checksum "composer.json" }}
          paths: [./vendor]
      - run: ./vendor/bin/phpunit
  "php-7.2":
    docker:
      - image: cimg/php:7.2
    steps:
      - checkout
      - restore_cache:
          keys:
            - php72-{{ checksum "composer.json" }}
      - run: composer update -n --prefer-dist
      - save_cache:
          key: php72-{{ checksum "composer.json" }}
          paths: [./vendor]
      - run: ./vendor/bin/phpunit
  "php-7.3":
    docker:
      - image: cimg/php:7.3
    steps:
      - checkout
      - restore_cache:
          keys:
            - php73-{{ checksum "composer.json" }}
      - run: composer update -n --prefer-dist
      - save_cache:
          key: php73-{{ checksum "composer.json" }}
          paths: [./vendor]
      - run: ./vendor/bin/phpunit
  "php-7.4":
    docker:
      - image: cimg/php:7.4
    steps:
      - run: sudo apt-get update && sudo apt-get install -y php7.4-xdebug
      - checkout
      - restore_cache:
          keys:
            - php74-{{ checksum "composer.json" }}
      - run: composer update -n --prefer-dist
      - save_cache:
          key: php74-{{ checksum "composer.json" }}
          paths: [./vendor]
      - run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
      - run: ./vendor/bin/php-coveralls -o coveralls.json -x coverage.xml -vvv

workflows:
  version: 2
  unittest:
    jobs:
      - "php-7.1"
      - "php-7.2"
      - "php-7.3"
      - "php-7.4"
