Update GithubBuild to allow for testing pull requests, hopefully

This commit is contained in:
Dan Cryer 2014-05-12 15:18:42 +01:00
commit 1696e503b8
2 changed files with 45 additions and 12 deletions

View file

@ -65,12 +65,8 @@ class RemoteGitBuild extends Build
$cmd .= ' -b %s %s "%s"';
$success = $builder->executeCommand($cmd, $this->getBranch(), $this->getCloneUrl(), $cloneTo);
if (!empty($commit) && $commit != 'Manual') {
$cmd = 'cd "%s" && git checkout %s';
if (IS_WIN) {
$cmd = 'cd /d "%s" && git checkout %s';
}
$builder->executeCommand($cmd, $cloneTo, $this->getCommitId());
if ($success) {
$success = $this->postCloneSetup($builder, $cloneTo);
}
return $success;
@ -104,15 +100,8 @@ class RemoteGitBuild extends Build
$success = $builder->executeCommand($cmd, $this->getBranch(), $this->getCloneUrl(), $cloneTo);
// Checkout a specific commit if we need to:
$commit = $this->getCommitId();
if (!empty($commit) && $commit != 'Manual') {
$cmd = 'cd "%s" && git checkout %s';
if (IS_WIN) {
$cmd = 'cd /d "%s" && git checkout %s';
}
$builder->executeCommand($cmd, $cloneTo, $this->getCommitId());
if ($success) {
$success = $this->postCloneSetup($builder, $cloneTo);
}
// Remove the key file and git wrapper:
@ -122,6 +111,24 @@ class RemoteGitBuild extends Build
return $success;
}
protected function postCloneSetup(Builder $builder, $cloneTo)
{
$success = true;
$commit = $this->getCommitId();
if (!empty($commit) && $commit != 'Manual') {
$cmd = 'cd "%s" && git checkout %s';
if (IS_WIN) {
$cmd = 'cd /d "%s" && git checkout %s';
}
$success = $builder->executeCommand($cmd, $cloneTo, $this->getCommitId());
}
return $success;
}
/**
* Create an SSH key file on disk for this build.
* @param $cloneTo