Compare commits
48 commits
1.7.0-beta
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64b0f60368 | ||
|
|
42ca1c6527 | ||
|
|
4d0911f2a9 | ||
|
|
3cdaef8fa9 | ||
|
|
db93f55427 | ||
|
|
49db1a26ba |
||
|
|
77e9710d09 |
||
|
|
7027055711 |
||
|
|
21ba39e6ff |
||
|
|
6418fde928 | ||
|
|
21d5f4954f |
||
|
|
1f035463e4 | ||
|
|
5ead42a7c2 |
||
|
|
1e13538c28 |
||
|
|
424f1c5c4b | ||
|
|
dc9aa195d1 | ||
|
|
1e2cbcaf3d | ||
|
|
e567088a00 | ||
|
|
ffa593f1a3 | ||
|
|
cc6d0f2964 | ||
|
|
e6b02b6019 | ||
|
|
81eadcf3f5 | ||
|
|
f200bd0411 | ||
|
|
fe9289eda5 | ||
|
|
66ffea12f0 | ||
|
|
3c8ed45c46 | ||
|
|
2ddda7711e | ||
|
|
42bea5f876 | ||
|
|
d3af89a0c5 | ||
|
|
9af9e0ec35 | ||
|
|
7f43f94cc0 | ||
|
|
949bfc5376 | ||
|
|
992cf767a6 | ||
|
|
6eeddc9dc6 | ||
|
|
6eb180ed5f | ||
|
|
148e4414fb | ||
|
|
b24b01ec65 | ||
|
|
04c67dc1dd | ||
|
|
4b8d25c0f7 | ||
|
|
9ea6f299c1 | ||
|
|
7b345cbc49 | ||
|
|
c95e226496 | ||
|
|
7bfba0ee30 | ||
|
|
551bae312f | ||
|
|
d8be38ace0 | ||
|
|
1d9c610a25 | ||
|
|
943c8124ac | ||
|
|
d49cecf40a |
41
.github/CONTRIBUTING.md
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
Contributions to PHPCI are very much encouraged, and we do our best to make it as welcoming and simple as possible.
|
||||||
|
|
||||||
|
### Before You Start
|
||||||
|
Before you start, please make sure that you are aware of, and agree to, the following conditions of contribution:
|
||||||
|
|
||||||
|
* By making a contribution to PHPCI, you accept that you are granting copyright ownership for that contribution to Block 8 Limited - the company responsible for PHPCI. In countries where copyright reassignment is not permitted, you grant Block 8 Limited a perpetual, non-exclusive licence to use your contribution in any way and for any purpose.
|
||||||
|
|
||||||
|
* By making a contribution to PHPCI, you accept that your code will be released under the open-source [BSD 2-Clause Licence](https://github.com/Block8/PHPCI/blob/master/LICENSE.md).
|
||||||
|
|
||||||
|
Block 8 are committed to PHPCI being a truly free and open source project, providing easy to use continuous integration and testing to as many developers as possible. We may, at our sole discretion, provide paid services based upon PHPCI - but PHPCI will always remain free (as in cost, and freedom) and open source.
|
||||||
|
|
||||||
|
### The Contribution Process
|
||||||
|
|
||||||
|
1. If you are thinking of making a large change or feature addition, [open an issue](/Block8/PHPCI/issues) titled "Intent to implement: <Your Feature>". Describe your idea in detail and discuss it with the community. It might be that someone already has a plan, could help you out, or your idea may simply not be suitable for the project at this time.
|
||||||
|
2. Fork the PHPCI project on Github
|
||||||
|
3. Add a feature or fix a bug - We recommend that you do this on a branch within your repository.
|
||||||
|
4. Create a pull request containing just the one change you want to contribute back to PHPCI. If you have more than one feature or bug fix, please create separate branches within your repository, and then submit a separate pull request for each one. Your pull request should use the template detailed below.
|
||||||
|
5. We'll then review your pull request and give any necessary feedback, this could be:
|
||||||
|
* Suggestions to improve your implementation
|
||||||
|
* Questions
|
||||||
|
* Issues/bugs related to the change
|
||||||
|
* Coding standards pointers
|
||||||
|
6. Once everyone is happy with the submission, we'll merge it back into PHPCI. Your change will then be included in the next project release.
|
||||||
|
|
||||||
|
### Not sure what to start with?
|
||||||
|
We maintain two labels within our issue tracker that may be of interest to new contributors:
|
||||||
|
|
||||||
|
* [The "Easy Fix" List](https://github.com/Block8/PHPCI/labels/flag:easy-fix)
|
||||||
|
* [The "Priority" List](https://github.com/Block8/PHPCI/labels/flag:priority)
|
||||||
|
|
||||||
|
### Coding Standards
|
||||||
|
We require that all contributions meet at least the following guidelines:
|
||||||
|
|
||||||
|
* PSR-1 & PSR-2 compliance for all code
|
||||||
|
* Doc-blocks for all classes and methods
|
||||||
|
* All files must contain the standard file-level docblock, including the copyright, license and link tags.
|
||||||
|
|
||||||
|
All pull requests will be checked against these standards. If you're modifying a file as part of your change which does not comply with the above, please make the necessary changes to bring it into compliance prior to submitting the pull request.
|
||||||
|
|
||||||
|
### Other Requirements
|
||||||
|
When you're adding new features or functionality, or you're updating existing functionality, please ensure that the relevant documentation is also either created or updated on the Wiki.
|
||||||
28
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
Before submitting your issue, please make sure that you've checked all of the checkboxes below.
|
||||||
|
|
||||||
|
- [ ] You're running the [latest release](https://github.com/Block8/PHPCI/releases/latest) version of PHPCI.
|
||||||
|
- [ ] Ensure that you're running at least PHP 5.3.6, you can check this by running `php -v`
|
||||||
|
- [ ] You've run `composer install --no-dev -o` from the root of your installation.
|
||||||
|
- [ ] You have set up either the PHPCI [Worker](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Worker), [Daemon](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) or [Cron Job](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-Cron) to run builds.
|
||||||
|
|
||||||
|
To help us better understand your issue, please answer the following.
|
||||||
|
|
||||||
|
### Expected behaviour
|
||||||
|
|
||||||
|
*Please describe what you're expecting to see happen.*
|
||||||
|
|
||||||
|
### Actual behaviour
|
||||||
|
|
||||||
|
*Please describe what you're actually seeing happen.*
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
*If your issue requires any specific steps to reproduce, please outline them here.*
|
||||||
|
|
||||||
|
### Environment info
|
||||||
|
Operating System:
|
||||||
|
PHP Version:
|
||||||
|
MySQL Version:
|
||||||
|
|
||||||
|
### Logs or other output that would be helpful
|
||||||
|
(If logs are large, please upload as attachment).
|
||||||
23
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
Contribution Type: bug fix | new plugin | new feature | refactor | cosmetic
|
||||||
|
Link to Intent to Implement:
|
||||||
|
Link to Bug:
|
||||||
|
|
||||||
|
This pull request affects the following areas:
|
||||||
|
|
||||||
|
* [ ] Front-End
|
||||||
|
* [ ] Builder
|
||||||
|
* [ ] Build Plugins
|
||||||
|
|
||||||
|
**In raising this pull request, I confirm the following (please check boxes):**
|
||||||
|
|
||||||
|
- [ ] I have read and understood the [contributing guidelines](/.github/CONTRIBUTING.md)?
|
||||||
|
- [ ] I have checked that another pull request for this purpose does not exist.
|
||||||
|
- [ ] I have considered, and confirmed that this submission will be valuable to others.
|
||||||
|
- [ ] I have created or updated the relevant documentation for this change on the PHPCI Wiki.
|
||||||
|
- [ ] Do the PHPCI tests pass?
|
||||||
|
|
||||||
|
|
||||||
|
Detailed description of change:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -13,7 +13,6 @@ build_settings:
|
||||||
setup:
|
setup:
|
||||||
composer:
|
composer:
|
||||||
action: "install"
|
action: "install"
|
||||||
prefer_dist: false
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
php_parallel_lint:
|
php_parallel_lint:
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,6 @@ class Builder implements LoggerAwareInterface
|
||||||
$this->build->setStatus(Build::STATUS_FAILED);
|
$this->build->setStatus(Build::STATUS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete stage plugins are always run
|
|
||||||
$this->pluginExecutor->executePlugins($this->config, 'complete');
|
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$this->pluginExecutor->executePlugins($this->config, 'success');
|
$this->pluginExecutor->executePlugins($this->config, 'success');
|
||||||
|
|
@ -236,6 +234,9 @@ class Builder implements LoggerAwareInterface
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
$this->build->setStatus(Build::STATUS_FAILED);
|
$this->build->setStatus(Build::STATUS_FAILED);
|
||||||
$this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage());
|
$this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage());
|
||||||
|
}finally{
|
||||||
|
// Complete stage plugins are always run
|
||||||
|
$this->pluginExecutor->executePlugins($this->config, 'complete');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ use b8\Config;
|
||||||
use b8\Store\Factory;
|
use b8\Store\Factory;
|
||||||
use PHPCI\Helper\Lang;
|
use PHPCI\Helper\Lang;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Helper\DialogHelper;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use PHPCI\Service\UserService;
|
use PHPCI\Service\UserService;
|
||||||
|
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install console command - Installs PHPCI.
|
* Install console command - Installs PHPCI.
|
||||||
|
|
@ -46,6 +48,9 @@ class InstallCommand extends Command
|
||||||
->addOption('admin-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_pass'))
|
->addOption('admin-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_pass'))
|
||||||
->addOption('admin-mail', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_email'))
|
->addOption('admin-mail', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_email'))
|
||||||
->addOption('config-path', null, InputOption::VALUE_OPTIONAL, Lang::get('config_path'), $defaultPath)
|
->addOption('config-path', null, InputOption::VALUE_OPTIONAL, Lang::get('config_path'), $defaultPath)
|
||||||
|
->addOption('queue-disabled', null, InputOption::VALUE_NONE, 'Don\'t ask for queue details')
|
||||||
|
->addOption('queue-server', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue server hostname')
|
||||||
|
->addOption('queue-name', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue name')
|
||||||
->setDescription(Lang::get('install_phpci'));
|
->setDescription(Lang::get('install_phpci'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,10 +234,45 @@ class InstallCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpci['url'] = $url;
|
$phpci['url'] = $url;
|
||||||
|
$phpci['worker'] = $this->getQueueInformation($input, $output, $dialog);
|
||||||
|
|
||||||
return $phpci;
|
return $phpci;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the user wants to use a queue, get the necessary details.
|
||||||
|
* @param InputInterface $input
|
||||||
|
* @param OutputInterface $output
|
||||||
|
* @param DialogHelper $dialog
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getQueueInformation(InputInterface $input, OutputInterface $output, DialogHelper $dialog)
|
||||||
|
{
|
||||||
|
if ($input->getOption('queue-disabled')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$rtn['queue'] = $input->getOption('queue-name')) {
|
||||||
|
$rtn['queue'] = $dialog->ask($output, 'Enter the queue (tube) name to use [phpci]: ', 'phpci');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rtn;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load configuration for DB form CLI options or ask info to user.
|
* Load configuration for DB form CLI options or ask info to user.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
85
PHPCI/Command/RebuildQueueCommand.php
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPCI - Continuous Integration for PHP
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2015, Block 8 Limited.
|
||||||
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||||
|
* @link https://www.phptesting.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PHPCI\Command;
|
||||||
|
|
||||||
|
use b8\Config;
|
||||||
|
use b8\Store\Factory;
|
||||||
|
use Monolog\Logger;
|
||||||
|
use PHPCI\BuildFactory;
|
||||||
|
use PHPCI\Helper\Lang;
|
||||||
|
use PHPCI\Logging\OutputLogHandler;
|
||||||
|
use PHPCI\Service\BuildService;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Dan Cryer <dan@block8.co.uk>
|
||||||
|
* @package PHPCI
|
||||||
|
* @subpackage Console
|
||||||
|
*/
|
||||||
|
class RebuildQueueCommand extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var OutputInterface
|
||||||
|
*/
|
||||||
|
protected $output;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Logger
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Monolog\Logger $logger
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function __construct(Logger $logger, $name = null)
|
||||||
|
{
|
||||||
|
parent::__construct($name);
|
||||||
|
$this->logger = $logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setName('phpci:rebuild-queue')
|
||||||
|
->setDescription('Rebuilds the PHPCI worker queue.');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$this->output = $output;
|
||||||
|
|
||||||
|
// For verbose mode we want to output all informational and above
|
||||||
|
// messages to the symphony output interface.
|
||||||
|
if ($input->hasOption('verbose') && $input->getOption('verbose')) {
|
||||||
|
$this->logger->pushHandler(
|
||||||
|
new OutputLogHandler($this->output, Logger::INFO)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$store = Factory::getStore('Build');
|
||||||
|
$result = $store->getByStatus(0);
|
||||||
|
|
||||||
|
$this->logger->addInfo(Lang::get('found_n_builds', count($result['items'])));
|
||||||
|
|
||||||
|
$buildService = new BuildService($store);
|
||||||
|
|
||||||
|
while (count($result['items'])) {
|
||||||
|
$build = array_shift($result['items']);
|
||||||
|
$build = BuildFactory::getBuild($build);
|
||||||
|
|
||||||
|
$this->logger->addInfo('Added build #' . $build->getId() . ' to queue.');
|
||||||
|
$buildService->addBuildToQueue($build);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -50,7 +50,8 @@ class WorkerCommand extends Command
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('phpci:worker')
|
->setName('phpci:worker')
|
||||||
->setDescription('Runs the PHPCI build worker.');
|
->setDescription('Runs the PHPCI build worker.')
|
||||||
|
->addOption('debug', null, null, 'Run PHPCI in Debug Mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
|
@ -65,6 +66,12 @@ 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', []);
|
$config = Config::getInstance()->get('phpci.worker', []);
|
||||||
|
|
||||||
if (empty($config['host']) || empty($config['queue'])) {
|
if (empty($config['host']) || empty($config['queue'])) {
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ class BuildController extends \PHPCI\Controller
|
||||||
$errorView->build = $build;
|
$errorView->build = $build;
|
||||||
$errorView->errors = $errors;
|
$errorView->errors = $errors;
|
||||||
|
|
||||||
$data['errors'] = count($errors);
|
$data['errors'] = $errorStore->getErrorTotalForBuild($build->getId());
|
||||||
$data['error_html'] = $errorView->render();
|
$data['error_html'] = $errorView->render();
|
||||||
$data['since'] = (new \DateTime())->format('Y-m-d H:i:s');
|
$data['since'] = (new \DateTime())->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
|
@ -200,6 +200,10 @@ class BuildController extends \PHPCI\Controller
|
||||||
|
|
||||||
$build = $this->buildService->createDuplicateBuild($copy);
|
$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 = new b8\Http\Response\RedirectResponse();
|
||||||
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
|
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ class BuildStatusController extends \PHPCI\Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$xml = new \SimpleXMLElement('<projects/>');
|
$xml = new \SimpleXMLElement('<projects/>');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,10 @@ class ProjectController extends PHPCI\Controller
|
||||||
$email = $_SESSION['phpci_user']->getEmail();
|
$email = $_SESSION['phpci_user']->getEmail();
|
||||||
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email);
|
$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 = new b8\Http\Response\RedirectResponse();
|
||||||
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
|
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ class SettingsController extends Controller
|
||||||
$field->setClass('form-control');
|
$field->setClass('form-control');
|
||||||
$field->setContainerClass('form-group');
|
$field->setContainerClass('form-group');
|
||||||
$field->setOptions(Lang::getLanguageOptions());
|
$field->setOptions(Lang::getLanguageOptions());
|
||||||
$field->setValue('en');
|
$field->setValue(Lang::getLanguage());
|
||||||
$form->addField($field);
|
$form->addField($field);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ use PHPCI\Store\ProjectStore;
|
||||||
* @author Guillaume Perréal <adirelle@gmail.com>
|
* @author Guillaume Perréal <adirelle@gmail.com>
|
||||||
* @package PHPCI
|
* @package PHPCI
|
||||||
* @subpackage Web
|
* @subpackage Web
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||||
*/
|
*/
|
||||||
class WebhookController extends \b8\Controller
|
class WebhookController extends \b8\Controller
|
||||||
{
|
{
|
||||||
|
|
@ -80,11 +82,64 @@ class WebhookController extends \b8\Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by Bitbucket POST service.
|
* Called by Bitbucket.
|
||||||
*/
|
*/
|
||||||
public function bitbucket($projectId)
|
public function bitbucket($projectId)
|
||||||
{
|
{
|
||||||
$project = $this->fetchProject($projectId, 'bitbucket');
|
$project = $this->fetchProject($projectId, 'bitbucket');
|
||||||
|
|
||||||
|
// Support both old services and new webhooks
|
||||||
|
if ($payload = $this->getParam('payload')) {
|
||||||
|
return $this->bitbucketService(json_decode($payload, true), $project);
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
if (empty($payload['push']['changes'])) {
|
||||||
|
// Invalid event from bitbucket
|
||||||
|
return [
|
||||||
|
'status' => 'failed',
|
||||||
|
'commits' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->bitbucketWebhook($payload, $project);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitbucket webhooks.
|
||||||
|
*/
|
||||||
|
protected function bitbucketWebhook($payload, $project)
|
||||||
|
{
|
||||||
|
$results = array();
|
||||||
|
$status = 'failed';
|
||||||
|
foreach ($payload['push']['changes'] as $commit) {
|
||||||
|
try {
|
||||||
|
$email = $commit['new']['target']['author']['raw'];
|
||||||
|
$email = substr($email, 0, strpos($email, '>'));
|
||||||
|
$email = substr($email, strpos($email, '<') + 1);
|
||||||
|
|
||||||
|
$results[$commit['new']['target']['hash']] = $this->createBuild(
|
||||||
|
$project,
|
||||||
|
$commit['new']['target']['hash'],
|
||||||
|
$commit['new']['name'],
|
||||||
|
$email,
|
||||||
|
$commit['new']['target']['message']
|
||||||
|
);
|
||||||
|
$status = 'ok';
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$results[$commit['new']['target']['hash']] = array('status' => 'failed', 'error' => $ex->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('status' => $status, 'commits' => $results);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitbucket POST service.
|
||||||
|
*/
|
||||||
|
protected function bitbucketService($payload, $project)
|
||||||
|
{
|
||||||
$payload = json_decode($this->getParam('payload'), true);
|
$payload = json_decode($this->getParam('payload'), true);
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
||||||
$this->lastOutput = array();
|
$this->lastOutput = array();
|
||||||
|
|
||||||
$command = call_user_func_array('sprintf', $args);
|
$command = call_user_func_array('sprintf', $args);
|
||||||
|
$this->logger->logDebug($command);
|
||||||
|
|
||||||
if ($this->quiet) {
|
if ($this->quiet) {
|
||||||
$this->logger->log('Executing: ' . $command);
|
$this->logger->log('Executing: ' . $command);
|
||||||
|
|
@ -89,7 +90,6 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
||||||
);
|
);
|
||||||
|
|
||||||
$pipes = array();
|
$pipes = array();
|
||||||
|
|
||||||
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
||||||
|
|
||||||
if (is_resource($process)) {
|
if (is_resource($process)) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ PHPCI',
|
||||||
'reset_email_title' => 'PHPCI Passwort zurücksetzen für %s',
|
'reset_email_title' => 'PHPCI Passwort zurücksetzen für %s',
|
||||||
'reset_invalid' => 'Fehlerhafte Anfrage für das Zurücksetzen eines Passwortes',
|
'reset_invalid' => 'Fehlerhafte Anfrage für das Zurücksetzen eines Passwortes',
|
||||||
'email_address' => 'Emailadresse',
|
'email_address' => 'Emailadresse',
|
||||||
'login' => 'Login / Email Address',
|
'login' => 'Login / Emailadresse',
|
||||||
'password' => 'Passwort',
|
'password' => 'Passwort',
|
||||||
'log_in' => 'Einloggen',
|
'log_in' => 'Einloggen',
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'local' => 'Lokaler Pfad',
|
'local' => 'Lokaler Pfad',
|
||||||
'hg' => 'Mercurial',
|
'hg' => 'Mercurial',
|
||||||
'svn' => 'Subversion',
|
'svn' => 'Subversion',
|
||||||
|
|
||||||
'where_hosted' => 'Wo wird Ihr Projekt gehostet?',
|
'where_hosted' => 'Wo wird Ihr Projekt gehostet?',
|
||||||
'choose_github' => 'Wählen Sie ein GitHub Repository:',
|
'choose_github' => 'Wählen Sie ein GitHub Repository:',
|
||||||
|
|
||||||
|
|
@ -115,8 +115,8 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
(falls Sie Ihrem Projektrepository kein phpci.yml hinzufügen können)',
|
(falls Sie Ihrem Projektrepository kein phpci.yml hinzufügen können)',
|
||||||
'default_branch' => 'Name des Standardbranches',
|
'default_branch' => 'Name des Standardbranches',
|
||||||
'allow_public_status' => 'Öffentliche Statusseite und -bild für dieses Projekt einschalten?',
|
'allow_public_status' => 'Öffentliche Statusseite und -bild für dieses Projekt einschalten?',
|
||||||
'archived' => 'Archived',
|
'archived' => 'Archiviert',
|
||||||
'archived_menu' => 'Archived',
|
'archived_menu' => 'Archiviert',
|
||||||
'save_project' => 'Projekt speichern',
|
'save_project' => 'Projekt speichern',
|
||||||
|
|
||||||
'error_mercurial' => 'Mercurial Repository-URL muss mit http://, oder https:// beginnen',
|
'error_mercurial' => 'Mercurial Repository-URL muss mit http://, oder https:// beginnen',
|
||||||
|
|
@ -130,7 +130,7 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'all_branches' => 'Alle Branches',
|
'all_branches' => 'Alle Branches',
|
||||||
'builds' => 'Builds',
|
'builds' => 'Builds',
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
'date' => 'Date',
|
'date' => 'Datum',
|
||||||
'project' => 'Projekt',
|
'project' => 'Projekt',
|
||||||
'commit' => 'Commit',
|
'commit' => 'Commit',
|
||||||
'branch' => 'Branch',
|
'branch' => 'Branch',
|
||||||
|
|
@ -151,6 +151,9 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'webhooks_help_bitbucket' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL als "POST" Service in der <a href="https://bitbucket.org/%s/admin/services">Services</a>-Sektion Ihres Bitbucket Repositories hinzu.',
|
'webhooks_help_bitbucket' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL als "POST" Service in der <a href="https://bitbucket.org/%s/admin/services">Services</a>-Sektion Ihres Bitbucket Repositories hinzu.',
|
||||||
|
|
||||||
// View Build
|
// View Build
|
||||||
|
'errors' => 'Fehler',
|
||||||
|
'information' => 'Information',
|
||||||
|
|
||||||
'build_x_not_found' => 'Build mit ID %d existiert nicht.',
|
'build_x_not_found' => 'Build mit ID %d existiert nicht.',
|
||||||
'build_n' => 'Build %d',
|
'build_n' => 'Build %d',
|
||||||
'rebuild_now' => 'Build neu starten',
|
'rebuild_now' => 'Build neu starten',
|
||||||
|
|
@ -192,8 +195,8 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'codeception_suite' => 'Suite',
|
'codeception_suite' => 'Suite',
|
||||||
'codeception_time' => 'Zeit',
|
'codeception_time' => 'Zeit',
|
||||||
'codeception_synopsis' => '<strong>%1$d</strong> Tests in <strong>%2$f</strong> Sekunden ausgeführt.
|
'codeception_synopsis' => '<strong>%1$d</strong> Tests in <strong>%2$f</strong> Sekunden ausgeführt.
|
||||||
<strong>%3$d</strong> Fehler.',
|
<strong>%3$d</strong> Fehler.',
|
||||||
|
|
||||||
'file' => 'Datei',
|
'file' => 'Datei',
|
||||||
'line' => 'Zeile',
|
'line' => 'Zeile',
|
||||||
'class' => 'Klasse',
|
'class' => 'Klasse',
|
||||||
|
|
@ -209,14 +212,14 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'build_created' => 'Build erstellt',
|
'build_created' => 'Build erstellt',
|
||||||
'build_started' => 'Build gestartet',
|
'build_started' => 'Build gestartet',
|
||||||
'build_finished' => 'Build abgeschlossen',
|
'build_finished' => 'Build abgeschlossen',
|
||||||
'test_message' => 'Message',
|
'test_message' => 'Nachricht',
|
||||||
'test_no_message' => 'No message',
|
'test_no_message' => 'Keine Nachricht',
|
||||||
'test_success' => 'Successful: %d',
|
'test_success' => 'Erfolgreich: %d',
|
||||||
'test_fail' => 'Failures: %d',
|
'test_fail' => 'Fehlschläge: %d',
|
||||||
'test_skipped' => 'Skipped: %d',
|
'test_skipped' => 'Übersprungen: %d',
|
||||||
'test_error' => 'Errors: %d',
|
'test_error' => 'Fehler: %d',
|
||||||
'test_todo' => 'Todos: %d',
|
'test_todo' => 'Todos: %d',
|
||||||
'test_total' => '%d test(s)',
|
'test_total' => '%d Test(s)',
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
'name' => 'Name',
|
'name' => 'Name',
|
||||||
|
|
@ -292,6 +295,19 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'search_packagist_for_more' => 'Packagist nach mehr Packages durchsuchen',
|
'search_packagist_for_more' => 'Packagist nach mehr Packages durchsuchen',
|
||||||
'search' => 'Suchen »',
|
'search' => 'Suchen »',
|
||||||
|
|
||||||
|
// Summary plugin
|
||||||
|
'build-summary' => 'Zusammenfassung',
|
||||||
|
'stage' => 'Abschnitt',
|
||||||
|
'duration' => 'Dauer',
|
||||||
|
'plugin' => 'Plugin',
|
||||||
|
'stage_setup' => 'Vorbereitung',
|
||||||
|
'stage_test' => 'Test',
|
||||||
|
'stage_complete' => 'Vollständig',
|
||||||
|
'stage_success' => 'Erfolg',
|
||||||
|
'stage_failure' => 'Fehlschlag',
|
||||||
|
'stage_broken' => 'Defekt',
|
||||||
|
'stage_fixed' => 'Behoben',
|
||||||
|
|
||||||
// Installer
|
// Installer
|
||||||
'installation_url' => 'PHPCI Installations-URL',
|
'installation_url' => 'PHPCI Installations-URL',
|
||||||
'db_host' => 'Datenbankserver',
|
'db_host' => 'Datenbankserver',
|
||||||
|
|
@ -400,5 +416,18 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
|
||||||
'build_file_missing' => 'Angegebene Builddatei existiert nicht.',
|
'build_file_missing' => 'Angegebene Builddatei existiert nicht.',
|
||||||
'property_file_missing' => 'Angegebene Eigenschaftsdatei existiert nicht.',
|
'property_file_missing' => 'Angegebene Eigenschaftsdatei existiert nicht.',
|
||||||
'could_not_process_report' => 'Konnte den von diesem Tool erstellten Bericht nicht verarbeiten.',
|
'could_not_process_report' => 'Konnte den von diesem Tool erstellten Bericht nicht verarbeiten.',
|
||||||
'shell_not_enabled' => 'Das Shell-Plugin ist nicht aktiviert. Bitte aktivieren Sie es via config.yml.'
|
'shell_not_enabled' => 'Das Shell-Plugin ist nicht aktiviert. Bitte aktivieren Sie es via config.yml.',
|
||||||
|
|
||||||
|
// Error Levels:
|
||||||
|
'critical' => 'Kritisch',
|
||||||
|
'high' => 'Hoch',
|
||||||
|
'normal' => 'Normal',
|
||||||
|
'low' => 'Niedrig',
|
||||||
|
|
||||||
|
// 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',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -372,6 +372,9 @@ PHPCI',
|
||||||
'project_id_argument' => 'A project ID',
|
'project_id_argument' => 'A project ID',
|
||||||
'commit_id_option' => 'Commit ID to build',
|
'commit_id_option' => 'Commit ID to build',
|
||||||
'branch_name_option' => 'Branch 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 Command
|
||||||
'run_all_pending' => 'Run all pending PHPCI builds.',
|
'run_all_pending' => 'Run all pending PHPCI builds.',
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ od wybranego kodu źródłowego platformy hostingowej.',
|
||||||
'all_branches' => 'Wszystkie Gałęzie',
|
'all_branches' => 'Wszystkie Gałęzie',
|
||||||
'builds' => 'Budowania',
|
'builds' => 'Budowania',
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
'date' => 'Date',
|
'date' => 'Data',
|
||||||
'project' => 'Projekt',
|
'project' => 'Projekt',
|
||||||
'commit' => 'Commit',
|
'commit' => 'Commit',
|
||||||
'branch' => 'Gałąź',
|
'branch' => 'Gałąź',
|
||||||
|
|
@ -206,14 +206,14 @@ Services</a> repozytoria Bitbucket.',
|
||||||
'build_created' => 'Budowanie Stworzone',
|
'build_created' => 'Budowanie Stworzone',
|
||||||
'build_started' => 'Budowanie Rozpoczęte',
|
'build_started' => 'Budowanie Rozpoczęte',
|
||||||
'build_finished' => 'Budowanie Zakończone',
|
'build_finished' => 'Budowanie Zakończone',
|
||||||
'test_message' => 'Message',
|
'test_message' => 'Wiadomość',
|
||||||
'test_no_message' => 'No message',
|
'test_no_message' => 'Brak wiadomości',
|
||||||
'test_success' => 'Successful: %d',
|
'test_success' => 'Powodzenie: %d',
|
||||||
'test_fail' => 'Failures: %d',
|
'test_fail' => 'Niepowodzenia: %d',
|
||||||
'test_skipped' => 'Skipped: %d',
|
'test_skipped' => 'Pominęte: %d',
|
||||||
'test_error' => 'Errors: %d',
|
'test_error' => 'Błędy: %d',
|
||||||
'test_todo' => 'Todos: %d',
|
'test_todo' => 'Do zrobienia: %d',
|
||||||
'test_total' => '%d test(s)',
|
'test_total' => '%d test(ów)',
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
'name' => 'Nazwa',
|
'name' => 'Nazwa',
|
||||||
|
|
@ -344,10 +344,10 @@ Przejrzyj powyższą listę błędów przed kontynuowaniem.',
|
||||||
'incorrect_format' => 'Niepoprawny format',
|
'incorrect_format' => 'Niepoprawny format',
|
||||||
|
|
||||||
// Create Build Command
|
// Create Build Command
|
||||||
'create_build_project' => 'Create a build for a project',
|
'create_build_project' => 'Utwórz budowanie dla projektu',
|
||||||
'project_id_argument' => 'A project ID',
|
'project_id_argument' => 'ID projektu',
|
||||||
'commit_id_option' => 'Commit ID to build',
|
'commit_id_option' => 'ID Commita do budowania',
|
||||||
'branch_name_option' => 'Branch to build',
|
'branch_name_option' => 'Gałąź do budowania',
|
||||||
|
|
||||||
// Run Command
|
// Run Command
|
||||||
'run_all_pending' => 'Uruchom wszystkie oczekujące budowy w PHPCI',
|
'run_all_pending' => 'Uruchom wszystkie oczekujące budowy w PHPCI',
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class BuildLogger implements LoggerAwareInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a success-coloured message to the log.
|
* Add a success-coloured message to the log.
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
|
|
@ -98,6 +98,17 @@ 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
|
* Sets a logger instance on the object
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class FixDatabaseColumns extends AbstractMigration
|
||||||
$build->changeColumn('project_id', 'integer', array('null' => false));
|
$build->changeColumn('project_id', 'integer', array('null' => false));
|
||||||
$build->changeColumn('commit_id', 'string', array('limit' => 50, 'null' => false));
|
$build->changeColumn('commit_id', 'string', array('limit' => 50, 'null' => false));
|
||||||
$build->changeColumn('status', 'integer', array('null' => false));
|
$build->changeColumn('status', 'integer', array('null' => false));
|
||||||
$build->changeColumn('log', 'text', array('null' => true, 'default' => ''));
|
$build->changeColumn('log', 'text', array('null' => true));
|
||||||
$build->changeColumn('branch', 'string', array('limit' => 50, 'null' => false, 'default' => 'master'));
|
$build->changeColumn('branch', 'string', array('limit' => 50, 'null' => false, 'default' => 'master'));
|
||||||
$build->changeColumn('created', 'datetime', array('null' => true));
|
$build->changeColumn('created', 'datetime', array('null' => true));
|
||||||
$build->changeColumn('started', 'datetime', array('null' => true));
|
$build->changeColumn('started', 'datetime', array('null' => true));
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ class FixColumnTypes extends AbstractMigration
|
||||||
$build = $this->table('build');
|
$build = $this->table('build');
|
||||||
$build->changeColumn('log', 'text', array(
|
$build->changeColumn('log', 'text', array(
|
||||||
'null' => true,
|
'null' => true,
|
||||||
'default' => '',
|
|
||||||
'limit' => MysqlAdapter::TEXT_MEDIUM,
|
'limit' => MysqlAdapter::TEXT_MEDIUM,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
||||||
18
PHPCI/Migrations/20160623100223_project_table_defaults.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -258,7 +258,7 @@ class Build extends BuildBase
|
||||||
|
|
||||||
if (empty($this->currentBuildPath)) {
|
if (empty($this->currentBuildPath)) {
|
||||||
$buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
|
$buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
|
||||||
$this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . '/';
|
$this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DIRECTORY_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->currentBuildPath;
|
return $this->currentBuildPath;
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class Project extends ProjectBase
|
||||||
$info = $this->data['access_information'];
|
$info = $this->data['access_information'];
|
||||||
|
|
||||||
// Handle old-format (serialized) access information first:
|
// Handle old-format (serialized) access information first:
|
||||||
if (!empty($info) && substr($info, 0, 1) != '{') {
|
if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) {
|
||||||
$data = unserialize($info);
|
$data = unserialize($info);
|
||||||
} else {
|
} else {
|
||||||
$data = json_decode($info, true);
|
$data = json_decode($info, true);
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,19 @@ class Campfire implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
|
$this->message = $options['message'];
|
||||||
$this->message = $options['message'];
|
|
||||||
$this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)";
|
$this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)";
|
||||||
$this->cookie = "phpcicookie";
|
$this->cookie = "phpcicookie";
|
||||||
|
|
||||||
$buildSettings = $phpci->getConfig('build_settings');
|
$buildSettings = $phpci->getConfig('build_settings');
|
||||||
|
|
||||||
if (isset($buildSettings['campfire'])) {
|
if (isset($buildSettings['campfire'])) {
|
||||||
$campfire = $buildSettings['campfire'];
|
$campfire = $buildSettings['campfire'];
|
||||||
$this->url = $campfire['url'];
|
$this->url = $campfire['url'];
|
||||||
$this->authToken = $campfire['authToken'];
|
$this->authToken = $campfire['authToken'];
|
||||||
$this->roomId = $campfire['roomId'];
|
$this->roomId = $campfire['roomId'];
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception(Lang::get('no_campfire_settings'));
|
throw new \Exception(Lang::get('no_campfire_settings'));
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ class Campfire implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
$url = PHPCI_URL."build/view/".$this->build->getId();
|
$url = PHPCI_URL . "build/view/" . $this->build->getId();
|
||||||
$message = str_replace("%buildurl%", $url, $this->message);
|
$message = str_replace("%buildurl%", $url, $this->message);
|
||||||
$this->joinRoom($this->roomId);
|
$this->joinRoom($this->roomId);
|
||||||
$status = $this->speak($message, $this->roomId);
|
$status = $this->speak($message, $this->roomId);
|
||||||
|
|
@ -101,6 +101,7 @@ class Campfire implements \PHPCI\Plugin
|
||||||
public function speak($message, $roomId, $isPaste = false)
|
public function speak($message, $roomId, $isPaste = false)
|
||||||
{
|
{
|
||||||
$page = '/room/'.$roomId.'/speak.json';
|
$page = '/room/'.$roomId.'/speak.json';
|
||||||
|
|
||||||
if ($isPaste) {
|
if ($isPaste) {
|
||||||
$type = 'PasteMessage';
|
$type = 'PasteMessage';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -143,10 +144,12 @@ class Campfire implements \PHPCI\Plugin
|
||||||
|
|
||||||
// We tend to get one space with an otherwise blank response
|
// We tend to get one space with an otherwise blank response
|
||||||
$output = trim($output);
|
$output = trim($output);
|
||||||
|
|
||||||
if (strlen($output)) {
|
if (strlen($output)) {
|
||||||
/* Responses are JSON. Decode it to a data structure */
|
/* Responses are JSON. Decode it to a data structure */
|
||||||
return json_decode($output);
|
return json_decode($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple 200 OK response (such as for joining a room)
|
// Simple 200 OK response (such as for joining a room)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ class CleanBuild implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array();
|
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,7 +57,7 @@ class CleanBuild implements \PHPCI\Plugin
|
||||||
$this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock');
|
$this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock');
|
||||||
|
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
foreach ($this->remove as $file) {
|
foreach ($this->remove as $file) {
|
||||||
$ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file);
|
$ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
|
||||||
{
|
{
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->path = 'tests/_output/';
|
$this->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
if (empty($options['config'])) {
|
if (empty($options['config'])) {
|
||||||
$this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath);
|
$this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath);
|
||||||
|
|
@ -148,9 +148,9 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
|
||||||
$output = $parser->parse();
|
$output = $parser->parse();
|
||||||
|
|
||||||
$meta = array(
|
$meta = array(
|
||||||
'tests' => $parser->getTotalTests(),
|
'tests' => $parser->getTotalTests(),
|
||||||
'timetaken' => $parser->getTotalTimeTaken(),
|
'timetaken' => $parser->getTotalTimeTaken(),
|
||||||
'failures' => $parser->getTotalFailures()
|
'failures' => $parser->getTotalFailures()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->build->storeMeta('codeception-meta', $meta);
|
$this->build->storeMeta('codeception-meta', $meta);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
*/
|
*/
|
||||||
public static function canExecute($stage, Builder $builder, Build $build)
|
public static function canExecute($stage, Builder $builder, Build $build)
|
||||||
{
|
{
|
||||||
$path = $builder->buildPath . '/composer.json';
|
$path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.json';
|
||||||
|
|
||||||
if (file_exists($path) && $stage == 'setup') {
|
if (file_exists($path) && $stage == 'setup') {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -55,16 +55,17 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$path = $phpci->buildPath;
|
$path = $phpci->buildPath;
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->directory = $path;
|
$this->directory = $path;
|
||||||
$this->action = 'install';
|
$this->action = 'install';
|
||||||
$this->preferDist = false;
|
$this->preferDist = false;
|
||||||
$this->nodev = false;
|
$this->preferSource = false;
|
||||||
|
$this->nodev = false;
|
||||||
|
|
||||||
if (array_key_exists('directory', $options)) {
|
if (array_key_exists('directory', $options)) {
|
||||||
$this->directory = $path . '/' . $options['directory'];
|
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('action', $options)) {
|
if (array_key_exists('action', $options)) {
|
||||||
|
|
@ -75,6 +76,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
$this->preferDist = (bool)$options['prefer_dist'];
|
$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)) {
|
if (array_key_exists('no_dev', $options)) {
|
||||||
$this->nodev = (bool)$options['no_dev'];
|
$this->nodev = (bool)$options['no_dev'];
|
||||||
}
|
}
|
||||||
|
|
@ -97,10 +103,12 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
|
|
||||||
if ($this->preferDist) {
|
if ($this->preferDist) {
|
||||||
$this->phpci->log('Using --prefer-dist flag');
|
$this->phpci->log('Using --prefer-dist flag');
|
||||||
$cmd .= '--prefer-dist';
|
$cmd .= ' --prefer-dist';
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if ($this->preferSource) {
|
||||||
$this->phpci->log('Using --prefer-source flag');
|
$this->phpci->log('Using --prefer-source flag');
|
||||||
$cmd .= '--prefer-source';
|
$cmd .= ' --prefer-source';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->nodev) {
|
if ($this->nodev) {
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ class CopyBuild implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$path = $phpci->buildPath;
|
$path = $phpci->buildPath;
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
|
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
|
||||||
$this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false;
|
$this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false;
|
||||||
$this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false;
|
$this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class Deployer implements \PHPCI\Plugin
|
||||||
{
|
{
|
||||||
protected $webhookUrl;
|
protected $webhookUrl;
|
||||||
protected $reason;
|
protected $reason;
|
||||||
|
protected $updateOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the plugin, configure options, etc.
|
* Set up the plugin, configure options, etc.
|
||||||
|
|
@ -43,6 +44,8 @@ class Deployer implements \PHPCI\Plugin
|
||||||
if (isset($options['reason'])) {
|
if (isset($options['reason'])) {
|
||||||
$this->reason = $options['reason'];
|
$this->reason = $options['reason'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->updateOnly = isset($options['update_only']) ? (bool) $options['update_only'] : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,6 +64,8 @@ class Deployer implements \PHPCI\Plugin
|
||||||
'reason' => $this->phpci->interpolate($this->reason),
|
'reason' => $this->phpci->interpolate($this->reason),
|
||||||
'source' => 'PHPCI',
|
'source' => 'PHPCI',
|
||||||
'url' => $this->phpci->interpolate('%BUILD_URI%'),
|
'url' => $this->phpci->interpolate('%BUILD_URI%'),
|
||||||
|
'branch' => $this->phpci->interpolate('%BRANCH%'),
|
||||||
|
'update_only' => $this->updateOnly
|
||||||
));
|
));
|
||||||
|
|
||||||
return $response['success'];
|
return $response['success'];
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ class Email implements \PHPCI\Plugin
|
||||||
Build $build,
|
Build $build,
|
||||||
array $options = array()
|
array $options = array()
|
||||||
) {
|
) {
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->options = $options;
|
$this->options = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class Env implements \PHPCI\Plugin
|
||||||
// This allows the standard syntax: "FOO: bar"
|
// This allows the standard syntax: "FOO: bar"
|
||||||
$env_var = "$key=$value";
|
$env_var = "$key=$value";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!putenv($this->phpci->interpolate($env_var))) {
|
if (!putenv($this->phpci->interpolate($env_var))) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$this->phpci->logFailure(Lang::get('unable_to_set_env'));
|
$this->phpci->logFailure(Lang::get('unable_to_set_env'));
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class Grunt implements \PHPCI\Plugin
|
||||||
|
|
||||||
// Handle options:
|
// Handle options:
|
||||||
if (isset($options['directory'])) {
|
if (isset($options['directory'])) {
|
||||||
$this->directory = $path . '/' . $options['directory'];
|
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['task'])) {
|
if (isset($options['task'])) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class Gulp implements \PHPCI\Plugin
|
||||||
|
|
||||||
// Handle options:
|
// Handle options:
|
||||||
if (isset($options['directory'])) {
|
if (isset($options['directory'])) {
|
||||||
$this->directory = $path . '/' . $options['directory'];
|
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['task'])) {
|
if (isset($options['task'])) {
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@ class Lint implements PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->directories = array('');
|
$this->directories = array('');
|
||||||
$this->ignore = $phpci->ignore;
|
$this->ignore = $phpci->ignore;
|
||||||
|
|
||||||
if (!empty($options['directory'])) {
|
if (!empty($options['directory'])) {
|
||||||
|
|
@ -93,7 +93,7 @@ class Lint implements PHPCI\Plugin
|
||||||
|
|
||||||
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
|
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
|
||||||
$success = false;
|
$success = false;
|
||||||
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . '/')) {
|
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTORY_SEPARATOR)) {
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ class PackageBuild implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$path = $phpci->buildPath;
|
$path = $phpci->buildPath;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
|
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
|
||||||
$this->filename = isset($options['filename']) ? $options['filename'] : 'build';
|
$this->filename = isset($options['filename']) ? $options['filename'] : 'build';
|
||||||
$this->format = isset($options['format']) ? $options['format'] : 'zip';
|
$this->format = isset($options['format']) ? $options['format'] : 'zip';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,7 +46,7 @@ class PackageBuild implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
$path = $this->phpci->buildPath;
|
$path = $this->phpci->buildPath;
|
||||||
$build = $this->build;
|
$build = $this->build;
|
||||||
|
|
||||||
if ($this->directory == $path) {
|
if ($this->directory == $path) {
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,9 @@ class Pgsql implements \PHPCI\Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects to PgSQL and runs a specified set of queries.
|
* Connects to PgSQL and runs a specified set of queries.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ class Phar implements \PHPCI\Plugin
|
||||||
$content = '';
|
$content = '';
|
||||||
$filename = $this->getStub();
|
$filename = $this->getStub();
|
||||||
if ($filename) {
|
if ($filename) {
|
||||||
$content = file_get_contents($this->getPHPCI()->buildPath . '/' . $this->getStub());
|
$content = file_get_contents($this->getPHPCI()->buildPath . DIRECTORY_SEPARATOR . $this->getStub());
|
||||||
}
|
}
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +227,8 @@ class Phar implements \PHPCI\Plugin
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename());
|
$file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename();
|
||||||
|
$phar = new PHPPhar($file, 0, $this->getFilename());
|
||||||
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());
|
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());
|
||||||
|
|
||||||
$stub = $this->getStubContent();
|
$stub = $this->getStubContent();
|
||||||
|
|
@ -236,7 +237,6 @@ class Phar implements \PHPCI\Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->getPHPCI()->log(Lang::get('phar_internal_error'));
|
$this->getPHPCI()->log(Lang::get('phar_internal_error'));
|
||||||
$this->getPHPCI()->log($e->getMessage());
|
$this->getPHPCI()->log($e->getMessage());
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class Phing implements \PHPCI\Plugin
|
||||||
* Set working directory
|
* Set working directory
|
||||||
*/
|
*/
|
||||||
if (isset($options['directory'])) {
|
if (isset($options['directory'])) {
|
||||||
$directory = $phpci->buildPath . '/' . $options['directory'];
|
$directory = $phpci->buildPath . DIRECTORY_SEPARATOR . $options['directory'];
|
||||||
} else {
|
} else {
|
||||||
$directory = $phpci->buildPath;
|
$directory = $phpci->buildPath;
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +255,7 @@ class Phing implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function setPropertyFile($propertyFile)
|
public function setPropertyFile($propertyFile)
|
||||||
{
|
{
|
||||||
if (!file_exists($this->getDirectory() . '/' . $propertyFile)) {
|
if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) {
|
||||||
throw new \Exception(Lang::get('property_file_missing'));
|
throw new \Exception(Lang::get('property_file_missing'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
9
PHPCI/Plugin/PhpCpd.php
Normal file → Executable file
|
|
@ -50,17 +50,12 @@ class PhpCpd implements \PHPCI\Plugin
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
|
|
||||||
$this->path = $phpci->buildPath;
|
$this->path = $phpci->buildPath;
|
||||||
$this->standard = 'PSR1';
|
|
||||||
$this->ignore = $phpci->ignore;
|
$this->ignore = $phpci->ignore;
|
||||||
|
|
||||||
if (!empty($options['path'])) {
|
if (!empty($options['path'])) {
|
||||||
$this->path = $phpci->buildPath . $options['path'];
|
$this->path = $phpci->buildPath . $options['path'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($options['standard'])) {
|
|
||||||
$this->standard = $options['standard'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($options['ignore'])) {
|
if (!empty($options['ignore'])) {
|
||||||
$this->ignore = $options['ignore'];
|
$this->ignore = $options['ignore'];
|
||||||
}
|
}
|
||||||
|
|
@ -75,9 +70,9 @@ class PhpCpd implements \PHPCI\Plugin
|
||||||
if (count($this->ignore)) {
|
if (count($this->ignore)) {
|
||||||
$map = function ($item) {
|
$map = function ($item) {
|
||||||
// remove the trailing slash
|
// remove the trailing slash
|
||||||
$item = (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
|
$item = rtrim($item, DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
if (is_file($this->path . '/' . $item)) {
|
if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
|
||||||
return ' --names-exclude ' . $item;
|
return ' --names-exclude ' . $item;
|
||||||
} else {
|
} else {
|
||||||
return ' --exclude ' . $item;
|
return ' --exclude ' . $item;
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ class PhpCsFixer implements \PHPCI\Plugin
|
||||||
protected $build;
|
protected $build;
|
||||||
|
|
||||||
protected $workingDir = '';
|
protected $workingDir = '';
|
||||||
protected $level = ' --level=psr2';
|
protected $level = ' --level=psr2';
|
||||||
protected $verbose = '';
|
protected $verbose = '';
|
||||||
protected $diff = '';
|
protected $diff = '';
|
||||||
protected $levels = array('psr0', 'psr1', 'psr2', 'symfony');
|
protected $levels = array('psr0', 'psr1', 'psr2', 'symfony');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
||||||
|
|
@ -69,19 +69,20 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
$ignore = '';
|
$ignore = '';
|
||||||
if (count($this->phpci->ignore)) {
|
|
||||||
$map = function ($item) {
|
|
||||||
return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
|
|
||||||
};
|
|
||||||
$ignore = array_map($map, $this->phpci->ignore);
|
|
||||||
|
|
||||||
|
if (count($this->phpci->ignore)) {
|
||||||
|
$map = function ($item) {
|
||||||
|
return ' --exclude ' . rtrim($item, DIRECTORY_SEPARATOR);
|
||||||
|
};
|
||||||
|
|
||||||
|
$ignore = array_map($map, $this->phpci->ignore);
|
||||||
$ignore = implode('', $ignore);
|
$ignore = implode('', $ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
$phploc = $this->phpci->findBinary('phploc');
|
$phploc = $this->phpci->findBinary('phploc');
|
||||||
|
|
||||||
$success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory);
|
$success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory);
|
||||||
$output = $this->phpci->getLastOutput();
|
$output = $this->phpci->getLastOutput();
|
||||||
|
|
||||||
if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) {
|
if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) {
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ class PhpParallelLint implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||||
{
|
{
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->build = $build;
|
$this->build = $build;
|
||||||
$this->directory = $phpci->buildPath;
|
$this->directory = $phpci->buildPath;
|
||||||
$this->ignore = $this->phpci->ignore;
|
$this->ignore = $this->phpci->ignore;
|
||||||
|
|
||||||
if (isset($options['directory'])) {
|
if (isset($options['directory'])) {
|
||||||
$this->directory = $phpci->buildPath.$options['directory'];
|
$this->directory = $phpci->buildPath.$options['directory'];
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ class PhpTalLint implements PHPCI\Plugin
|
||||||
if (!$this->lintFile($itemPath)) {
|
if (!$this->lintFile($itemPath)) {
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . '/')) {
|
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . DIRECTORY_SEPARATOR)) {
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +202,9 @@ class PhpTalLint implements PHPCI\Plugin
|
||||||
|
|
||||||
list($suffixes, $tales) = $this->getFlags();
|
list($suffixes, $tales) = $this->getFlags();
|
||||||
|
|
||||||
$lint = dirname(__FILE__) . '/../../vendor/phptal/phptal/tools/phptal_lint.php';
|
$lint = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
|
||||||
|
$lint .= 'vendor' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR;
|
||||||
|
$lint .= 'tools' . DIRECTORY_SEPARATOR . 'phptal_lint.php';
|
||||||
$cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"';
|
$cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"';
|
||||||
|
|
||||||
$this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path);
|
$this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path);
|
||||||
|
|
@ -222,7 +224,7 @@ class PhpTalLint implements PHPCI\Plugin
|
||||||
|
|
||||||
$row = str_replace('(use -i to include your custom modifier functions)', '', $row);
|
$row = str_replace('(use -i to include your custom modifier functions)', '', $row);
|
||||||
$message = str_replace($name . ': ', '', $row);
|
$message = str_replace($name . ': ', '', $row);
|
||||||
|
|
||||||
$parts = explode(' (line ', $message);
|
$parts = explode(' (line ', $message);
|
||||||
|
|
||||||
$message = trim($parts[0]);
|
$message = trim($parts[0]);
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
return 'phpunit.xml';
|
return 'phpunit.xml';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($buildPath . 'tests/phpunit.xml')) {
|
if (file_exists($buildPath . 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml')) {
|
||||||
return 'tests/phpunit.xml';
|
return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($buildPath . 'phpunit.xml.dist')) {
|
if (file_exists($buildPath . 'phpunit.xml.dist')) {
|
||||||
|
|
@ -85,7 +85,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($buildPath . 'tests/phpunit.xml.dist')) {
|
if (file_exists($buildPath . 'tests/phpunit.xml.dist')) {
|
||||||
return 'tests/phpunit.xml.dist';
|
return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml.dist';
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -194,7 +194,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
} else {
|
} else {
|
||||||
if ($this->runFrom) {
|
if ($this->runFrom) {
|
||||||
$curdir = getcwd();
|
$curdir = getcwd();
|
||||||
chdir($this->phpci->buildPath.'/'.$this->runFrom);
|
chdir($this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->runFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpunit = $this->phpci->findBinary('phpunit');
|
$phpunit = $this->phpci->findBinary('phpunit');
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore hidden files, else .git, .sass_cache, etc. all get looped over
|
// Ignore hidden files, else .git, .sass_cache, etc. all get looped over
|
||||||
if (stripos($filePath, '/.') !== false) {
|
if (stripos($filePath, DIRECTORY_SEPARATOR . '.') !== false) {
|
||||||
$skipFile = true;
|
$skipFile = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ namespace PHPCI\Plugin\Util;
|
||||||
*/
|
*/
|
||||||
class Factory
|
class Factory
|
||||||
{
|
{
|
||||||
const TYPE_ARRAY = "array";
|
const TYPE_ARRAY = "array";
|
||||||
const TYPE_CALLABLE = "callable";
|
const TYPE_CALLABLE = "callable";
|
||||||
const INTERFACE_PHPCI_PLUGIN = '\PHPCI\Plugin';
|
const INTERFACE_PHPCI_PLUGIN = '\PHPCI\Plugin';
|
||||||
|
|
||||||
private $currentPluginOptions;
|
private $currentPluginOptions;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
if ($this->pluginInfo === null) {
|
if ($this->pluginInfo === null) {
|
||||||
$this->loadPluginInfo();
|
$this->loadPluginInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->pluginInfo;
|
return $this->pluginInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,7 +84,7 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
$this->pluginInfo = array();
|
$this->pluginInfo = array();
|
||||||
foreach ($this->files as $fileInfo) {
|
foreach ($this->files as $fileInfo) {
|
||||||
if ($fileInfo instanceof \SplFileInfo) {
|
if ($fileInfo instanceof \SplFileInfo) {
|
||||||
if ($fileInfo->isFile() && $fileInfo->getExtension()=='php') {
|
if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') {
|
||||||
$this->addPluginFromFile($fileInfo);
|
$this->addPluginFromFile($fileInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,11 +100,11 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
$class = $this->getFullClassFromFile($fileInfo);
|
$class = $this->getFullClassFromFile($fileInfo);
|
||||||
|
|
||||||
if (!is_null($class)) {
|
if (!is_null($class)) {
|
||||||
$newPlugin = new \stdClass();
|
$newPlugin = new \stdClass();
|
||||||
$newPlugin->class = $class;
|
$newPlugin->class = $class;
|
||||||
$newPlugin->source = "core";
|
$newPlugin->source = "core";
|
||||||
$parts = explode('\\', $newPlugin->class);
|
$parts = explode('\\', $newPlugin->class);
|
||||||
$newPlugin->name = end($parts);
|
$newPlugin->name = end($parts);
|
||||||
|
|
||||||
$this->pluginInfo[] = $newPlugin;
|
$this->pluginInfo[] = $newPlugin;
|
||||||
}
|
}
|
||||||
|
|
@ -123,11 +124,11 @@ class FilesPluginInformation implements InstalledPluginInformation
|
||||||
|
|
||||||
if (isset($matches[1])) {
|
if (isset($matches[1])) {
|
||||||
$className = $matches[1];
|
$className = $matches[1];
|
||||||
|
|
||||||
$matches = array();
|
$matches = array();
|
||||||
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
|
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
|
||||||
$namespace = $matches[1];
|
$namespace = $matches[1];
|
||||||
|
|
||||||
return $namespace . '\\' . $className;
|
return $namespace . '\\' . $className;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,11 @@ class PluginInformationCollection implements InstalledPluginInformation
|
||||||
public function getInstalledPlugins()
|
public function getInstalledPlugins()
|
||||||
{
|
{
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
|
||||||
foreach ($this->pluginInformations as $single) {
|
foreach ($this->pluginInformations as $single) {
|
||||||
$arr = array_merge($arr, $single->getInstalledPlugins());
|
$arr = array_merge($arr, $single->getInstalledPlugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,9 +49,11 @@ class PluginInformationCollection implements InstalledPluginInformation
|
||||||
public function getPluginClasses()
|
public function getPluginClasses()
|
||||||
{
|
{
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
|
||||||
foreach ($this->pluginInformations as $single) {
|
foreach ($this->pluginInformations as $single) {
|
||||||
$arr = array_merge($arr, $single->getPluginClasses());
|
$arr = array_merge($arr, $single->getPluginClasses());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -235,18 +235,20 @@ class TapParser
|
||||||
*/
|
*/
|
||||||
protected function processYamlBlock($indent)
|
protected function processYamlBlock($indent)
|
||||||
{
|
{
|
||||||
$startLine = $this->lineNumber+1;
|
$startLine = $this->lineNumber + 1;
|
||||||
$endLine = $indent.'...';
|
$endLine = $indent . '...';
|
||||||
$yamlLines = array();
|
$yamlLines = array();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$line = $this->nextLine();
|
$line = $this->nextLine();
|
||||||
|
|
||||||
if ($line === false) {
|
if ($line === false) {
|
||||||
throw new Exception(Lang::get('tap_error_endless_yaml', $startLine));
|
throw new Exception(Lang::get('tap_error_endless_yaml', $startLine));
|
||||||
} elseif ($line === $endLine) {
|
} elseif ($line === $endLine) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$yamlLines[] = substr($line, strlen($indent));
|
|
||||||
|
|
||||||
|
$yamlLines[] = substr($line, strlen($indent));
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
return Yaml::parse(join("\n", $yamlLines));
|
return Yaml::parse(join("\n", $yamlLines));
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class Codeception implements ParserInterface
|
||||||
protected $totalTests;
|
protected $totalTests;
|
||||||
protected $totalTimeTaken;
|
protected $totalTimeTaken;
|
||||||
protected $totalFailures;
|
protected $totalFailures;
|
||||||
|
protected $totalErrors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Builder $phpci
|
* @param Builder $phpci
|
||||||
|
|
@ -29,7 +30,6 @@ class Codeception implements ParserInterface
|
||||||
{
|
{
|
||||||
$this->phpci = $phpci;
|
$this->phpci = $phpci;
|
||||||
$this->resultsXml = $resultsXml;
|
$this->resultsXml = $resultsXml;
|
||||||
|
|
||||||
$this->totalTests = 0;
|
$this->totalTests = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,6 +47,7 @@ class Codeception implements ParserInterface
|
||||||
$this->totalTests += (int) $testsuite['tests'];
|
$this->totalTests += (int) $testsuite['tests'];
|
||||||
$this->totalTimeTaken += (float) $testsuite['time'];
|
$this->totalTimeTaken += (float) $testsuite['time'];
|
||||||
$this->totalFailures += (int) $testsuite['failures'];
|
$this->totalFailures += (int) $testsuite['failures'];
|
||||||
|
$this->totalErrors += (int) $testsuite['errors'];
|
||||||
|
|
||||||
foreach ($testsuite->testcase as $testcase) {
|
foreach ($testsuite->testcase as $testcase) {
|
||||||
$testresult = array(
|
$testresult = array(
|
||||||
|
|
@ -67,9 +68,9 @@ class Codeception implements ParserInterface
|
||||||
$testresult['feature'] = sprintf('%s::%s', $testresult['class'], $testresult['name']);
|
$testresult['feature'] = sprintf('%s::%s', $testresult['class'], $testresult['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($testcase->failure)) {
|
if (isset($testcase->failure) || isset($testcase->error)) {
|
||||||
$testresult['pass'] = false;
|
$testresult['pass'] = false;
|
||||||
$testresult['message'] = (string) $testcase->failure;
|
$testresult['message'] = (string)$testcase->failure . (string)$testcase->error;
|
||||||
} else {
|
} else {
|
||||||
$testresult['pass'] = true;
|
$testresult['pass'] = true;
|
||||||
}
|
}
|
||||||
|
|
@ -108,6 +109,6 @@ class Codeception implements ParserInterface
|
||||||
*/
|
*/
|
||||||
public function getTotalFailures()
|
public function getTotalFailures()
|
||||||
{
|
{
|
||||||
return $this->totalFailures;
|
return $this->totalFailures + $this->totalErrors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,9 @@ class XMPP implements \PHPCI\Plugin
|
||||||
*/
|
*/
|
||||||
public function findConfigFile()
|
public function findConfigFile()
|
||||||
{
|
{
|
||||||
if (file_exists($this->phpci->buildPath . '/.sendxmpprc')) {
|
if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) {
|
||||||
if (md5(file_get_contents($this->phpci->buildPath . '/.sendxmpprc')) !== md5($this->getConfigFormat())) {
|
if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc'))
|
||||||
|
!== md5($this->getConfigFormat())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +161,7 @@ class XMPP implements \PHPCI\Plugin
|
||||||
/*
|
/*
|
||||||
* Try to build conf file
|
* Try to build conf file
|
||||||
*/
|
*/
|
||||||
$config_file = $this->phpci->buildPath . '/.sendxmpprc';
|
$config_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc';
|
||||||
if (is_null($this->findConfigFile())) {
|
if (is_null($this->findConfigFile())) {
|
||||||
file_put_contents($config_file, $this->getConfigFormat());
|
file_put_contents($config_file, $this->getConfigFormat());
|
||||||
chmod($config_file, 0600);
|
chmod($config_file, 0600);
|
||||||
|
|
@ -174,7 +175,7 @@ class XMPP implements \PHPCI\Plugin
|
||||||
$tls = ' -t';
|
$tls = ' -t';
|
||||||
}
|
}
|
||||||
|
|
||||||
$message_file = $this->phpci->buildPath . '/' . uniqid('xmppmessage');
|
$message_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . uniqid('xmppmessage');
|
||||||
if ($this->buildMessage($message_file) === false) {
|
if ($this->buildMessage($message_file) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,11 @@ class BuildService
|
||||||
*/
|
*/
|
||||||
protected $buildStore;
|
protected $buildStore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $queueError = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param BuildStore $buildStore
|
* @param BuildStore $buildStore
|
||||||
*/
|
*/
|
||||||
|
|
@ -155,27 +160,30 @@ class BuildService
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = Config::getInstance();
|
$config = Config::getInstance();
|
||||||
|
|
||||||
$settings = $config->get('phpci.worker', []);
|
$settings = $config->get('phpci.worker', []);
|
||||||
|
|
||||||
if (!empty($settings['host']) && !empty($settings['queue'])) {
|
if (!empty($settings['host']) && !empty($settings['queue'])) {
|
||||||
$jobData = array(
|
try {
|
||||||
'type' => 'phpci.build',
|
$jobData = array(
|
||||||
'build_id' => $build->getId(),
|
'type' => 'phpci.build',
|
||||||
);
|
'build_id' => $build->getId(),
|
||||||
|
);
|
||||||
|
|
||||||
if ($config->get('using_custom_file')) {
|
if ($config->get('using_custom_file')) {
|
||||||
$jobData['config'] = $config->getArray();
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class BuildErrorStore extends BuildErrorStoreBase
|
||||||
$query .= ' AND created_date > :since';
|
$query .= ' AND created_date > :since';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query .= ' LIMIT 5000';
|
$query .= ' LIMIT 15000';
|
||||||
|
|
||||||
$stmt = Database::getConnection('read')->prepare($query);
|
$stmt = Database::getConnection('read')->prepare($query);
|
||||||
|
|
||||||
|
|
@ -54,4 +54,27 @@ class BuildErrorStore extends BuildErrorStoreBase
|
||||||
return array();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ class BuildStore extends BuildStoreBase
|
||||||
$stmt->bindValue(':projectId', (int)$projectId, \PDO::PARAM_INT);
|
$stmt->bindValue(':projectId', (int)$projectId, \PDO::PARAM_INT);
|
||||||
$stmt->bindValue(':buildId', (int)$buildId, \PDO::PARAM_INT);
|
$stmt->bindValue(':buildId', (int)$buildId, \PDO::PARAM_INT);
|
||||||
$stmt->bindValue(':numResults', (int)$numResults, \PDO::PARAM_INT);
|
$stmt->bindValue(':numResults', (int)$numResults, \PDO::PARAM_INT);
|
||||||
|
|
||||||
if (!is_null($branch)) {
|
if (!is_null($branch)) {
|
||||||
$stmt->bindValue(':branch', $branch, \PDO::PARAM_STR);
|
$stmt->bindValue(':branch', $branch, \PDO::PARAM_STR);
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +184,6 @@ class BuildStore extends BuildStoreBase
|
||||||
} else {
|
} else {
|
||||||
return $rtn;
|
return $rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,6 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php print $data['error_html']; ?>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,14 @@
|
||||||
|
|
||||||
<!-- Main content -->
|
<!-- Main content -->
|
||||||
<section class="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; ?>
|
<?php print $content; ?>
|
||||||
</section><!-- /.content -->
|
</section><!-- /.content -->
|
||||||
</aside><!-- /.content-wrapper -->
|
</aside><!-- /.content-wrapper -->
|
||||||
|
|
|
||||||
24
README.md
|
|
@ -11,7 +11,13 @@ 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: [](https://gitter.im/Block8/PHPCI?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
|
We have a chat room for discussing PHPCI, you can access it here: [](https://gitter.im/Block8/PHPCI?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
|
||||||
|
|
||||||
##What it does:
|
**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
|
* Clones your project from Github, Bitbucket or a local path
|
||||||
* Allows you to set up and tear down test databases.
|
* Allows you to set up and tear down test databases.
|
||||||
* Installs your project's Composer dependencies.
|
* Installs your project's Composer dependencies.
|
||||||
|
|
@ -19,17 +25,17 @@ We have a chat room for discussing PHPCI, you can access it here: [
|
* You can mark certain plugins as being allowed to fail (but still run.)
|
||||||
|
|
||||||
##What it doesn't do (yet):
|
### What it doesn't do (yet):
|
||||||
* Virtualised testing. *(In progress)*
|
* Virtualised testing.
|
||||||
* Multiple PHP-version tests. *(In progress)*
|
* Multiple PHP-version tests.
|
||||||
* Install PEAR or PECL extensions.
|
* Install PEAR or PECL extensions.
|
||||||
* [Deployments](http://phpdeployment.org)
|
* Deployments - We strongly recommend using [Deployer](http://phpdeployment.org)
|
||||||
|
|
||||||
## Getting Started:
|
## Getting Started:
|
||||||
We've got documentation on our website on [installing PHPCI](https://www.phptesting.org/install-phpci) and [adding support for PHPCI to your projects](https://www.phptesting.org/wiki/Adding-PHPCI-Support-to-Your-Projects).
|
We've got documentation on our website on [installing PHPCI](https://www.phptesting.org/install-phpci) and [adding support for PHPCI to your projects](https://www.phptesting.org/wiki/Adding-PHPCI-Support-to-Your-Projects).
|
||||||
|
|
||||||
##Contributing
|
## Contributing
|
||||||
Contributions from others would be very much appreciated! Please read our [guide to contributing](https://www.phptesting.org/wiki/Contributing-to-PHPCI) for more information on how to get involved.
|
Contributions from others would be very much appreciated! Please read our [guide to contributing](https://github.com/Block8/PHPCI/blob/master/.github/CONTRIBUTING.md) for more information on how to get involved.
|
||||||
|
|
||||||
##Questions?
|
## Questions?
|
||||||
Your best place to go is the [mailing list](https://groups.google.com/forum/#!forum/php-ci), if you're already a member of the mailing list, you can simply email php-ci@googlegroups.com.
|
Your best place to go is the [mailing list](https://groups.google.com/forum/#!forum/php-ci). If you're already a member of the mailing list, you can simply email php-ci@googlegroups.com.
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
|
||||||
'--admin-name' => 'phpci4',
|
'--admin-name' => 'phpci4',
|
||||||
'--admin-pass' => 'phpci5',
|
'--admin-pass' => 'phpci5',
|
||||||
'--url' => 'http://test.phpci.org',
|
'--url' => 'http://test.phpci.org',
|
||||||
|
'--queue-disabled' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!is_null($exclude)) {
|
if (!is_null($exclude)) {
|
||||||
|
|
|
||||||
460
composer.lock
generated
2
console
|
|
@ -22,6 +22,7 @@ use PHPCI\Command\PollCommand;
|
||||||
use PHPCI\Command\CreateAdminCommand;
|
use PHPCI\Command\CreateAdminCommand;
|
||||||
use PHPCI\Command\CreateBuildCommand;
|
use PHPCI\Command\CreateBuildCommand;
|
||||||
use PHPCI\Command\WorkerCommand;
|
use PHPCI\Command\WorkerCommand;
|
||||||
|
use PHPCI\Command\RebuildQueueCommand;
|
||||||
use PHPCI\Service\BuildService;
|
use PHPCI\Service\BuildService;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use b8\Store\Factory;
|
use b8\Store\Factory;
|
||||||
|
|
@ -38,5 +39,6 @@ $application->add(new PollCommand($loggerConfig->getFor('PollCommand')));
|
||||||
$application->add(new CreateAdminCommand(Factory::getStore('User')));
|
$application->add(new CreateAdminCommand(Factory::getStore('User')));
|
||||||
$application->add(new CreateBuildCommand(Factory::getStore('Project'), new BuildService(Factory::getStore('Build'))));
|
$application->add(new CreateBuildCommand(Factory::getStore('Project'), new BuildService(Factory::getStore('Build'))));
|
||||||
$application->add(new WorkerCommand($loggerConfig->getFor('WorkerCommand')));
|
$application->add(new WorkerCommand($loggerConfig->getFor('WorkerCommand')));
|
||||||
|
$application->add(new RebuildQueueCommand($loggerConfig->getFor('RebuildQueueCommand')));
|
||||||
|
|
||||||
$application->run();
|
$application->run();
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7 KiB |
|
Before Width: | Height: | Size: 8 KiB After Width: | Height: | Size: 7 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 374 KiB |
|
Before Width: | Height: | Size: 369 KiB After Width: | Height: | Size: 341 KiB |
|
Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 355 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 569 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 451 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 147 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 345 B |
|
Before Width: | Height: | Size: 1,022 B After Width: | Height: | Size: 1,009 B |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 20 KiB |
|
|
@ -89,7 +89,7 @@ var locPlugin = ActiveBuild.UiPlugin.extend({
|
||||||
drawChart: function () {
|
drawChart: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if ($('#information').hasClass('active') && self.chartData) {
|
if ($('#information').hasClass('active') && self.chartData && self.lastData) {
|
||||||
$('#build-lines-chart').show();
|
$('#build-lines-chart').show();
|
||||||
|
|
||||||
var ctx = $("#phploc-lines-chart").get(0).getContext("2d");
|
var ctx = $("#phploc-lines-chart").get(0).getContext("2d");
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,12 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
for (var key in self.keys) {
|
for (var key in self.keys) {
|
||||||
self.chartData[i].data.push(parseInt(self.data[build][key]));
|
|
||||||
|
self.chartData.datasets[i].data.push(parseInt(self.data[build][key]));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(self.chartData);
|
|
||||||
|
|
||||||
self.drawChart();
|
self.drawChart();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||