Compare commits
No commits in common. "master" and "feature/bitbucket-webhooks" have entirely different histories.
master
...
feature/bi
|
@ -13,6 +13,7 @@ build_settings:
|
|||
setup:
|
||||
composer:
|
||||
action: "install"
|
||||
prefer_dist: false
|
||||
|
||||
test:
|
||||
php_parallel_lint:
|
||||
|
|
|
@ -213,6 +213,8 @@ class Builder implements LoggerAwareInterface
|
|||
$this->build->setStatus(Build::STATUS_FAILED);
|
||||
}
|
||||
|
||||
// Complete stage plugins are always run
|
||||
$this->pluginExecutor->executePlugins($this->config, 'complete');
|
||||
|
||||
if ($success) {
|
||||
$this->pluginExecutor->executePlugins($this->config, 'success');
|
||||
|
@ -234,9 +236,6 @@ class Builder implements LoggerAwareInterface
|
|||
} catch (\Exception $ex) {
|
||||
$this->build->setStatus(Build::STATUS_FAILED);
|
||||
$this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage());
|
||||
}finally{
|
||||
// Complete stage plugins are always run
|
||||
$this->pluginExecutor->executePlugins($this->config, 'complete');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use PHPCI\Service\UserService;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
/**
|
||||
* Install console command - Installs PHPCI.
|
||||
|
@ -254,14 +253,6 @@ class InstallCommand extends Command
|
|||
|
||||
$rtn = [];
|
||||
|
||||
$helper = $this->getHelper('question');
|
||||
$question = new ConfirmationQuestion('Use beanstalkd to manage build queue? ', true);
|
||||
|
||||
if (!$helper->ask($input, $output, $question)) {
|
||||
$output->writeln('<error>Skipping beanstalkd configuration.</error>');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$rtn['host'] = $input->getOption('queue-server')) {
|
||||
$rtn['host'] = $dialog->ask($output, 'Enter your beanstalkd hostname [localhost]: ', 'localhost');
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@ class WorkerCommand extends Command
|
|||
{
|
||||
$this
|
||||
->setName('phpci:worker')
|
||||
->setDescription('Runs the PHPCI build worker.')
|
||||
->addOption('debug', null, null, 'Run PHPCI in Debug Mode');
|
||||
->setDescription('Runs the PHPCI build worker.');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
|
@ -66,12 +65,6 @@ class WorkerCommand extends Command
|
|||
);
|
||||
}
|
||||
|
||||
// Allow PHPCI to run in "debug mode"
|
||||
if ($input->hasOption('debug') && $input->getOption('debug')) {
|
||||
$output->writeln('<comment>Debug mode enabled.</comment>');
|
||||
define('PHPCI_DEBUG_MODE', true);
|
||||
}
|
||||
|
||||
$config = Config::getInstance()->get('phpci.worker', []);
|
||||
|
||||
if (empty($config['host']) || empty($config['queue'])) {
|
||||
|
|
|
@ -180,7 +180,7 @@ class BuildController extends \PHPCI\Controller
|
|||
$errorView->build = $build;
|
||||
$errorView->errors = $errors;
|
||||
|
||||
$data['errors'] = $errorStore->getErrorTotalForBuild($build->getId());
|
||||
$data['errors'] = count($errors);
|
||||
$data['error_html'] = $errorView->render();
|
||||
$data['since'] = (new \DateTime())->format('Y-m-d H:i:s');
|
||||
|
||||
|
@ -200,10 +200,6 @@ class BuildController extends \PHPCI\Controller
|
|||
|
||||
$build = $this->buildService->createDuplicateBuild($copy);
|
||||
|
||||
if ($this->buildService->queueError) {
|
||||
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
|
||||
}
|
||||
|
||||
$response = new b8\Http\Response\RedirectResponse();
|
||||
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
|
||||
return $response;
|
||||
|
|
|
@ -116,10 +116,6 @@ class ProjectController extends PHPCI\Controller
|
|||
$email = $_SESSION['phpci_user']->getEmail();
|
||||
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email);
|
||||
|
||||
if ($this->buildService->queueError) {
|
||||
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
|
||||
}
|
||||
|
||||
$response = new b8\Http\Response\RedirectResponse();
|
||||
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
|
||||
return $response;
|
||||
|
|
|
@ -27,8 +27,6 @@ use PHPCI\Store\ProjectStore;
|
|||
* @author Guillaume Perréal <adirelle@gmail.com>
|
||||
* @package PHPCI
|
||||
* @subpackage Web
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||
*/
|
||||
class WebhookController extends \b8\Controller
|
||||
{
|
||||
|
|
|
@ -76,7 +76,6 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
$this->lastOutput = array();
|
||||
|
||||
$command = call_user_func_array('sprintf', $args);
|
||||
$this->logger->logDebug($command);
|
||||
|
||||
if ($this->quiet) {
|
||||
$this->logger->log('Executing: ' . $command);
|
||||
|
@ -90,6 +89,7 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
);
|
||||
|
||||
$pipes = array();
|
||||
|
||||
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
||||
|
||||
if (is_resource($process)) {
|
||||
|
|
|
@ -372,9 +372,6 @@ PHPCI',
|
|||
'project_id_argument' => 'A project ID',
|
||||
'commit_id_option' => 'Commit ID to build',
|
||||
'branch_name_option' => 'Branch to build',
|
||||
'add_to_queue_failed' => 'Build created successfully, but failed to add to build queue. This usually happens
|
||||
when PHPCI is set to use a beanstalkd server that does not exist,
|
||||
or your beanstalkd server has stopped.',
|
||||
|
||||
// Run Command
|
||||
'run_all_pending' => 'Run all pending PHPCI builds.',
|
||||
|
|
|
@ -67,7 +67,7 @@ class BuildLogger implements LoggerAwareInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add a success-coloured message to the log.
|
||||
* @param string
|
||||
*/
|
||||
|
@ -98,17 +98,6 @@ class BuildLogger implements LoggerAwareInterface
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a debug message to the log.
|
||||
* @param string
|
||||
*/
|
||||
public function logDebug($message)
|
||||
{
|
||||
if (defined('PHPCI_DEBUG_MODE') && PHPCI_DEBUG_MODE) {
|
||||
$this->log("\033[0;33m" . $message . "\033[0m");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a logger instance on the object
|
||||
*
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
use Phinx\Db\Adapter\MysqlAdapter;
|
||||
|
||||
class ProjectTableDefaults extends AbstractMigration
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$this->table('project')
|
||||
->changeColumn('build_config', MysqlAdapter::PHINX_TYPE_TEXT, array('null' => true))
|
||||
->changeColumn('archived', MysqlAdapter::PHINX_TYPE_INTEGER, array(
|
||||
'length' => MysqlAdapter::INT_TINY,
|
||||
'default' => 0,
|
||||
))
|
||||
->save();
|
||||
}
|
||||
}
|
|
@ -96,7 +96,7 @@ class Project extends ProjectBase
|
|||
$info = $this->data['access_information'];
|
||||
|
||||
// Handle old-format (serialized) access information first:
|
||||
if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) {
|
||||
if (!empty($info) && substr($info, 0, 1) != '{') {
|
||||
$data = unserialize($info);
|
||||
} else {
|
||||
$data = json_decode($info, true);
|
||||
|
|
|
@ -61,7 +61,6 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
$this->directory = $path;
|
||||
$this->action = 'install';
|
||||
$this->preferDist = false;
|
||||
$this->preferSource = false;
|
||||
$this->nodev = false;
|
||||
|
||||
if (array_key_exists('directory', $options)) {
|
||||
|
@ -76,11 +75,6 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
$this->preferDist = (bool)$options['prefer_dist'];
|
||||
}
|
||||
|
||||
if (array_key_exists('prefer_source', $options)) {
|
||||
$this->preferDist = false;
|
||||
$this->preferSource = (bool)$options['prefer_source'];
|
||||
}
|
||||
|
||||
if (array_key_exists('no_dev', $options)) {
|
||||
$this->nodev = (bool)$options['no_dev'];
|
||||
}
|
||||
|
@ -103,12 +97,10 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
|
||||
if ($this->preferDist) {
|
||||
$this->phpci->log('Using --prefer-dist flag');
|
||||
$cmd .= ' --prefer-dist';
|
||||
}
|
||||
|
||||
if ($this->preferSource) {
|
||||
$cmd .= '--prefer-dist';
|
||||
} else {
|
||||
$this->phpci->log('Using --prefer-source flag');
|
||||
$cmd .= ' --prefer-source';
|
||||
$cmd .= '--prefer-source';
|
||||
}
|
||||
|
||||
if ($this->nodev) {
|
||||
|
|
5
PHPCI/Plugin/PhpCpd.php
Executable file → Normal file
5
PHPCI/Plugin/PhpCpd.php
Executable file → Normal file
|
@ -50,12 +50,17 @@ class PhpCpd implements \PHPCI\Plugin
|
|||
$this->build = $build;
|
||||
|
||||
$this->path = $phpci->buildPath;
|
||||
$this->standard = 'PSR1';
|
||||
$this->ignore = $phpci->ignore;
|
||||
|
||||
if (!empty($options['path'])) {
|
||||
$this->path = $phpci->buildPath . $options['path'];
|
||||
}
|
||||
|
||||
if (!empty($options['standard'])) {
|
||||
$this->standard = $options['standard'];
|
||||
}
|
||||
|
||||
if (!empty($options['ignore'])) {
|
||||
$this->ignore = $options['ignore'];
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class Codeception implements ParserInterface
|
|||
{
|
||||
$this->phpci = $phpci;
|
||||
$this->resultsXml = $resultsXml;
|
||||
|
||||
$this->totalTests = 0;
|
||||
}
|
||||
|
||||
|
@ -70,7 +71,7 @@ class Codeception implements ParserInterface
|
|||
|
||||
if (isset($testcase->failure) || isset($testcase->error)) {
|
||||
$testresult['pass'] = false;
|
||||
$testresult['message'] = (string)$testcase->failure . (string)$testcase->error;
|
||||
$testresult['message'] = isset($testcase->failure) ? (string) $testcase->failure : (string) $testcase->error;
|
||||
} else {
|
||||
$testresult['pass'] = true;
|
||||
}
|
||||
|
|
|
@ -30,11 +30,6 @@ class BuildService
|
|||
*/
|
||||
protected $buildStore;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $queueError = false;
|
||||
|
||||
/**
|
||||
* @param BuildStore $buildStore
|
||||
*/
|
||||
|
@ -160,30 +155,27 @@ class BuildService
|
|||
}
|
||||
|
||||
$config = Config::getInstance();
|
||||
|
||||
$settings = $config->get('phpci.worker', []);
|
||||
|
||||
if (!empty($settings['host']) && !empty($settings['queue'])) {
|
||||
try {
|
||||
$jobData = array(
|
||||
'type' => 'phpci.build',
|
||||
'build_id' => $build->getId(),
|
||||
);
|
||||
$jobData = array(
|
||||
'type' => 'phpci.build',
|
||||
'build_id' => $build->getId(),
|
||||
);
|
||||
|
||||
if ($config->get('using_custom_file')) {
|
||||
$jobData['config'] = $config->getArray();
|
||||
}
|
||||
|
||||
$pheanstalk = new Pheanstalk($settings['host']);
|
||||
$pheanstalk->useTube($settings['queue']);
|
||||
$pheanstalk->put(
|
||||
json_encode($jobData),
|
||||
PheanstalkInterface::DEFAULT_PRIORITY,
|
||||
PheanstalkInterface::DEFAULT_DELAY,
|
||||
$config->get('phpci.worker.job_timeout', 600)
|
||||
);
|
||||
} catch (\Exception $ex) {
|
||||
$this->queueError = true;
|
||||
if ($config->get('using_custom_file')) {
|
||||
$jobData['config'] = $config->getArray();
|
||||
}
|
||||
|
||||
$pheanstalk = new Pheanstalk($settings['host']);
|
||||
$pheanstalk->useTube($settings['queue']);
|
||||
$pheanstalk->put(
|
||||
json_encode($jobData),
|
||||
PheanstalkInterface::DEFAULT_PRIORITY,
|
||||
PheanstalkInterface::DEFAULT_DELAY,
|
||||
$config->get('phpci.worker.job_timeout', 600)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,27 +54,4 @@ class BuildErrorStore extends BuildErrorStoreBase
|
|||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total number of errors for a given build.
|
||||
* @param $buildId
|
||||
* @param string $since date string
|
||||
* @return array
|
||||
*/
|
||||
public function getErrorTotalForBuild($buildId)
|
||||
{
|
||||
$query = 'SELECT COUNT(*) AS total FROM build_error
|
||||
WHERE build_id = :build';
|
||||
|
||||
$stmt = Database::getConnection('read')->prepare($query);
|
||||
|
||||
$stmt->bindValue(':build', $buildId, \PDO::PARAM_INT);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$res = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return $res['total'];
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,14 +292,6 @@
|
|||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<?php
|
||||
if (!empty($_SESSION['global_error'])) {
|
||||
$message = $_SESSION['global_error'];
|
||||
unset($_SESSION['global_error']);
|
||||
print '<div class="alert alert-danger">' . $message . '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php print $content; ?>
|
||||
</section><!-- /.content -->
|
||||
</aside><!-- /.content-wrapper -->
|
||||
|
|
|
@ -11,12 +11,6 @@ PHPCI is a free and open source (BSD License) continuous integration tool specif
|
|||
|
||||
We have a chat room for discussing PHPCI, you can access it here: [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/Block8/PHPCI?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
|
||||
|
||||
**Support the development of PHPCI**
|
||||
|
||||
We [now accept donations](https://www.phptesting.org/support) to directly support the ongoing development of PHPCI. There is of course no obligation to donate, nor any commitment if you do.
|
||||
|
||||
[Donate](https://www.phptesting.org/support)
|
||||
|
||||
## What it does:
|
||||
* Clones your project from Github, Bitbucket or a local path
|
||||
* Allows you to set up and tear down test databases.
|
||||
|
|
Loading…
Reference in a new issue