Merge ec47a93e23
into 6053f0f748
This commit is contained in:
commit
5d7ab2a2d9
|
@ -121,14 +121,26 @@ class Builder
|
||||||
$commitId = $this->build->getCommitId();
|
$commitId = $this->build->getCommitId();
|
||||||
$url = $this->build->getProject()->getGitUrl();
|
$url = $this->build->getProject()->getGitUrl();
|
||||||
$key = $this->build->getProject()->getGitKey();
|
$key = $this->build->getProject()->getGitKey();
|
||||||
|
$type = $this->build->getProject()->getType();
|
||||||
|
|
||||||
$buildId = 'project' . $this->build->getProject()->getId() . '-build' . $this->build->getId();
|
$buildId = 'project' . $this->build->getProject()->getId() . '-build' . $this->build->getId();
|
||||||
|
|
||||||
$this->ciDir = realpath(dirname(__FILE__) . '/../') . '/';
|
$this->ciDir = realpath(dirname(__FILE__) . '/../') . '/';
|
||||||
$this->buildPath = $this->ciDir . 'build/' . $buildId . '/';
|
$this->buildPath = $this->ciDir . 'build/' . $buildId . '/';
|
||||||
|
|
||||||
mkdir($this->buildPath, 0777, true);
|
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'local':
|
||||||
|
$reference = $this->build->getProject()->getReference();
|
||||||
|
$this->buildPath = $this->ciDir . 'build/' . $buildId;
|
||||||
|
if(is_link($this->buildPath) && is_file($this->buildPath)) {
|
||||||
|
} else {
|
||||||
|
symlink($reference, $this->buildPath);
|
||||||
|
}
|
||||||
|
$this->buildPath .= '/';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mkdir($this->buildPath, 0777, true);
|
||||||
if(!empty($key))
|
if(!empty($key))
|
||||||
{
|
{
|
||||||
// Do an SSH clone:
|
// Do an SSH clone:
|
||||||
|
@ -143,6 +155,8 @@ class Builder
|
||||||
// Do an HTTP clone:
|
// Do an HTTP clone:
|
||||||
$this->executeCommand('git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath);
|
$this->executeCommand('git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(!is_file($this->buildPath . 'phpci.yml'))
|
if(!is_file($this->buildPath . 'phpci.yml'))
|
||||||
{
|
{
|
||||||
|
@ -179,6 +193,11 @@ class Builder
|
||||||
|
|
||||||
protected function executePlugins($stage)
|
protected function executePlugins($stage)
|
||||||
{
|
{
|
||||||
|
if ( !array_key_exists($stage, $this->config) || !is_array($this->config[$stage]) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach($this->config[$stage] as $plugin => $options)
|
foreach($this->config[$stage] as $plugin => $options)
|
||||||
{
|
{
|
||||||
$this->log('');
|
$this->log('');
|
||||||
|
|
|
@ -180,15 +180,15 @@ class ProjectController extends b8\Controller
|
||||||
|
|
||||||
$field = new Form\Element\Select('type');
|
$field = new Form\Element\Select('type');
|
||||||
$field->setRequired(true);
|
$field->setRequired(true);
|
||||||
$field->setOptions(array('github' => 'Github', 'bitbucket' => 'Bitbucket'));
|
$field->setOptions(array('github' => 'Github', 'bitbucket' => 'Bitbucket', 'local' => 'Local FS'));
|
||||||
$field->setLabel('Where is your project hosted?');
|
$field->setLabel('Where is your project hosted?');
|
||||||
$field->setClass('span4');
|
$field->setClass('span4');
|
||||||
$form->addField($field);
|
$form->addField($field);
|
||||||
|
|
||||||
$field = new Form\Element\Text('reference');
|
$field = new Form\Element\Text('reference');
|
||||||
$field->setRequired(true);
|
$field->setRequired(true);
|
||||||
$field->setPattern('[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+');
|
// $field->setPattern('[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+');
|
||||||
$field->setLabel('Repository Name on Github / Bitbucket (e.g. block8/phpci)');
|
$field->setLabel('Repository Name on Github / Bitbucket (e.g. block8/phpci) or directory location');
|
||||||
$field->setClass('span4');
|
$field->setClass('span4');
|
||||||
$form->addField($field);
|
$form->addField($field);
|
||||||
|
|
||||||
|
|
|
@ -67,65 +67,43 @@ class BuildBase extends Model
|
||||||
'type' => 'int',
|
'type' => 'int',
|
||||||
'length' => '11',
|
'length' => '11',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'commit_id' => array(
|
'commit_id' => array(
|
||||||
'type' => 'varchar',
|
'type' => 'varchar',
|
||||||
'length' => '50',
|
'length' => '50',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'status' => array(
|
'status' => array(
|
||||||
'type' => 'tinyint',
|
'type' => 'tinyint',
|
||||||
'length' => '4',
|
'length' => '4',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'log' => array(
|
'log' => array(
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'length' => '',
|
'length' => '',
|
||||||
'nullable' => true,
|
'nullable' => true,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'branch' => array(
|
'branch' => array(
|
||||||
'type' => 'varchar',
|
'type' => 'varchar',
|
||||||
'length' => '50',
|
'length' => '50',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'created' => array(
|
'created' => array(
|
||||||
'type' => 'datetime',
|
'type' => 'datetime',
|
||||||
'length' => '',
|
'length' => '',
|
||||||
'nullable' => true,
|
'nullable' => true,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'started' => array(
|
'started' => array(
|
||||||
'type' => 'datetime',
|
'type' => 'datetime',
|
||||||
'length' => '',
|
'length' => '',
|
||||||
'nullable' => true,
|
'nullable' => true,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'finished' => array(
|
'finished' => array(
|
||||||
'type' => 'datetime',
|
'type' => 'datetime',
|
||||||
'length' => '',
|
'length' => '',
|
||||||
'nullable' => true,
|
'nullable' => true,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
public $indexes = array(
|
public $indexes = array(
|
||||||
|
@ -277,7 +255,7 @@ class BuildBase extends Model
|
||||||
{
|
{
|
||||||
$this->_validateNotNull('Status', $value);
|
$this->_validateNotNull('Status', $value);
|
||||||
$this->_validateInt('Status', $value);
|
$this->_validateInt('Status', $value);
|
||||||
if($this->_data['status'] == $value)
|
if($this->_data['status'] === $value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ class ProjectBase extends Model
|
||||||
{
|
{
|
||||||
$this->_validateNotNull('Title', $value);
|
$this->_validateNotNull('Title', $value);
|
||||||
$this->_validateString('Title', $value);
|
$this->_validateString('Title', $value);
|
||||||
if($this->_data['title'] == $value)
|
if($this->_data['title'] === $value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ class ProjectBase extends Model
|
||||||
{
|
{
|
||||||
$this->_validateNotNull('Reference', $value);
|
$this->_validateNotNull('Reference', $value);
|
||||||
$this->_validateString('Reference', $value);
|
$this->_validateString('Reference', $value);
|
||||||
if($this->_data['reference'] == $value)
|
if($this->_data['reference'] === $value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ class ProjectBase extends Model
|
||||||
{
|
{
|
||||||
$this->_validateNotNull('GitKey', $value);
|
$this->_validateNotNull('GitKey', $value);
|
||||||
$this->_validateString('GitKey', $value);
|
$this->_validateString('GitKey', $value);
|
||||||
if($this->_data['git_key'] == $value)
|
if($this->_data['git_key'] === $value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ class ProjectBase extends Model
|
||||||
{
|
{
|
||||||
$this->_validateNotNull('Type', $value);
|
$this->_validateNotNull('Type', $value);
|
||||||
$this->_validateString('Type', $value);
|
$this->_validateString('Type', $value);
|
||||||
if($this->_data['type'] == $value)
|
if($this->_data['type'] === $value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,10 @@ class PhpUnit implements \PHPCI\Plugin
|
||||||
|
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpunit ' . $this->args . ' ' . $this->phpci->buildPath . $this->directory);
|
$curdir = getcwd();
|
||||||
|
chdir($this->phpci->buildPath);
|
||||||
|
$success = $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpunit ' . $this->args . ' ' . $this->phpci->buildPath . $this->directory);
|
||||||
|
chdir($curdir);
|
||||||
|
return $success;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@
|
||||||
"require": {
|
"require": {
|
||||||
"block8/b8framework": "dev-master",
|
"block8/b8framework": "dev-master",
|
||||||
"phpunit/phpunit": "3.*",
|
"phpunit/phpunit": "3.*",
|
||||||
|
"phpunit/php-code-coverage": "1.2.x",
|
||||||
"phpmd/phpmd" : "1.*",
|
"phpmd/phpmd" : "1.*",
|
||||||
"sebastian/phpcpd": "1.*",
|
"sebastian/phpcpd": "1.*",
|
||||||
"squizlabs/php_codesniffer": "1.*",
|
"squizlabs/php_codesniffer": "1.*",
|
||||||
|
|
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 198 B |
Loading…
Reference in a new issue