Merge pull request #2279 from wallabag/cleanup-travis

Check if asset is enable instead of opposite
This commit is contained in:
Nicolas Lœuillet 2016-09-11 18:48:36 +02:00 committed by GitHub
commit 59758d8fe5
7 changed files with 80 additions and 50 deletions

View file

@ -30,9 +30,9 @@ node_js:
- "5" - "5"
env: env:
- DB=mysql ASSETS=nobuild - DB=mysql
- DB=pgsql ASSETS=nobuild - DB=pgsql
- DB=sqlite ASSETS=nobuild - DB=sqlite
matrix: matrix:
fast_finish: true fast_finish: true
@ -57,7 +57,7 @@ matrix:
group: edge group: edge
env: DB=sqlite env: DB=sqlite
- php: 7.0 - php: 7.0
env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run DB=sqlite ASSETS=nobuild env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run DB=sqlite
- php: 7.0 - php: 7.0
env: DB=sqlite ASSETS=build env: DB=sqlite ASSETS=build
allow_failures: allow_failures:
@ -77,11 +77,11 @@ before_script:
- if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
- if [[ $PHP = 5.5 ]]; then composer require "phpunit/phpunit:4.*" --no-update; fi; - if [[ $PHP = 5.5 ]]; then composer require "phpunit/phpunit:4.*" --no-update; fi;
- composer self-update --no-progress - composer self-update --no-progress
- if [[ "$DB" = "pgsql" ]]; then psql -c 'create database wallabag_test;' -U postgres; fi; - if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi;
install: install:
- if [[ $ASSETS != nobuild ]]; then source ~/.nvm/nvm.sh && nvm install 5.0; fi; - if [[ $ASSETS = build ]]; then source ~/.nvm/nvm.sh && nvm install 5.0; fi;
- if [[ $ASSETS != nobuild ]]; then npm install -g npm@latest; fi; - if [[ $ASSETS = build ]]; then npm install -g npm@latest; fi;
before_install: before_install:
- if [[ $TRAVIS_REPO_SLUG = wallabag/wallabag ]]; then cp .composer-auth.json ~/.composer/auth.json; fi; - if [[ $TRAVIS_REPO_SLUG = wallabag/wallabag ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
@ -90,5 +90,5 @@ script:
- travis_wait bash install.sh - travis_wait bash install.sh
- ant prepare-$DB - ant prepare-$DB
- phpunit -v - phpunit -v
- if [ "$CS_FIXER" = "run" ]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi; - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi;
- if [ "$VALIDATE_TRANSLATION_FILE" = "run" ]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;

View file

@ -22,7 +22,6 @@ echo '> Checking Symfony requirements:'.PHP_EOL.' ';
$messages = array(); $messages = array();
foreach ($symfonyRequirements->getRequirements() as $req) { foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
if ($helpText = get_error_message($req, $lineSize)) { if ($helpText = get_error_message($req, $lineSize)) {
echo_style('red', 'E'); echo_style('red', 'E');
$messages['error'][] = $helpText; $messages['error'][] = $helpText;
@ -121,10 +120,14 @@ function echo_block($style, $title, $message)
echo PHP_EOL.PHP_EOL; echo PHP_EOL.PHP_EOL;
echo_style($style, str_repeat(' ', $width).PHP_EOL); echo_style($style, str_repeat(' ', $width));
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); echo PHP_EOL;
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
echo_style($style, str_repeat(' ', $width).PHP_EOL); echo PHP_EOL;
echo_style($style, $message);
echo PHP_EOL;
echo_style($style, str_repeat(' ', $width));
echo PHP_EOL;
} }
function has_color_support() function has_color_support()

View file

@ -1,15 +1,8 @@
#! /usr/bin/env bash #! /usr/bin/env bash
if [[ $ASSETS == 'nobuild' ]]; then
composer install --no-interaction --no-progress --prefer-dist -o
else
echo "Installing PHP dependencies through Composer..."
if [[ $ASSETS == 'build' ]]; then if [[ $ASSETS == 'build' ]]; then
echo "Installing PHP dependencies through Composer..."
composer install --no-interaction --no-progress --prefer-dist -o composer install --no-interaction --no-progress --prefer-dist -o
else
SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
fi
chmod ugo+x vendor/mouf/nodejs-installer/bin/local/npm chmod ugo+x vendor/mouf/nodejs-installer/bin/local/npm
echo "Downloading javascript librairies through npm..." echo "Downloading javascript librairies through npm..."
@ -20,10 +13,6 @@ else
echo "Concat, minify and installing assets..." echo "Concat, minify and installing assets..."
node_modules/grunt/bin/grunt node_modules/grunt/bin/grunt
else
if [[ $ASSETS != 'build' ]]; then composer install --no-interaction --no-progress --prefer-dist -o
echo "Installing wallabag..."
php bin/console wallabag:install --env=prod
fi
fi fi

View file

@ -255,11 +255,11 @@ class PocketImport extends AbstractImport
// flush every 20 entries // flush every 20 entries
if (($i % 20) === 0) { if (($i % 20) === 0) {
$this->em->flush(); $this->em->flush();
$this->em->clear($entry);
} }
++$i; ++$i;
} }
$this->em->flush(); $this->em->flush();
$this->em->clear();
} }
} }

View file

@ -169,11 +169,11 @@ class ReadabilityImport extends AbstractImport
// flush every 20 entries // flush every 20 entries
if (($i % 20) === 0) { if (($i % 20) === 0) {
$this->em->flush(); $this->em->flush();
$this->em->clear($entry);
} }
++$i; ++$i;
} }
$this->em->flush(); $this->em->flush();
$this->em->clear();
} }
} }

View file

@ -172,12 +172,12 @@ abstract class WallabagImport extends AbstractImport
// flush every 20 entries // flush every 20 entries
if (($i % 20) === 0) { if (($i % 20) === 0) {
$this->em->flush(); $this->em->flush();
$this->em->clear($entry);
} }
++$i; ++$i;
} }
$this->em->flush(); $this->em->flush();
$this->em->clear();
} }
/** /**

View file

@ -168,6 +168,9 @@ class PhpIniRequirement extends Requirement
*/ */
class RequirementCollection implements IteratorAggregate class RequirementCollection implements IteratorAggregate
{ {
/**
* @var Requirement[]
*/
private $requirements = array(); private $requirements = array();
/** /**
@ -265,7 +268,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns both requirements and recommendations. * Returns both requirements and recommendations.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function all() public function all()
{ {
@ -275,7 +278,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns all mandatory requirements. * Returns all mandatory requirements.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getRequirements() public function getRequirements()
{ {
@ -292,7 +295,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns the mandatory requirements that were not met. * Returns the mandatory requirements that were not met.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getFailedRequirements() public function getFailedRequirements()
{ {
@ -309,7 +312,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns all optional recommendations. * Returns all optional recommendations.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getRecommendations() public function getRecommendations()
{ {
@ -326,7 +329,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns the recommendations that were not met. * Returns the recommendations that were not met.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getFailedRecommendations() public function getFailedRecommendations()
{ {
@ -376,7 +379,8 @@ class RequirementCollection implements IteratorAggregate
*/ */
class SymfonyRequirements extends RequirementCollection class SymfonyRequirements extends RequirementCollection
{ {
const REQUIRED_PHP_VERSION = '5.3.3'; const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
const REQUIRED_PHP_VERSION = '5.5.9';
/** /**
* Constructor that initializes the requirements. * Constructor that initializes the requirements.
@ -386,15 +390,25 @@ class SymfonyRequirements extends RequirementCollection
/* mandatory requirements follow */ /* mandatory requirements follow */
$installedPhpVersion = phpversion(); $installedPhpVersion = phpversion();
$requiredPhpVersion = $this->getPhpRequiredVersion();
$this->addRecommendation(
$requiredPhpVersion,
'Vendors should be installed in order to check all requirements.',
'Run the <code>composer install</code> command.',
'Run the "composer install" command.'
);
if (false !== $requiredPhpVersion) {
$this->addRequirement( $this->addRequirement(
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run. sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
Before using Symfony, upgrade your PHP installation, preferably to the latest version.', Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
$installedPhpVersion, self::REQUIRED_PHP_VERSION), $installedPhpVersion, $requiredPhpVersion),
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion) sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
); );
}
$this->addRequirement( $this->addRequirement(
version_compare($installedPhpVersion, '5.3.16', '!='), version_compare($installedPhpVersion, '5.3.16', '!='),
@ -433,7 +447,7 @@ class SymfonyRequirements extends RequirementCollection
); );
} }
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$timezones = array(); $timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) { foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) { foreach ($abbreviations as $abbreviation) {
@ -689,7 +703,7 @@ class SymfonyRequirements extends RequirementCollection
$this->addRecommendation( $this->addRecommendation(
\Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()), sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
'To avoid internationalization data incosistencies upgrade the symfony/intl component.' 'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
); );
} }
} }
@ -725,9 +739,9 @@ class SymfonyRequirements extends RequirementCollection
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->addRecommendation( $this->addRecommendation(
$this->getRealpathCacheSize() > 1000, $this->getRealpathCacheSize() > 5 * 1024 * 1024,
'realpath_cache_size should be above 1024 in php.ini', 'realpath_cache_size should be above 5242880 in php.ini',
'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.' 'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5000k</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
); );
} }
@ -778,4 +792,28 @@ class SymfonyRequirements extends RequirementCollection
return (int) $size; return (int) $size;
} }
} }
/**
* Defines PHP required version from Symfony version.
*
* @return string|false The PHP required version or false if it could not be guessed
*/
protected function getPhpRequiredVersion()
{
if (!file_exists($path = __DIR__.'/../composer.lock')) {
return false;
}
$composerLock = json_decode(file_get_contents($path), true);
foreach ($composerLock['packages'] as $package) {
$name = $package['name'];
if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
continue;
}
return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
}
return false;
}
} }