Sorted out a file only type
Sorted out some indentation Check if array etc Fixes for phpunit Current working directory in phpunit php code coverage in composer.json
This commit is contained in:
parent
53675c940f
commit
8502212c7c
|
@ -121,27 +121,41 @@ class Builder
|
|||
$commitId = $this->build->getCommitId();
|
||||
$url = $this->build->getProject()->getGitUrl();
|
||||
$key = $this->build->getProject()->getGitKey();
|
||||
$type = $this->build->getProject()->getType();
|
||||
|
||||
$buildId = 'project' . $this->build->getProject()->getId() . '-build' . $this->build->getId();
|
||||
|
||||
$this->ciDir = realpath(dirname(__FILE__) . '/../') . '/';
|
||||
$this->buildPath = $this->ciDir . 'build/' . $buildId . '/';
|
||||
|
||||
mkdir($this->buildPath, 0777, true);
|
||||
|
||||
if(!empty($key))
|
||||
{
|
||||
// Do an SSH clone:
|
||||
$keyFile = $this->ciDir . 'build/' . $buildId . '.key';
|
||||
file_put_contents($keyFile, $key);
|
||||
chmod($keyFile, 0600);
|
||||
$this->executeCommand('ssh-agent ssh-add '.$keyFile.' && git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath.' && ssh-agent -k');
|
||||
unlink($keyFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do an HTTP clone:
|
||||
$this->executeCommand('git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath);
|
||||
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))
|
||||
{
|
||||
// Do an SSH clone:
|
||||
$keyFile = $this->ciDir . 'build/' . $buildId . '.key';
|
||||
file_put_contents($keyFile, $key);
|
||||
chmod($keyFile, 0600);
|
||||
$this->executeCommand('ssh-agent ssh-add '.$keyFile.' && git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath.' && ssh-agent -k');
|
||||
unlink($keyFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do an HTTP clone:
|
||||
$this->executeCommand('git clone -b ' .$this->build->getBranch() . ' ' .$url.' '.$this->buildPath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(!is_file($this->buildPath . 'phpci.yml'))
|
||||
|
@ -179,6 +193,10 @@ class Builder
|
|||
|
||||
protected function executePlugins($stage)
|
||||
{
|
||||
if ( array_key_exists($stage, $this->config) && !is_array($this->config[$stage]) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach($this->config[$stage] as $plugin => $options)
|
||||
{
|
||||
$this->log('');
|
||||
|
|
|
@ -16,126 +16,104 @@ class BuildBase extends Model
|
|||
protected $_tableName = 'build';
|
||||
protected $_modelName = 'Build';
|
||||
protected $_data = array(
|
||||
'id' => null,
|
||||
'project_id' => null,
|
||||
'commit_id' => null,
|
||||
'status' => null,
|
||||
'log' => null,
|
||||
'branch' => null,
|
||||
'created' => null,
|
||||
'started' => null,
|
||||
'finished' => null,
|
||||
);
|
||||
'id' => null,
|
||||
'project_id' => null,
|
||||
'commit_id' => null,
|
||||
'status' => null,
|
||||
'log' => null,
|
||||
'branch' => null,
|
||||
'created' => null,
|
||||
'started' => null,
|
||||
'finished' => null,
|
||||
);
|
||||
protected $_getters = array(
|
||||
'id' => 'getId',
|
||||
'project_id' => 'getProjectId',
|
||||
'commit_id' => 'getCommitId',
|
||||
'status' => 'getStatus',
|
||||
'log' => 'getLog',
|
||||
'branch' => 'getBranch',
|
||||
'created' => 'getCreated',
|
||||
'started' => 'getStarted',
|
||||
'finished' => 'getFinished',
|
||||
'id' => 'getId',
|
||||
'project_id' => 'getProjectId',
|
||||
'commit_id' => 'getCommitId',
|
||||
'status' => 'getStatus',
|
||||
'log' => 'getLog',
|
||||
'branch' => 'getBranch',
|
||||
'created' => 'getCreated',
|
||||
'started' => 'getStarted',
|
||||
'finished' => 'getFinished',
|
||||
|
||||
'Project' => 'getProject',
|
||||
'Project' => 'getProject',
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
protected $_setters = array(
|
||||
'id' => 'setId',
|
||||
'project_id' => 'setProjectId',
|
||||
'commit_id' => 'setCommitId',
|
||||
'status' => 'setStatus',
|
||||
'log' => 'setLog',
|
||||
'branch' => 'setBranch',
|
||||
'created' => 'setCreated',
|
||||
'started' => 'setStarted',
|
||||
'finished' => 'setFinished',
|
||||
'id' => 'setId',
|
||||
'project_id' => 'setProjectId',
|
||||
'commit_id' => 'setCommitId',
|
||||
'status' => 'setStatus',
|
||||
'log' => 'setLog',
|
||||
'branch' => 'setBranch',
|
||||
'created' => 'setCreated',
|
||||
'started' => 'setStarted',
|
||||
'finished' => 'setFinished',
|
||||
|
||||
'Project' => 'setProject',
|
||||
);
|
||||
'Project' => 'setProject',
|
||||
);
|
||||
public $columns = array(
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => '11',
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => '11',
|
||||
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
|
||||
),
|
||||
'project_id' => array(
|
||||
'type' => 'int',
|
||||
'length' => '11',
|
||||
),
|
||||
'project_id' => array(
|
||||
'type' => 'int',
|
||||
'length' => '11',
|
||||
|
||||
),
|
||||
'commit_id' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => '50',
|
||||
|
||||
),
|
||||
'status' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
|
||||
),
|
||||
'log' => array(
|
||||
'type' => 'text',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
|
||||
),
|
||||
'commit_id' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => '50',
|
||||
),
|
||||
'branch' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => '50',
|
||||
|
||||
),
|
||||
'created' => array(
|
||||
'type' => 'datetime',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
|
||||
|
||||
|
||||
),
|
||||
'status' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
|
||||
|
||||
|
||||
|
||||
),
|
||||
'log' => array(
|
||||
'type' => 'text',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
|
||||
|
||||
|
||||
),
|
||||
'branch' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => '50',
|
||||
|
||||
|
||||
|
||||
|
||||
),
|
||||
'created' => array(
|
||||
'type' => 'datetime',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
|
||||
|
||||
|
||||
),
|
||||
'started' => array(
|
||||
'type' => 'datetime',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
|
||||
|
||||
|
||||
),
|
||||
'finished' => array(
|
||||
'type' => 'datetime',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
|
||||
|
||||
|
||||
),
|
||||
);
|
||||
),
|
||||
'started' => array(
|
||||
'type' => 'datetime',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
),
|
||||
'finished' => array(
|
||||
'type' => 'datetime',
|
||||
'length' => '',
|
||||
'nullable' => true,
|
||||
),
|
||||
);
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'project_id' => array('columns' => 'project_id'),
|
||||
'idx_status' => array('columns' => 'status'),
|
||||
);
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'project_id' => array('columns' => 'project_id'),
|
||||
'idx_status' => array('columns' => 'status'),
|
||||
);
|
||||
public $foreignKeys = array(
|
||||
'build_ibfk_1' => array('local_col' => 'project_id', 'update' => 'CASCADE', 'delete' => 'CASCADE', 'table' => 'project', 'col' => 'id'),
|
||||
);
|
||||
'build_ibfk_1' => array('local_col' => 'project_id', 'update' => 'CASCADE', 'delete' => 'CASCADE', 'table' => 'project', 'col' => 'id'),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ class PhpUnit implements \PHPCI\Plugin
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
"require": {
|
||||
"block8/b8framework": "dev-master",
|
||||
"phpunit/phpunit": "3.*",
|
||||
"phpunit/php-code-coverage": "1.2.x",
|
||||
"phpmd/phpmd" : "1.*",
|
||||
"sebastian/phpcpd": "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