diff --git a/.travis.yml b/.travis.yml index e477e56500b7a..649762d8e9f3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,11 +22,12 @@ env: - MAGENTO_HOST_NAME="magento2.travis" matrix: - TEST_SUITE=unit + - TEST_SUITE=static + - TEST_SUITE=js GRUNT_COMMAND=spec + - TEST_SUITE=js GRUNT_COMMAND=static - TEST_SUITE=integration INTEGRATION_INDEX=1 - TEST_SUITE=integration INTEGRATION_INDEX=2 - TEST_SUITE=integration INTEGRATION_INDEX=3 - - TEST_SUITE=static - - TEST_SUITE=js - TEST_SUITE=functional ACCEPTANCE_INDEX=1 - TEST_SUITE=functional ACCEPTANCE_INDEX=2 matrix: @@ -34,7 +35,9 @@ matrix: - php: 7.0 env: TEST_SUITE=static - php: 7.0 - env: TEST_SUITE=js + env: TEST_SUITE=js GRUNT_COMMAND=spec + - php: 7.0 + env: TEST_SUITE=js GRUNT_COMMAND=static - php: 7.0 env: TEST_SUITE=functional ACCEPTANCE_INDEX=1 - php: 7.0 @@ -49,4 +52,11 @@ cache: before_install: ./dev/travis/before_install.sh install: composer install --no-interaction --prefer-dist before_script: ./dev/travis/before_script.sh -script: ./dev/travis/script.sh +script: + # Set arguments for variants of phpunit based tests; '|| true' prevents failing script when leading test fails + - test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true + - test $TEST_SUITE = "functional" && TEST_FILTER='dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests.php' || true + + # The scripts for grunt/phpunit type tests + - if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi + - if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi diff --git a/dev/travis/before_install.sh b/dev/travis/before_install.sh index 5cf8c38cf16cd..63e1059f18abf 100755 --- a/dev/travis/before_install.sh +++ b/dev/travis/before_install.sh @@ -21,7 +21,7 @@ phpenv rehash; test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true # Node.js setup via NVM -if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then +if [ test $TEST_SUITE == "js" ]; then curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/dev/travis/before_script.sh b/dev/travis/before_script.sh index 2576be6e14094..7f6ef4f91ff48 100755 --- a/dev/travis/before_script.sh +++ b/dev/travis/before_script.sh @@ -75,22 +75,26 @@ case $TEST_SUITE in cat "$changed_files_ce" | sed 's/^/ + including /' cd ../../.. - - cp package.json.sample package.json - cp Gruntfile.js.sample Gruntfile.js - yarn ;; js) cp package.json.sample package.json cp Gruntfile.js.sample Gruntfile.js yarn - echo "Installing Magento" - mysql -uroot -e 'CREATE DATABASE magento2;' - php bin/magento setup:install -q --admin-user="admin" --admin-password="123123q" --admin-email="admin@example.com" --admin-firstname="John" --admin-lastname="Doe" - - echo "Deploying Static Content" - php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify + if [[ $GRUNT_COMMAND != "static" ]]; then + echo "Installing Magento" + mysql -uroot -e 'CREATE DATABASE magento2;' + php bin/magento setup:install -q \ + --admin-user="admin" \ + --admin-password="123123q" \ + --admin-email="admin@example.com" \ + --admin-firstname="John" \ + --admin-lastname="Doe" + + echo "Deploying Static Content" + php bin/magento setup:static-content:deploy -f -q -j=2 \ + --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify + fi ;; functional) echo "Installing Magento" @@ -117,7 +121,9 @@ case $TEST_SUITE in composer install && composer require se/selenium-server-standalone:2.53.1 export DISPLAY=:1.0 - sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 -Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log & + sh ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone -port 4444 -host 127.0.0.1 \ + -Dwebdriver.firefox.bin=$(which firefox) -trustAllSSLCertificate &> ~/selenium.log & + cp ./phpunit.xml.dist ./phpunit.xml sed -e "s?127.0.0.1?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml sed -e "s?basic?travis_acceptance_${ACCEPTANCE_INDEX}?g" --in-place ./phpunit.xml diff --git a/dev/travis/script.sh b/dev/travis/script.sh deleted file mode 100755 index 9df242a367ba5..0000000000000 --- a/dev/travis/script.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -# Copyright © Magento, Inc. All rights reserved. -# See COPYING.txt for license details. - -case $TEST_SUITE in - static) - TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true - phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER - grunt static - ;; - js) - grunt spec - ;; - functional) - cd dev/tests/functional - vendor/phpunit/phpunit/phpunit -c phpunit.xml --debug testsuites/Magento/Mtf/TestSuite/InjectableTests.php - ;; - *) - phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; - ;; -esac