Skip to content
Snippets Groups Projects
Commit d2884f06 authored by David Alger's avatar David Alger
Browse files

Refactored travis scripts out of main travis config file

parent 00b7046b
No related merge requests found
...@@ -32,46 +32,8 @@ matrix: ...@@ -32,46 +32,8 @@ matrix:
env: TEST_SUITE=static_annotation env: TEST_SUITE=static_annotation
- php: 7.0 - php: 7.0
env: TEST_SUITE=static_phpcs env: TEST_SUITE=static_phpcs
- php: 7.0 - php:
env: TEST_SUITE=static_annotation env: TEST_SUITE=static_annotation
before_install: before_install: ./dev/travis/before_install.sh
- sh -c 'if [ "$CASHER_DIR" ]; then before_script: ./dev/travis/before_script.sh
if [ -x $HOME/.cache/bin/composer ]; then script: ./dev/travis/script.sh
$HOME/.cache/bin/composer self-update; echo '';
else
mkdir -p $HOME/.cache/bin;
curl --connect-timeout 30 -sS https://getcomposer.org/installer
| php -- --install-dir $HOME/.cache/bin/ --filename composer;
fi
fi'
- export PATH="$HOME/.cache/bin:$PATH"
before_script:
# Mock mail
- sudo service postfix stop
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
- echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
# Disable xDebug
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
# Create DB for integration tests
- >
sh -c "if [ '$TEST_SUITE' = 'integration_part_1' ] || [ '$TEST_SUITE' = 'integration_part_2' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then
mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_integration_tests;';
mv dev/tests/integration/etc/install-config-mysql.travis.php.dist dev/tests/integration/etc/install-config-mysql.php;
fi"
# Change memory_limit for travis
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- phpenv rehash;
- composer install --no-interaction --prefer-dist
script:
# Unit tests
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist; fi"
# Integration tests
- sh -c "if [ '$TEST_SUITE' = 'integration_part_1' ] || [ '$TEST_SUITE' = 'integration_part_2' ]; then cd dev/tests/integration/; bash IntegationTestsForTravis.sh 2; fi"
- sh -c "if [ '$TEST_SUITE' = 'integration_part_1' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.travis1; fi"
- sh -c "if [ '$TEST_SUITE' = 'integration_part_2' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.travis2; fi"
# Integration integrity tests
- sh -c "if [ '$TEST_SUITE' = 'integration_integrity' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.dist testsuite/Magento/Test/Integrity; fi"
# Static tests [Code Style]
- sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testCodeStyle'; fi"
# Static tests [Code Style]
- sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi"
#!/usr/bin/env bash
# Copyright © 2015 Magento. All rights reserved.
# See COPYING.txt for license details.
# install or update composer in casher dir
if [ "$CASHER_DIR" ]; then
if [ -x $HOME/.cache/bin/composer ]; then
$HOME/.cache/bin/composer self-update
else
mkdir -p $HOME/.cache/bin
curl --connect-timeout 30 -sS https://getcomposer.org/installer \
| php -- --install-dir $HOME/.cache/bin/ --filename composer
fi
fi
#!/usr/bin/env bash
# Copyright © 2015 Magento. All rights reserved.
# See COPYING.txt for license details.
# prefer our cached binaries
export PATH="$HOME/.cache/bin:$PATH"
# mock mail
sudo service postfix stop
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/sendmail.ini
# disable xDebug
echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
# create database for integration tests
case $TEST_SUITE in
integration_part_1|integration_part_2)
./dev/tests/integration/IntegationTestsForTravis.sh 2
;& # intentional fallthrough
integration_integrity)
mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_integration_tests;'
mv dev/tests/integration/etc/install-config-mysql.travis.php.dist \
dev/tests/integration/etc/install-config-mysql.php
;;
esac
# change memory_limit for travis
echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv rehash;
# install deps
composer install --no-interaction --prefer-dist
#!/usr/bin/env bash
# Copyright © 2015 Magento. All rights reserved.
# See COPYING.txt for license details.
PATH="./../../../vendor/bin:$PATH"
case $TEST_SUITE in
unit)
cd dev/tests/unit
phpunit -c phpunit.xml.dist
;;
integration_part_1)
cd dev/tests/integration
phpunit -c phpunit.xml.travis1
;;
integration_part_2)
cd dev/tests/integration
phpunit -c phpunit.xml.travis2
;;
integration_integrity)
cd dev/tests/integration
phpunit -c phpunit.xml.dist testsuite/Magento/Test/Integrity
;;
static_phpcs)
cd dev/tests/static
phpunit -c phpunit.xml.dist --filter 'Magento\\Test\\Php\\LiveCodeTest::testCodeStyle'
;;
static_annotation)
cd dev/tests/static
phpunit -c phpunit.xml.dist --filter 'Magento\\Test\\Php\\LiveCodeTest::testAnnotationStandard'
;;
esac
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment