Fixes
This commit is contained in:
parent
8e970853f6
commit
ca2f5ed197
30 changed files with 181 additions and 338 deletions
|
|
@ -41,6 +41,7 @@ class InstallCommand extends Command
|
|||
->setName('phpci:install')
|
||||
->addOption('url', null, InputOption::VALUE_OPTIONAL, Lang::get('installation_url'))
|
||||
->addOption('db-host', null, InputOption::VALUE_OPTIONAL, Lang::get('db_host'))
|
||||
->addOption('db-port', null, InputOption::VALUE_OPTIONAL, Lang::get('db_port'))
|
||||
->addOption('db-name', null, InputOption::VALUE_OPTIONAL, Lang::get('db_name'))
|
||||
->addOption('db-user', null, InputOption::VALUE_OPTIONAL, Lang::get('db_user'))
|
||||
->addOption('db-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('db_pass'))
|
||||
|
|
@ -293,6 +294,10 @@ class InstallCommand extends Command
|
|||
$dbHost = $dialog->ask($output, Lang::get('enter_db_host'), 'localhost');
|
||||
}
|
||||
|
||||
if (!$dbPort = $input->getOption('db-port')) {
|
||||
$dbPort = $dialog->ask($output, Lang::get('enter_db_port'), '3306');
|
||||
}
|
||||
|
||||
if (!$dbName = $input->getOption('db-name')) {
|
||||
$dbName = $dialog->ask($output, Lang::get('enter_db_name'), 'phpci');
|
||||
}
|
||||
|
|
@ -305,11 +310,12 @@ class InstallCommand extends Command
|
|||
$dbPass = $dialog->askHiddenResponse($output, Lang::get('enter_db_pass'));
|
||||
}
|
||||
|
||||
$db['servers']['read'] = $dbHost;
|
||||
$db['servers']['read'] = $dbHost;
|
||||
$db['servers']['write'] = $dbHost;
|
||||
$db['name'] = $dbName;
|
||||
$db['username'] = $dbUser;
|
||||
$db['password'] = $dbPass;
|
||||
$db['port'] = $dbPort;
|
||||
$db['name'] = $dbName;
|
||||
$db['username'] = $dbUser;
|
||||
$db['password'] = $dbPass;
|
||||
|
||||
return $db;
|
||||
}
|
||||
|
|
@ -324,7 +330,7 @@ class InstallCommand extends Command
|
|||
{
|
||||
try {
|
||||
$pdo = new PDO(
|
||||
'mysql:host='.$db['servers']['write'].';dbname='.$db['name'],
|
||||
'mysql:host='.$db['servers']['write'].';port='.$db['port'].'dbname='.$db['name'],
|
||||
$db['username'],
|
||||
$db['password'],
|
||||
[
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ class ProjectController extends PHPCI\Controller
|
|||
|
||||
if ($values['type'] == "gitlab") {
|
||||
$accessInfo = $project->getAccessInformation();
|
||||
$reference = $accessInfo["user"].'@'.$accessInfo["domain"].':' . $project->getReference().".git";
|
||||
$reference = $accessInfo["user"].'@'.$accessInfo["domain"].':' . $accessInfo["port"] . '/' . ltrim($project->getReference(), '/') . ".git";
|
||||
$values['reference'] = $reference;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,7 +293,14 @@ class WebhookController extends \b8\Controller
|
|||
$url = $payload['pull_request']['commits_url'];
|
||||
$http = new \b8\HttpClient();
|
||||
$http->setHeaders($headers);
|
||||
$response = $http->get($url);
|
||||
|
||||
//for large pull requests, allow grabbing more then the default number of commits
|
||||
$custom_per_page = \b8\Config::getInstance()->get('phpci.github.per_page');
|
||||
$params = [];
|
||||
if ($custom_per_page) {
|
||||
$params["per_page"] = $custom_per_page;
|
||||
}
|
||||
$response = $http->get($url, $params);
|
||||
|
||||
// Check we got a success response:
|
||||
if (!$response['success']) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class Lang
|
|||
{
|
||||
if (in_array($language, self::$languages)) {
|
||||
self::$language = $language;
|
||||
self::$strings = self::loadLanguage();
|
||||
self::$strings = self::loadLanguage();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -177,12 +177,11 @@ class Lang
|
|||
return null;
|
||||
}
|
||||
|
||||
$strings = include_once($langFile);
|
||||
|
||||
$strings = include($langFile);
|
||||
if (is_null($strings) || !is_array($strings) || !count($strings)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return $strings;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ PHPCI',
|
|||
'enter_phpci_url' => 'Your PHPCI URL ("http://phpci.local" for example): ',
|
||||
|
||||
'enter_db_host' => 'Please enter your MySQL host [localhost]: ',
|
||||
'enter_db_port' => 'Please enter your MySQL port [3306]: ',
|
||||
'enter_db_name' => 'Please enter your MySQL database name [phpci]: ',
|
||||
'enter_db_user' => 'Please enter your MySQL username [phpci]: ',
|
||||
'enter_db_pass' => 'Please enter your MySQL password: ',
|
||||
|
|
@ -449,6 +450,4 @@ PHPCI',
|
|||
'php_unit' => 'PHP Unit',
|
||||
'php_cpd' => 'PHP Copy/Paste Detector',
|
||||
'php_docblock_checker' => 'PHP Docblock Checker',
|
||||
'behat' => 'Behat',
|
||||
'technical_debt' => 'Technical Debt',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -152,6 +152,9 @@ PHPCI',
|
|||
<a href="https://bitbucket.org/%s/admin/services">
|
||||
Services</a> de votre dépôt Bitbucket.',
|
||||
|
||||
'errors' => 'Erreurs',
|
||||
'information' => 'Informations',
|
||||
|
||||
// View Build
|
||||
'build_x_not_found' => 'Le Build avec l\'ID %d n\'existe pas.',
|
||||
'build_n' => 'Build %d',
|
||||
|
|
@ -187,6 +190,7 @@ PHPCI',
|
|||
'phpmd' => 'PHP Mess Detector',
|
||||
'phpspec' => 'PHP Spec',
|
||||
'phpunit' => 'PHP Unit',
|
||||
'behat' => 'Behat',
|
||||
|
||||
'file' => 'Fichier',
|
||||
'line' => 'Ligne',
|
||||
|
|
@ -406,5 +410,11 @@ PHPCI',
|
|||
'build_file_missing' => 'Le fichier de build spécifié n\'existe pas.',
|
||||
'property_file_missing' => 'Le fichier de propriété spécifié n\'existe pas.',
|
||||
'could_not_process_report' => 'Impossible de traiter le rapport généré par cet outil.',
|
||||
'shell_not_enabled' => 'Le plugn shell n\'est pas activé. Merci de l\'activer via le fichier config.yml.'
|
||||
'shell_not_enabled' => 'Le plugn shell n\'est pas activé. Merci de l\'activer via le fichier config.yml.',
|
||||
|
||||
// Error Levels:
|
||||
'critical' => 'Critique',
|
||||
'high' => 'Haut',
|
||||
'normal' => 'Normal',
|
||||
'low' => 'Base',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -158,6 +158,8 @@ PHPCI',
|
|||
'group_save' => 'Сохранить группу',
|
||||
|
||||
// View Build
|
||||
'errors' => 'Ошибки',
|
||||
'information' => 'Информация',
|
||||
'build_x_not_found' => 'Сборки с ID %d не существует.',
|
||||
'build_n' => 'Сборка %d',
|
||||
'rebuild_now' => 'Пересобрать сейчас',
|
||||
|
|
@ -215,8 +217,8 @@ PHPCI',
|
|||
'build_created' => 'Сборка создана',
|
||||
'build_started' => 'Сборка запущена',
|
||||
'build_finished' => 'Сборка окончена',
|
||||
'test_message' => 'Message',
|
||||
'test_no_message' => 'No message',
|
||||
'test_message' => 'Сообщение',
|
||||
'test_no_message' => 'Нет сообщений',
|
||||
'test_success' => 'Успешно: %d',
|
||||
'test_fail' => 'Провалено: %d',
|
||||
'test_skipped' => 'Пропущено: %d',
|
||||
|
|
@ -336,6 +338,7 @@ PHPCI',
|
|||
'enter_phpci_url' => 'URL-адрес вашего PHPCI (например: "http://phpci.local"): ',
|
||||
|
||||
'enter_db_host' => 'Пожалуйста, введите хост MySQL [localhost]: ',
|
||||
'enter_db_port' => 'Пожалуйста, введите порт MySQL [3306]: ',
|
||||
'enter_db_name' => 'Пожалуйста, введите имя базы данных MySQL [phpci]: ',
|
||||
'enter_db_user' => 'Пожалуйста, введите пользователя MySQL [phpci]: ',
|
||||
'enter_db_pass' => 'Пожалуйста, введите пароль MySQL: ',
|
||||
|
|
@ -418,5 +421,18 @@ PHPCI',
|
|||
'build_file_missing' => 'Указанного файла сборки не существует.',
|
||||
'property_file_missing' => 'Указанного файла сборки не существует.',
|
||||
'could_not_process_report' => 'Невозможно обработать отчет этой утилиты.',
|
||||
'shell_not_enabled' => 'Плагин shell не включен. Пожалуйста, включите его в файле config.yml.'
|
||||
'shell_not_enabled' => 'Плагин shell не включен. Пожалуйста, включите его в файле config.yml.',
|
||||
|
||||
// Error Levels:
|
||||
'critical' => 'Критичный',
|
||||
'high' => 'Высокий',
|
||||
'normal' => 'Нормальный',
|
||||
'low' => 'Низкий',
|
||||
|
||||
// Plugins that generate errors:
|
||||
'php_mess_detector' => 'PHP Mess Detector',
|
||||
'php_code_sniffer' => 'PHP Code Sniffer',
|
||||
'php_unit' => 'PHP Unit',
|
||||
'php_cpd' => 'PHP Copy/Paste Detector',
|
||||
'php_docblock_checker' => 'PHP Docblock Checker',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class FixDatabaseColumns extends AbstractMigration
|
|||
$build->changeColumn('project_id', 'integer', ['null' => false]);
|
||||
$build->changeColumn('commit_id', 'string', ['limit' => 50, 'null' => false]);
|
||||
$build->changeColumn('status', 'integer', ['null' => false]);
|
||||
$build->changeColumn('log', 'text', ['null' => true, 'default' => '']);
|
||||
$build->changeColumn('log', 'text', ['null' => true]);
|
||||
$build->changeColumn('branch', 'string', ['limit' => 50, 'null' => false, 'default' => 'master']);
|
||||
$build->changeColumn('created', 'datetime', ['null' => true]);
|
||||
$build->changeColumn('started', 'datetime', ['null' => true]);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class ArchiveProject extends AbstractMigration
|
|||
public function up()
|
||||
{
|
||||
$project = $this->table('project');
|
||||
$project->addColumn('archived', 'boolean');
|
||||
$project->addColumn('archived', 'boolean', ['default' => 0]);
|
||||
$project->save();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@ class FixColumnTypes extends AbstractMigration
|
|||
// Update the build log column to MEDIUMTEXT:
|
||||
$build = $this->table('build');
|
||||
$build->changeColumn('log', 'text', [
|
||||
'null' => true,
|
||||
'default' => '',
|
||||
'limit' => MysqlAdapter::TEXT_MEDIUM,
|
||||
'null' => true,
|
||||
'limit' => MysqlAdapter::TEXT_MEDIUM,
|
||||
]);
|
||||
|
||||
// Update the build meta value column to MEDIUMTEXT:
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ConvertErrors extends AbstractMigration
|
|||
$this->processPhpCpdMeta($meta);
|
||||
break;
|
||||
|
||||
case 'technicaldebt-data':
|
||||
case 'technical_debt-data':
|
||||
$this->processTechnicalDebtMeta($meta);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
24
src/PHPCI/Migrations/20160425162114_branch_column_length.php
Normal file
24
src/PHPCI/Migrations/20160425162114_branch_column_length.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
class BranchColumnLength extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$table = $this->table('build');
|
||||
$table->changeColumn('branch', 'string', ['limit' => 250, 'null' => false, 'default' => 'master']);
|
||||
|
||||
$table = $this->table('project');
|
||||
$table->changeColumn('branch', 'string', ['limit' => 250, 'null' => false, 'default' => 'master']);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$table = $this->table('build');
|
||||
$table->changeColumn('branch', 'string', ['limit' => 50, 'null' => false, 'default' => 'master']);
|
||||
|
||||
$table = $this->table('project');
|
||||
$table->changeColumn('branch', 'string', ['limit' => 50, 'null' => false, 'default' => 'master']);
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ class BuildBase extends Model
|
|||
],
|
||||
'branch' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'length' => 250,
|
||||
'default' => 'master',
|
||||
],
|
||||
'created' => [
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class ProjectBase extends Model
|
|||
],
|
||||
'branch' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'length' => 250,
|
||||
'default' => 'master',
|
||||
],
|
||||
'ssh_private_key' => [
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
protected $phpci;
|
||||
protected $build;
|
||||
protected $nodev;
|
||||
protected $ignorePlatformReqs;
|
||||
protected $preferSource;
|
||||
|
||||
/**
|
||||
* Check if this plugin can be executed.
|
||||
|
|
@ -55,14 +57,15 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
*/
|
||||
public function __construct(Builder $phpci, Build $build, array $options = [])
|
||||
{
|
||||
$path = $phpci->buildPath;
|
||||
$this->phpci = $phpci;
|
||||
$this->build = $build;
|
||||
$this->directory = $path;
|
||||
$this->action = 'install';
|
||||
$this->preferDist = false;
|
||||
$this->preferSource = false;
|
||||
$this->nodev = false;
|
||||
$path = $phpci->buildPath;
|
||||
$this->phpci = $phpci;
|
||||
$this->build = $build;
|
||||
$this->directory = $path;
|
||||
$this->action = 'install';
|
||||
$this->preferDist = false;
|
||||
$this->preferSource = false;
|
||||
$this->nodev = false;
|
||||
$this->ignorePlatformReqs = false;
|
||||
|
||||
if (array_key_exists('directory', $options)) {
|
||||
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
|
||||
|
|
@ -84,6 +87,10 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
if (array_key_exists('no_dev', $options)) {
|
||||
$this->nodev = (bool)$options['no_dev'];
|
||||
}
|
||||
|
||||
if (array_key_exists('ignore_platform_reqs', $options)) {
|
||||
$this->ignorePlatformReqs = (bool)$options['ignore_platform_reqs'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -116,6 +123,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
$cmd .= ' --no-dev';
|
||||
}
|
||||
|
||||
if ($this->ignorePlatformReqs) {
|
||||
$this->phpci->log('Using --ignore-platform-reqs flag');
|
||||
$cmd .= ' --ignore-platform-reqs';
|
||||
}
|
||||
|
||||
$cmd .= ' --working-dir="%s" %s';
|
||||
|
||||
return $this->phpci->executeCommand($cmd, $this->directory, $this->action);
|
||||
|
|
|
|||
|
|
@ -146,8 +146,10 @@ class Mysql implements \PHPCI\Plugin
|
|||
|
||||
/**
|
||||
* Builds the MySQL import command required to import/execute the specified file
|
||||
*
|
||||
* @param string $import_file Path to file, relative to the build root
|
||||
* @param string $database If specified, this database is selected before execution
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getImportCommand($import_file, $database = null)
|
||||
|
|
@ -168,9 +170,10 @@ class Mysql implements \PHPCI\Plugin
|
|||
':decomp_cmd' => $decomp_cmd,
|
||||
':host' => escapeshellarg($this->host),
|
||||
':user' => escapeshellarg($this->user),
|
||||
':pass' => escapeshellarg($this->pass),
|
||||
':pass' => (!$this->pass) ? '' : '-p' . escapeshellarg($this->pass),
|
||||
':database' => ($database === null)? '': escapeshellarg($database),
|
||||
];
|
||||
return strtr('cat :import_file :decomp_cmd | mysql -h:host -u:user -p:pass :database', $args);
|
||||
|
||||
return strtr('cat :import_file :decomp_cmd | mysql -h:host -u:user :pass :database', $args);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Codeception implements ParserInterface
|
|||
*/
|
||||
public function __construct(Builder $phpci, $resultsXml)
|
||||
{
|
||||
$this->phpci = $phpci;
|
||||
$this->phpci = $phpci;
|
||||
$this->resultsXml = $resultsXml;
|
||||
$this->totalTests = 0;
|
||||
}
|
||||
|
|
@ -38,44 +38,43 @@ class Codeception implements ParserInterface
|
|||
*/
|
||||
public function parse()
|
||||
{
|
||||
$rtn = [];
|
||||
|
||||
$rtn = [];
|
||||
$this->results = new \SimpleXMLElement($this->resultsXml);
|
||||
|
||||
// calculate total results
|
||||
foreach ($this->results->testsuite as $testsuite) {
|
||||
$this->totalTests += (int) $testsuite['tests'];
|
||||
$this->totalTimeTaken += (float) $testsuite['time'];
|
||||
$this->totalFailures += (int) $testsuite['failures'];
|
||||
$this->totalErrors += (int) $testsuite['errors'];
|
||||
foreach ($this->results->testsuite as $test_suite) {
|
||||
$this->totalTests += (int)$test_suite['tests'];
|
||||
$this->totalTimeTaken += (float)$test_suite['time'];
|
||||
$this->totalFailures += (int)$test_suite['failures'];
|
||||
$this->totalErrors += (int)$test_suite['errors'];
|
||||
|
||||
foreach ($testsuite->testcase as $testcase) {
|
||||
$testresult = [
|
||||
'suite' => (string) $testsuite['name'],
|
||||
'file' => str_replace($this->phpci->buildPath, '/', (string) $testcase['file']),
|
||||
'name' => (string) $testcase['name'],
|
||||
'feature' => (string) $testcase['feature'],
|
||||
'assertions' => (int) $testcase['assertions'],
|
||||
'time' => (float) $testcase['time']
|
||||
foreach ($test_suite->testcase as $test_case) {
|
||||
$test_result = [
|
||||
'suite' => (string)$test_suite['name'],
|
||||
'file' => str_replace($this->phpci->buildPath, '/', (string) $test_case['file']),
|
||||
'name' => (string)$test_case['name'],
|
||||
'feature' => (string)$test_case['feature'],
|
||||
'assertions' => (int)$test_case['assertions'],
|
||||
'time' => (float)$test_case['time']
|
||||
];
|
||||
|
||||
if (isset($testcase['class'])) {
|
||||
$testresult['class'] = (string) $testcase['class'];
|
||||
if (isset($test_case['class'])) {
|
||||
$test_result['class'] = (string) $test_case['class'];
|
||||
}
|
||||
|
||||
// PHPUnit testcases does not have feature field. Use class::method instead
|
||||
if (!$testresult['feature']) {
|
||||
$testresult['feature'] = sprintf('%s::%s', $testresult['class'], $testresult['name']);
|
||||
if (!$test_result['feature']) {
|
||||
$test_result['feature'] = sprintf('%s::%s', $test_result['class'], $test_result['name']);
|
||||
}
|
||||
|
||||
if (isset($testcase->failure) || isset($testcase->error)) {
|
||||
$testresult['pass'] = false;
|
||||
$testresult['message'] = (string)$testcase->failure . (string)$testcase->error;
|
||||
if (isset($test_case->failure) || isset($test_case->error)) {
|
||||
$test_result['pass'] = false;
|
||||
$test_result['message'] = isset($test_case->failure) ? (string)$test_case->failure : (string)$test_case->error;
|
||||
} else {
|
||||
$testresult['pass'] = true;
|
||||
$test_result['pass'] = true;
|
||||
}
|
||||
|
||||
$rtn[] = $testresult;
|
||||
$rtn[] = $test_result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class BuildMetaStore extends BuildMetaStoreBase
|
|||
public function getErrorsForUpgrade($limit)
|
||||
{
|
||||
$query = 'SELECT * FROM build_meta
|
||||
WHERE meta_key IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\')
|
||||
WHERE meta_key IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\', \'technical_debt - data\')
|
||||
ORDER BY id ASC LIMIT :limit';
|
||||
|
||||
$stmt = Database::getConnection('read')->prepare($query);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue