1

I've some modules to Magento 2.0 and 2.1, so I'd like to implement the Travis CLI to install the Magento and test my extension in some Magento versions and PHP versions, how can I do that?

Thanks

2
  • Did you get something on this ? If yes could you please share :)
    – Keyur Shah
    Commented Oct 23, 2017 at 14:47
  • @KeyurShah I answered it now :) Commented Oct 24, 2017 at 18:11

1 Answer 1

1

You can create your file .travis.yml like that example:

dist: trusty
language: php
php:
  - 5.6
  - 7.0

env:
  - TEST_SUITE=unit
  - TEST_SUITE=phpcs
  - TEST_SUITE=marketplaceeqp

before_script:
  - sleep 60

script:
  - wget https://github.com/magento/magento2/archive/2.0.2.zip
  - unzip -qq 2.0.2.zip
  - cd magento2-2.0.2/
  - wget https://gist.githubusercontent.com/centerax/5e42abec89d62a1308ba/raw/4b3242361c0690e234266afb3520c2940ac1055a/auth.json
  - composer require --prefer-source --no-interaction ebizmarts/magento2-magemonkey:dev-develop
  - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then /bin/cp ../phpunit_config.xml dev/tests/unit/ && ./vendor/bin/phpunit -c dev/tests/unit/phpunit_config.xml --coverage-text; fi"
  - sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer require --prefer-source --no-interaction "squizlabs/php_codesniffer=*" magento-ecg/coding-standard && vendor/squizlabs/php_codesniffer/scripts/phpcs --config-set installed_paths vendor/magento-ecg/coding-standard && ./vendor/squizlabs/php_codesniffer/scripts/phpcs -n --standard="EcgM2" ./vendor/ebizmarts/magento2-magemonkey/; fi"
  - sh -c "if [ '$TEST_SUITE' = 'marketplaceeqp' ]; then composer require --prefer-source --no-interaction squizlabs/php_codesniffer magento/marketplace-eqp && vendor/squizlabs/php_codesniffer/scripts/phpcs --config-set installed_paths vendor/magento/marketplace-eqp && ./vendor/squizlabs/php_codesniffer/scripts/phpcs -n --standard="MEQP2" ./vendor/ebizmarts/magento2-magemonkey/; fi"
2
  • How you are running this I mean from cmd ?
    – Keyur Shah
    Commented Oct 24, 2017 at 18:41
  • You need to change the values to your extension, but to run using the cmd you need to filter the command and run the last 3 lines. Commented Oct 25, 2017 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.