# 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: aimeos/ci-php:7.1
    steps:
      - checkout
      - run: git clone --depth=50 --branch=2021.04 git://github.com/aimeos/aimeos-core.git ../aimeos-core
      - run: cd .. && mv project aimeos-core/ext/ai-gettext && mv aimeos-core project && cd project
      - 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/phing -Ddir=ext/ai-gettext testext

  "php-7.2":
    docker:
      - image: aimeos/ci-php:7.2
    steps:
      - checkout
      - run: git clone --depth=50 --branch=2021.04 git://github.com/aimeos/aimeos-core.git ../aimeos-core
      - run: cd .. && mv project aimeos-core/ext/ai-gettext && mv aimeos-core project && cd project
      - 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/phing -Ddir=ext/ai-gettext testext checkext

  "php-7.3":
    docker:
      - image: aimeos/ci-php:7.3
    steps:
      - checkout
      - run: git clone --depth=50 --branch=2021.04 git://github.com/aimeos/aimeos-core.git ../aimeos-core
      - run: cd .. && mv project aimeos-core/ext/ai-gettext && mv aimeos-core project && cd project
      - 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/phing -Ddir=ext/ai-gettext testext

  "php-7.4":
    docker:
      - image: aimeos/ci-php:7.4
    steps:
      - checkout
      - run: git clone --depth=50 --branch=2021.04 git://github.com/aimeos/aimeos-core.git ../aimeos-core
      - run: cd .. && mv project aimeos-core/ext/ai-gettext && mv aimeos-core project && cd project
      - 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/phing -Ddir=ext/ai-gettext coverageext
      - run: ./vendor/bin/php-coveralls -x ext/ai-gettext/lib/custom/tests/coverage.xml -vvv

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