---
version: 2.1
executors:
  php-5_6:
    docker:
      - image: circleci/php:5.6
        auth:
          username: $DOCKERHUB_USERNAME
          password: $DOCKERHUB_TOKEN
  php-7_2:
    docker:
      - image: circleci/php:7.2
        auth:
          username: $DOCKERHUB_USERNAME
          password: $DOCKERHUB_TOKEN
jobs:
  tests-5_6:
    executor: php-5_6
    working_directory: ~/ecommerce_module_core
    steps:
      - checkout
      - run:
          name: Enable PHP modules
          command: sudo -E docker-php-ext-install mysqli zip pdo pdo_mysql
      - run:
          name: Execute composer install
          command: composer install
      - run:
          name: Run tests
          command: php vendor/bin/phpunit --configuration phpunit.xml
  tests-7_2:
    executor: php-7_2
    working_directory: ~/ecommerce_module_core
    steps:
      - checkout
      - run:
          name: Enable PHP modules
          command: sudo -E docker-php-ext-install mysqli zip pdo pdo_mysql
      - run:
          name: Execute composer install
          command: composer install
      - run:
          name: Run tests
          command: php vendor/bin/phpunit --configuration phpunit.xml

workflows:
  version: 2.1
  ecommerce_module_core:
    jobs:
      - tests-5_6:
          context:
            - packlink-dockerhub
          filters:
            tags:
              only: /.*/
      - tests-7_2:
          context:
            - packlink-dockerhub
          filters:
            tags:
              only: /.*/
