MC-34427: Cleanup travis configuration

This commit is contained in:
Maksym Aposov committed 2020-05-26 17:06:03 -05:00
1 parent 5a0911513d
commit 5a7e865d2d
13 files changed
+32 -356

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ For more detailed information on contribution please read our [beginners guide](
* Unit/integration test coverage
* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
5. All automated tests must pass.
## Contribution process
-9
View File
@@ -238,15 +238,6 @@
Require all denied
</IfVersion>
</Files>
<Files .travis.yml>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
</Files>
<Files CHANGELOG.md>
<IfVersion < 2.4>
order allow,deny
-9
View File
@@ -238,15 +238,6 @@
Require all denied
</IfVersion>
</Files>
<Files .travis.yml>
<IfVersion < 2.4>
order allow,deny
deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
</Files>
<Files CHANGELOG.md>
<IfVersion < 2.4>
order allow,deny
@@ -1,23 +0,0 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
return [
'db-host' => '127.0.0.1',
'db-user' => 'root',
'db-password' => '',
'db-name' => 'magento_integration_tests',
'db-prefix' => 'trv_',
'backend-frontname' => 'backend',
'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME,
'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD,
'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL,
'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME,
'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME,
'amqp-host' => 'localhost',
'amqp-port' => '5672',
'amqp-user' => 'guest',
'amqp-password' => 'guest',
];
@@ -2400,10 +2400,6 @@
".php_cs.dist",
".php_cs.dist"
],
[
".travis.yml",
".travis.yml"
],
[
".user.ini",
".user.ini"
@@ -2652,10 +2648,6 @@
"dev/tools",
"dev/tools"
],
[
"dev/travis",
"dev/travis"
],
[
"generated",
"generated"
@@ -2400,10 +2400,6 @@
".php_cs.dist",
".php_cs.dist"
],
[
".travis.yml",
".travis.yml"
],
[
".user.ini",
".user.ini"
@@ -2652,10 +2648,6 @@
"dev/tools",
"dev/tools"
],
[
"dev/travis",
"dev/travis"
],
[
"generated",
"generated"
@@ -32,7 +32,7 @@ class MemoryUsageTest extends \PHPUnit\Framework\TestCase
*/
public function testAppReinitializationNoMemoryLeak()
{
$this->markTestSkipped('Test fails at Travis. Skipped until MAGETWO-47111');
$this->markTestSkipped('Skipped until MAGETWO-47111');
$this->_deallocateUnusedMemory();
$actualMemoryUsage = $this->_helper->getRealMemoryUsage();
@@ -5,6 +5,9 @@
*/
namespace Magento\Phpserver;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
/**
* @magentoAppIsolation enabled
*
@@ -19,34 +22,16 @@ class PhpserverTest extends \PHPUnit\Framework\TestCase
{
const BASE_URL = '127.0.0.1:8082';
private static $serverPid;
/**
* @var Process
*/
private $serverProcess;
/**
* @var \Laminas\Http\Client
*/
private $httpClient;
/**
* Instantiate phpserver in the pub folder
*/
public static function setUpBeforeClass(): void
{
if (!(defined('TRAVIS') && TRAVIS === true)) {
self::markTestSkipped('Travis environment test');
}
$return = [];
$baseDir = __DIR__ . '/../../../../../../';
$command = sprintf(
'cd %s && php -S %s -t ./pub/ ./phpserver/router.php >/dev/null 2>&1 & echo $!',
$baseDir,
static::BASE_URL
);
// phpcs:ignore
exec($command, $return);
static::$serverPid = (int) $return[0];
}
private function getUrl($url)
{
return sprintf('http://%s/%s', self::BASE_URL, ltrim($url, '/'));
@@ -55,11 +40,33 @@ class PhpserverTest extends \PHPUnit\Framework\TestCase
protected function setUp(): void
{
$this->httpClient = new \Laminas\Http\Client(null, ['timeout' => 10]);
/** @var Process $process */
$phpBinaryFinder = new PhpExecutableFinder();
$phpBinaryPath = $phpBinaryFinder->find();
$command = sprintf(
"%s -S %s -t ./pub ./phpserver/router.php",
$phpBinaryPath,
self::BASE_URL
);
$this->serverProcess = Process::fromShellCommandline(
$command,
realpath(__DIR__ . '/../../../../../../')
);
$this->serverProcess->start();
$this->serverProcess->waitUntil(function ($type, $output) {
return strpos($output, "Development Server") !== false;
});
}
protected function tearDown(): void
{
$this->serverProcess->stop();
}
public function testServerHasPid()
{
$this->assertTrue(static::$serverPid > 0);
$this->assertTrue($this->serverProcess->getPid() > 0);
}
public function testServerResponds()
@@ -86,9 +93,4 @@ class PhpserverTest extends \PHPUnit\Framework\TestCase
$this->assertFalse($response->isClientError());
$this->assertStringStartsWith('image/gif', $response->getHeaders()->get('Content-Type')->getMediaType());
}
public static function tearDownAfterClass(): void
{
posix_kill(static::$serverPid, SIGKILL);
}
}
@@ -871,10 +871,6 @@
"LICENSE.txt",
"LICENSE.txt"
],
[
".travis.yml",
".travis.yml"
],
[
"app/bootstrap.php",
"app/bootstrap.php"
-63
View File
@@ -1,63 +0,0 @@
#!/usr/bin/env bash
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
set -e
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
# mock mail
sudo service postfix stop
echo # print a newline
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 and adjust memory limit
echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv rehash;
# If env var is present, configure support for 3rd party builds which include private dependencies
test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true
# Node.js setup via NVM
if [ $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
nvm install $NODE_JS_VERSION
nvm use $NODE_JS_VERSION
node --version
npm install -g yarn
yarn global add grunt-cli
fi
if [ $TEST_SUITE = "functional" ] || [ $TEST_SUITE = "graphql-api-functional" ]; then
# Install apache
sudo apt-get update
sudo apt-get install apache2 libapache2-mod-fastcgi
if [ ${TRAVIS_PHP_VERSION:0:1} == "7" ]; then
sudo cp ${TRAVIS_BUILD_DIR}/dev/travis/config/www.conf ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/
fi
# Enable php-fpm
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
sudo a2enmod rewrite actions fastcgi alias
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# Configure apache virtual hosts
sudo cp -f ${TRAVIS_BUILD_DIR}/dev/travis/config/apache_virtual_host /etc/apache2/sites-available/000-default.conf
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
sudo sed -e "s?%MAGENTO_HOST_NAME%?${MAGENTO_HOST_NAME}?g" --in-place /etc/apache2/sites-available/000-default.conf
sudo usermod -a -G www-data travis
sudo usermod -a -G travis www-data
phpenv config-rm xdebug.ini
sudo service apache2 restart
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -screen 0 1280x1024x24
fi
-168
View File
@@ -1,168 +0,0 @@
#!/usr/bin/env bash
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
set -e
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
# prepare for test suite
case $TEST_SUITE in
integration)
cd dev/tests/integration
test_set_list=$(find testsuite/* -maxdepth 1 -mindepth 1 -type d | sort)
test_set_count=$(printf "$test_set_list" | wc -l)
test_set_size[1]=$(printf "%.0f" $(echo "$test_set_count*0.13" | bc)) #13%
test_set_size[2]=$(printf "%.0f" $(echo "$test_set_count*0.30" | bc)) #30%
test_set_size[3]=$((test_set_count-test_set_size[1]-test_set_size[2])) #55%
echo "Total = ${test_set_count}; Batch #1 = ${test_set_size[1]}; Batch #2 = ${test_set_size[2]}; Batch #3 = ${test_set_size[3]};";
echo "==> preparing integration testsuite on index $INTEGRATION_INDEX with set size of ${test_set_size[$INTEGRATION_INDEX]}"
cp phpunit.xml.dist phpunit.xml
# remove memory usage tests if from any set other than the first
if [[ $INTEGRATION_INDEX > 1 ]]; then
echo " - removing testsuite/Magento/MemoryUsageTest.php"
perl -pi -0e 's#^\s+<!-- Memory(.*?)</testsuite>\n##ims' phpunit.xml
fi
# divide test sets up by indexed testsuites
i=0; j=1; dirIndex=1; testIndex=1;
for test_set in $test_set_list; do
test_xml[j]+=" <directory suffix=\"Test.php\">$test_set</directory>\n"
if [[ $j -eq $INTEGRATION_INDEX ]]; then
echo "$dirIndex: Batch #$j($testIndex of ${test_set_size[$j]}): + including $test_set"
else
echo "$dirIndex: Batch #$j($testIndex of ${test_set_size[$j]}): + excluding $test_set"
fi
testIndex=$((testIndex+1))
dirIndex=$((dirIndex+1))
i=$((i+1))
if [ $i -eq ${test_set_size[$j]} ] && [ $j -lt $INTEGRATION_SETS ]; then
j=$((j+1))
i=0
testIndex=1
fi
done
# replace test sets for current index into testsuite
perl -pi -e "s#\s+<directory.*>testsuite</directory>#${test_xml[INTEGRATION_INDEX]}#g" phpunit.xml
echo "==> testsuite preparation complete"
# create database and move db config into place
mysql -uroot -e '
SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION;
CREATE DATABASE magento_integration_tests;
'
mv etc/install-config-mysql.travis.php.dist etc/install-config-mysql.php
cd ../../..
;;
static)
cd dev/tests/static
echo "==> preparing changed files list"
changed_files_ce="$TRAVIS_BUILD_DIR/dev/tests/static/testsuite/Magento/Test/_files/changed_files_ce.txt"
php get_github_changes.php \
--output-file="$changed_files_ce" \
--base-path="$TRAVIS_BUILD_DIR" \
--repo='https://github.com/magento/magento2.git' \
--branch="$TRAVIS_BRANCH"
sed 's/^/ + including /' "$changed_files_ce"
cd ../../..
;;
js)
cp package.json.sample package.json
cp Gruntfile.js.sample Gruntfile.js
yarn
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"
mysql -uroot -e 'CREATE DATABASE magento2;'
php bin/magento setup:install -q \
--language="en_US" \
--timezone="UTC" \
--currency="USD" \
--base-url="http://${MAGENTO_HOST_NAME}/" \
--admin-firstname="John" \
--admin-lastname="Doe" \
--backend-frontname="backend" \
--admin-email="admin@example.com" \
--admin-user="admin" \
--use-rewrites=1 \
--admin-use-security-key=0 \
--admin-password="123123q"
echo "Enabling production mode"
php bin/magento deploy:mode:set production
echo "Prepare functional tests for running"
cd dev/tests/functional
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 &
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?g" --in-place ./phpunit.xml
cp ./.htaccess.sample ./.htaccess
cd ./utils
php -f generate/moduleSequence.php
php -f mtf troubleshooting:check-all
cd ../../..
;;
graphql-api-functional)
echo "Installing Magento"
mysql -uroot -e 'CREATE DATABASE magento2;'
php bin/magento setup:install -q \
--language="en_US" \
--timezone="UTC" \
--currency="USD" \
--base-url="http://${MAGENTO_HOST_NAME}/" \
--admin-firstname="John" \
--admin-lastname="Doe" \
--backend-frontname="backend" \
--admin-email="admin@example.com" \
--admin-user="admin" \
--use-rewrites=1 \
--admin-use-security-key=0 \
--admin-password="123123q"
echo "Prepare api-functional tests for running"
cd dev/tests/api-functional
cp -r _files/Magento/TestModuleGraphQl* ../../../app/code/Magento # Deploy and enable test modules before running tests
cp ./phpunit_graphql.xml.dist ./phpunit.xml
sed -e "s?magento.url?${MAGENTO_HOST_NAME}?g" --in-place ./phpunit.xml
cd ../../..
php bin/magento setup:upgrade
echo "Enabling production mode"
php bin/magento deploy:mode:set production
;;
esac
-20
View File
@@ -1,20 +0,0 @@
<VirtualHost *:80>
DocumentRoot %TRAVIS_BUILD_DIR%
ServerName %MAGENTO_HOST_NAME%
<Directory "%TRAVIS_BUILD_DIR%">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Require all granted
</Directory>
<IfModule mod_fastcgi.c>
AddHandler php7-fcgi .php
Action php7-fcgi /php7-fcgi
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -host 127.0.0.1:9000 -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
</IfModule>
</VirtualHost>
-14
View File
@@ -1,14 +0,0 @@
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
chdir = /