Merge branch 'feature-improvements'
This commit is contained in:
commit
f4b45e142e
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -26,7 +26,7 @@ Change Log
|
|||
|
||||
* **Fixed multiple install command execution (Now admin and project group don't duplicate).**
|
||||
* Added yaml highlight for build config in project page.
|
||||
* Improved Gogs support. Thanks to @vinpel. PullRequest #18.
|
||||
* Improved Gogs support. Thanks to [@vinpel](https://github.com/vinpel). PullRequest #18.
|
||||
* Improved dashboard UI.
|
||||
|
||||
|
||||
|
@ -56,9 +56,9 @@ cd ./php-censor.local
|
|||
```
|
||||
|
||||
* Added caching for public build status badge. Issue #15.
|
||||
* Added build from Gogs (build type and webhook). The feature is based on @denji`s code. Issue #13.
|
||||
* Improved Codeception plugin. Thanks to @vinpel. PullRequest #16.
|
||||
* Updated french translation. Thanks to @vinpel. PullRequest #16.
|
||||
* Added build from Gogs (build type and webhook). The feature is based on [@denji](https://github.com/denji)'s code. Issue #13.
|
||||
* Improved Codeception plugin. Thanks to [@vinpel](https://github.com/vinpel). PullRequest #16.
|
||||
* Updated french translation. Thanks to [@vinpel](https://github.com/vinpel). PullRequest #16.
|
||||
* Fixed init language. Issue #9.
|
||||
|
||||
|
||||
|
@ -147,7 +147,8 @@ php-censor:
|
|||
mail_attribute: mail
|
||||
```
|
||||
|
||||
If you enter by new LDAP-user, the record in the DB will be created automatically. The basement of the feature is @Adirelle and @dzolotov code.
|
||||
If you enter by new LDAP-user, the record in the DB will be created automatically. The basement of the feature is
|
||||
[@Adirelle](https://github.com/Adirelle) and [@dzolotov](https://github.com/dzolotov) code.
|
||||
|
||||
* **Unified application configuration (app/config.yml) authentication options**
|
||||
|
||||
|
|
19
README.md
19
README.md
|
@ -29,24 +29,25 @@ More [screenshots](docs/en/screenshots.md).
|
|||
System requirements
|
||||
-------------------
|
||||
|
||||
* Unix-like OS (**Windows isn't supported**)
|
||||
* Unix-like OS (**Windows isn't supported**);
|
||||
|
||||
* PHP 5.6+ (with OpenSSL support and enabled functions: `exec()`, `shell_exec()` and `proc_open()`)
|
||||
* PHP 5.6+ (with OpenSSL support and enabled functions: `exec()`, `shell_exec()` and `proc_open()`);
|
||||
|
||||
* Web-server (Nginx or Apache2)
|
||||
* Web-server (Nginx or Apache2);
|
||||
|
||||
* Database (MySQL/MariaDB or PostgreSQL)
|
||||
* Database (MySQL/MariaDB or PostgreSQL);
|
||||
|
||||
* Beanstalkd queue (Optional)
|
||||
* Beanstalkd queue (Optional);
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Clone project from Github, Bitbucket, Gitlab, Git, Mercurial, SVN or from local directory;
|
||||
|
||||
* Set up and tear down database tests for PostgreSQL, MySQL or SQLite;
|
||||
* Set up and tear down database tests for [PostgreSQL](docs/plugins/pgsql.md), [MySQL](docs/plugins/mysql.md) or
|
||||
[SQLite](docs/plugins/sqlite.md);
|
||||
|
||||
* Install Composer dependencies;
|
||||
* Install [Composer](docs/plugins/composer.md) dependencies;
|
||||
|
||||
* Run tests for PHPUnit, Atoum, Behat, Codeception and PHPSpec;
|
||||
|
||||
|
@ -56,7 +57,9 @@ PHPMessDetect, PHPTalLint and TechnicalDept;
|
|||
* Run through any combination of the other [supported plugins](docs/en/README.md), including Campfire, CleanBuild,
|
||||
CopyBuild, Deployer, Env, Git, Grunt, Gulp, PackageBuild, Phar, Phing, Shell and Wipe;
|
||||
|
||||
* Send notifications on Email, XMPP, Slack, IRC, Flowdock and HipChat;
|
||||
* Send notifications on Email, XMPP, Slack, IRC, Flowdock, HipChat and [Telegram](https://github.com/LEXASOFT/PHP-Censor-Telegram-Plugin);
|
||||
|
||||
* Use your LDAP-server for authentication;
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
|
|
@ -27,6 +27,8 @@ Using PHP Censor
|
|||
Plugins
|
||||
-------
|
||||
|
||||
### Internal plugins
|
||||
|
||||
* [Atoum](plugins/atoum.md) - `atoum`
|
||||
* [Behat](plugins/behat.md) - `behat`
|
||||
* [Campfire](plugins/campfire.md) - `campfire`
|
||||
|
@ -61,3 +63,7 @@ Plugins
|
|||
* [Slack](plugins/slack_notify.md) - `slack_notify`
|
||||
* [Technical Debt](plugins/technical_dept.md) - `technical_debt`
|
||||
* [XMPP](plugins/xmpp.md) - `xmpp`
|
||||
|
||||
### Third-party plugins
|
||||
|
||||
* [Telegram](https://github.com/LEXASOFT/PHP-Censor-Telegram-Plugin) - Telegram plugin by [@LEXASOFT](https://github.com/LEXASOFT)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
Automatically building commits pushed to GitHub
|
||||
===============================================
|
||||
|
||||
If you would like your builds to run automatically whenever there is a commit or other similar activity in your GitHub repository, perform the following steps:
|
||||
If you would like your builds to run automatically whenever there is a commit or other similar activity in your GitHub
|
||||
repository, perform the following steps:
|
||||
|
||||
1. Log into PHP Censor.
|
||||
2. Click on your GitHub project.
|
||||
|
@ -11,4 +12,5 @@ If you would like your builds to run automatically whenever there is a commit or
|
|||
6. Click on "Webhooks & Services".
|
||||
7. Add your web hook link you copied above, and specify when you would like it to run.
|
||||
8. Add the public key for the project in PHP Censor to the deploy keys for the repository on GitHub.
|
||||
9. Verify that the initial test delivery was successful. If not, make sure that your PHP Censor machine is reachable from the internet.
|
||||
9. Verify that the initial test delivery was successful. If not, make sure that your PHP Censor machine is reachable
|
||||
from the internet.
|
||||
|
|
|
@ -36,7 +36,7 @@ class RunCommand extends Command
|
|||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $maxBuilds = 100;
|
||||
protected $maxBuilds = 10;
|
||||
|
||||
/**
|
||||
* @param \Monolog\Logger $logger
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Plugin;
|
||||
|
||||
use PHPCensor\Builder;
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Model\BuildError;
|
||||
use PHPCensor\Plugin;
|
||||
|
@ -19,9 +11,7 @@ use PHPCensor\ZeroConfigPluginInterface;
|
|||
/**
|
||||
* PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing.
|
||||
*
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
* @package PHPCI
|
||||
* @subpackage Plugins
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
class PhpCpd extends Plugin implements ZeroConfigPluginInterface
|
||||
{
|
||||
|
@ -85,49 +75,51 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Runs PHP Copy/Paste Detector in a specified directory.
|
||||
*/
|
||||
* Runs PHP Copy/Paste Detector in a specified directory.
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$ignore = '';
|
||||
if (count($this->ignore)) {
|
||||
$map = function ($item) {
|
||||
// remove the trailing slash
|
||||
$item = rtrim($item, DIRECTORY_SEPARATOR);
|
||||
$ignore = '';
|
||||
$namesExclude = ' --names-exclude ';
|
||||
|
||||
if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
|
||||
return ' --names-exclude ' . $item;
|
||||
} else {
|
||||
return ' --exclude ' . $item;
|
||||
}
|
||||
foreach ($this->ignore as $item) {
|
||||
$item = rtrim($item, DIRECTORY_SEPARATOR);
|
||||
if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
|
||||
$ignoredFile = explode('/', $item);
|
||||
$filesToIgnore[] = array_pop($ignoredFile);
|
||||
} else {
|
||||
$ignore .= ' --exclude ' . $item;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
$ignore = array_map($map, $this->ignore);
|
||||
|
||||
$ignore = implode('', $ignore);
|
||||
if (isset($filesToIgnore)) {
|
||||
$filesToIgnore = $namesExclude . implode(',', $filesToIgnore);
|
||||
$ignore = $ignore . $filesToIgnore;
|
||||
}
|
||||
|
||||
$phpcpd = $this->builder->findBinary('phpcpd');
|
||||
|
||||
$tmpfilename = tempnam('/tmp', 'phpcpd');
|
||||
$tmpFileName = tempnam('/tmp', 'phpcpd');
|
||||
|
||||
$cmd = $phpcpd . ' --log-pmd "%s" %s "%s"';
|
||||
$success = $this->builder->executeCommand($cmd, $tmpfilename, $ignore, $this->path);
|
||||
$cmd = $phpcpd . ' --log-pmd "%s" %s "%s"';
|
||||
$success = $this->builder->executeCommand($cmd, $tmpFileName, $ignore, $this->path);
|
||||
|
||||
print $this->builder->getLastOutput();
|
||||
$errorCount = $this->processReport(file_get_contents($tmpFileName));
|
||||
|
||||
$errorCount = $this->processReport(file_get_contents($tmpfilename));
|
||||
$this->build->storeMeta('phpcpd-warnings', $errorCount);
|
||||
|
||||
unlink($tmpfilename);
|
||||
unlink($tmpFileName);
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the PHPCPD XML report.
|
||||
*
|
||||
* @param $xmlString
|
||||
* @return array
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function processReport($xmlString)
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<h3 class="timeline-header">
|
||||
<a href="<?php print APP_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
|
||||
<?php print $build->getProject()->getTitle(); ?>
|
||||
</a> (<?= $build->getProject()->getBranch(); ?>)
|
||||
</a>
|
||||
-
|
||||
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
|
||||
Build #<?php print $build->getId(); ?>
|
||||
|
@ -62,6 +62,7 @@
|
|||
</h3>
|
||||
|
||||
<div class="timeline-body">
|
||||
<a href="<?php echo $build->getBranchLink();?>"><?php echo $build->getProject()->getBranch(); ?></a> -
|
||||
<?php
|
||||
if ($build->getCommitId() !== 'Manual') {
|
||||
print sprintf(
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<h3 class="timeline-header">
|
||||
<a href="<?php print APP_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
|
||||
<?php print $build->getProject()->getTitle(); ?>
|
||||
</a> (<?= $build->getProject()->getBranch(); ?>)
|
||||
</a>
|
||||
-
|
||||
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
|
||||
Build #<?php print $build->getId(); ?>
|
||||
|
@ -88,6 +88,7 @@
|
|||
</h3>
|
||||
|
||||
<div class="timeline-body">
|
||||
<a href="<?php echo $build->getBranchLink();?>"><?php echo $build->getProject()->getBranch(); ?></a> -
|
||||
<?php
|
||||
if ($build->getCommitId() !== 'Manual') {
|
||||
print sprintf(
|
||||
|
|
|
@ -40,17 +40,6 @@ switch($build->getStatus())
|
|||
<tr>
|
||||
<td><a href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
|
||||
<td><?php print $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td><a href="<?php echo APP_URL ?>project/view/<?php print $build->getProjectId(); ?>">
|
||||
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?>"></i>
|
||||
|
||||
<?php
|
||||
if (is_object($build->getProject())) {
|
||||
print htmlspecialchars($build->getProject()->getTitle());
|
||||
} else {
|
||||
print ' - ';
|
||||
}
|
||||
?></a></td>
|
||||
|
||||
<td class="hidden-md hidden-sm hidden-xs">
|
||||
<?php
|
||||
if ($build->getCommitId() !== 'Manual') {
|
||||
|
@ -70,6 +59,9 @@ switch($build->getStatus())
|
|||
<td>
|
||||
<span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<?php print $build->getDuration(); ?> <?= Lang::get('seconds'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group btn-group-right">
|
||||
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
|
||||
|
|
|
@ -55,23 +55,74 @@
|
|||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('builds'); ?> (<?php print $total; ?>)</h3>
|
||||
</div>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php Lang::out('id'); ?></th>
|
||||
<th><?php Lang::out('date'); ?></th>
|
||||
<th><?php Lang::out('project'); ?></th>
|
||||
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
||||
<th><?php Lang::out('branch'); ?></th>
|
||||
<th><?php Lang::out('status'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="latest-builds">
|
||||
<?php print $builds; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php Lang::out('id'); ?></th>
|
||||
<th><?php Lang::out('date'); ?></th>
|
||||
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
||||
<th><?php Lang::out('branch'); ?></th>
|
||||
<th><?php Lang::out('status'); ?></th>
|
||||
<th><?php Lang::out('duration'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="latest-builds">
|
||||
<?php print $builds; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
print '<div><ul class="pagination">';
|
||||
|
||||
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
|
||||
|
||||
if ($page > 1) {
|
||||
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
|
||||
}
|
||||
|
||||
if ($pages > 1) {
|
||||
|
||||
$start = $page - 3;
|
||||
|
||||
if ($start <= 0) {
|
||||
$start = 1;
|
||||
}
|
||||
|
||||
$end = $page + 3;
|
||||
|
||||
if ($end > $pages) {
|
||||
$end = $pages;
|
||||
}
|
||||
|
||||
if ($start > 1) {
|
||||
print '<li><a href="' . $project_url . '">1...</a></li>';
|
||||
}
|
||||
|
||||
for($i = $start; $i <= $end; $i++)
|
||||
{
|
||||
if ($pages > $end && $i == $pages) continue;
|
||||
|
||||
if ($i == $page) {
|
||||
print '<li class="bg-blue"><span>' . $i . '</span></li>';
|
||||
} else {
|
||||
print '<li><a href="' . $project_url . '?p=' . $i . '">' . $i . '</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($pages > $end) {
|
||||
print '<li><a href="' . $project_url . '?p='.$pages.'">...'.$pages.'</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($page < $pages - 1) {
|
||||
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
|
||||
}
|
||||
|
||||
print '</ul></div>';
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-md-4 col-sm-4">
|
||||
|
@ -138,58 +189,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
print '<div><ul class="pagination">';
|
||||
|
||||
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
|
||||
|
||||
if ($page > 1) {
|
||||
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
|
||||
}
|
||||
|
||||
if ($pages > 1) {
|
||||
|
||||
$start = $page - 3;
|
||||
|
||||
if ($start <= 0) {
|
||||
$start = 1;
|
||||
}
|
||||
|
||||
$end = $page + 3;
|
||||
|
||||
if ($end > $pages) {
|
||||
$end = $pages;
|
||||
}
|
||||
|
||||
if ($start > 1) {
|
||||
print '<li><a href="' . $project_url . '">1...</a></li>';
|
||||
}
|
||||
|
||||
for($i = $start; $i <= $end; $i++)
|
||||
{
|
||||
if ($pages > $end && $i == $pages) continue;
|
||||
|
||||
if ($i == $page) {
|
||||
print '<li class="bg-blue"><span>' . $i . '</span></li>';
|
||||
} else {
|
||||
print '<li><a href="' . $project_url . '?p=' . $i . '">' . $i . '</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($pages > $end) {
|
||||
print '<li><a href="' . $project_url . '?p='.$pages.'">...'.$pages.'</a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($page < $pages - 1) {
|
||||
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
|
||||
}
|
||||
|
||||
print '</ul></div>';
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#delete-project').on('click', function (e) {
|
||||
|
|
Loading…
Reference in a new issue