Initial implementation CI environments
This commit is contained in:
parent
7f8b0234b9
commit
047cedaab3
21 changed files with 850 additions and 42 deletions
|
|
@ -4,6 +4,7 @@ namespace PHPCensor\Model\Build;
|
|||
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Builder;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* Remote Git Build Model
|
||||
|
|
@ -33,6 +34,10 @@ class RemoteGitBuild extends Build
|
|||
$success = $this->cloneByHttp($builder, $buildPath);
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
$success = $this->mergeBranches($builder, $buildPath);
|
||||
}
|
||||
|
||||
if (!$success) {
|
||||
$builder->logFailure('Failed to clone remote git repository.');
|
||||
return false;
|
||||
|
|
@ -41,6 +46,28 @@ class RemoteGitBuild extends Build
|
|||
return $this->handleConfig($builder, $buildPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param string $buildPath
|
||||
* @return bool
|
||||
*/
|
||||
protected function mergeBranches(Builder $builder, $buildPath)
|
||||
{
|
||||
$branches = $this->getExtra('branches');
|
||||
if (!empty($branches)) {
|
||||
$cmd = 'cd "%s" && git merge --quiet origin/%s';
|
||||
foreach ($branches as $branch) {
|
||||
$success = $builder->executeCommand($cmd, $buildPath, $branch);
|
||||
if (!$success) {
|
||||
$builder->log('Fail merge branch origin/'.$branch, LogLevel::ERROR);
|
||||
return false;
|
||||
}
|
||||
$builder->log('Merged branch origin/'.$branch, LogLevel::INFO);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use an HTTP-based git clone.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue