From ff8bd75b22eccc37c53ba87ceedfa168b0f03390 Mon Sep 17 00:00:00 2001 From: Sanpi Date: Wed, 19 Jun 2013 11:29:52 +0200 Subject: [PATCH 01/12] Add atoum plugin --- PHPCI/Plugin/Atoum.php | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 PHPCI/Plugin/Atoum.php diff --git a/PHPCI/Plugin/Atoum.php b/PHPCI/Plugin/Atoum.php new file mode 100644 index 00000000..a97fa00a --- /dev/null +++ b/PHPCI/Plugin/Atoum.php @@ -0,0 +1,51 @@ +phpci = $phpci; + + if (isset($options['executable'])) { + $this->executable = $options['executable']; + } + else { + $this->executable = './vendor/bin/atoum'; + } + + if (isset($options['args'])) { + $this->args = $options['args']; + } + + if (isset($options['config'])) { + $this->config = $options['config']; + } + + if (isset($options['directory'])) { + $this->directory = $options['directory']; + } + } + + public function execute() + { + $cmd = $this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->executable; + + if ($this->args !== null) { + $cmd .= " {$this->args}"; + } + if ($this->config !== null) { + $cmd .= " -c '{$this->config}'"; + } + if ($this->directory !== null) { + $cmd .= " -d '{$this->directory}'"; + } + return $this->phpci->executeCommand($cmd); + } +} From 895928422e17f65b279b6873887d519080c5b0b5 Mon Sep 17 00:00:00 2001 From: Daniel Holmes Date: Sun, 30 Jun 2013 18:55:25 +1000 Subject: [PATCH 02/12] Allow for bare repositories --- PHPCI/Model/Build/LocalBuild.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PHPCI/Model/Build/LocalBuild.php b/PHPCI/Model/Build/LocalBuild.php index 38e2a914..e917d2c3 100644 --- a/PHPCI/Model/Build/LocalBuild.php +++ b/PHPCI/Model/Build/LocalBuild.php @@ -25,11 +25,22 @@ class LocalBuild extends Build * Create a working copy by cloning, copying, or similar. */ public function createWorkingCopy(Builder $builder, $buildPath) - { + { $reference = $this->getProject()->getReference(); $reference = substr($reference, -1) == '/' ? substr($reference, 0, -1) : $reference; $buildPath = substr($buildPath, 0, -1); $yamlParser = new YamlParser(); + + if(is_file($reference.'config')) { + //We're probably looing at a bare repository. We'll open the config and check + $gitConfig = parse_ini_file($reference.'config'); + if($gitConfig["core"]["bare"]) { + // Looks like we're right. We need to extract the archive! + $guid = uniqid(); + $builder->executeCommand('mkdir "/tmp/%s" && git archive master | tar -x -C "/tmp/%s"', $guid, $guid); + $reference = '/tmp/'.$guid; + } + } if (!is_file($reference . '/phpci.yml')) { $builder->logFailure('Project does not contain a phpci.yml file.'); From 62e8106130e4ff501437f1b0667d9a21d774998d Mon Sep 17 00:00:00 2001 From: Daniel Holmes Date: Sun, 30 Jun 2013 19:44:02 +1000 Subject: [PATCH 03/12] Tested And Resolved --- PHPCI/Model/Build/LocalBuild.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PHPCI/Model/Build/LocalBuild.php b/PHPCI/Model/Build/LocalBuild.php index e917d2c3..856a3f7c 100644 --- a/PHPCI/Model/Build/LocalBuild.php +++ b/PHPCI/Model/Build/LocalBuild.php @@ -31,9 +31,9 @@ class LocalBuild extends Build $buildPath = substr($buildPath, 0, -1); $yamlParser = new YamlParser(); - if(is_file($reference.'config')) { + if(is_file($reference.'/config')) { //We're probably looing at a bare repository. We'll open the config and check - $gitConfig = parse_ini_file($reference.'config'); + $gitConfig = parse_ini_file($reference.'/config',TRUE); if($gitConfig["core"]["bare"]) { // Looks like we're right. We need to extract the archive! $guid = uniqid(); From 9b458060fd9dbc8b97e8376581624c30a4173f6d Mon Sep 17 00:00:00 2001 From: Daniel Holmes Date: Mon, 1 Jul 2013 00:17:41 +1000 Subject: [PATCH 04/12] Final Version. Tested on ubuntu 12.04 64bit --- PHPCI/Model/Build/LocalBuild.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/Model/Build/LocalBuild.php b/PHPCI/Model/Build/LocalBuild.php index 856a3f7c..07698d42 100644 --- a/PHPCI/Model/Build/LocalBuild.php +++ b/PHPCI/Model/Build/LocalBuild.php @@ -37,7 +37,7 @@ class LocalBuild extends Build if($gitConfig["core"]["bare"]) { // Looks like we're right. We need to extract the archive! $guid = uniqid(); - $builder->executeCommand('mkdir "/tmp/%s" && git archive master | tar -x -C "/tmp/%s"', $guid, $guid); + $builder->executeCommand('mkdir "/tmp/%s" && git --git-dir="%s" archive master | tar -x -C "/tmp/%s"', $guid, $reference, $guid); $reference = '/tmp/'.$guid; } } From 34bb69ec5eca5a4529a9b0bcbc01b43387ad2871 Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Mon, 15 Jul 2013 23:28:22 +0300 Subject: [PATCH 05/12] Added `exit` to correct redirect after `Build Now` is clicked Withow `exit` statement it's not redirected to new created build. --- PHPCI/Controller/ProjectController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index 243342c6..bbc8a7b5 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -63,6 +63,7 @@ class ProjectController extends \PHPCI\Controller $build = $this->_buildStore->save($build); header('Location: '.PHPCI_URL.'build/view/' . $build->getId()); + exit; } /** From 2576f33029a9284c1648ad47d58579eedcf72fe3 Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Mon, 15 Jul 2013 23:30:25 +0300 Subject: [PATCH 06/12] Added `exit` to correct redirect after `Rebuild` and `Delete build` is clicked Without `exit` it's not redirected. --- PHPCI/Controller/BuildController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index b41287aa..56bde07c 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -79,6 +79,7 @@ class BuildController extends \PHPCI\Controller $build = $this->_buildStore->save($build); header('Location: '.PHPCI_URL.'build/view/' . $build->getId()); + exit; } /** @@ -94,6 +95,7 @@ class BuildController extends \PHPCI\Controller $this->_buildStore->delete($build); header('Location: '.PHPCI_URL.'project/view/' . $build->getProjectId()); + exit; } /** From dc77992fd2f975f7e0462a741f8c857eb43ee019 Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Mon, 15 Jul 2013 23:56:51 +0300 Subject: [PATCH 07/12] Hide message when local repositary is used Hide message about hooks when local repositary is used --- PHPCI/View/Project/view.phtml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PHPCI/View/Project/view.phtml b/PHPCI/View/Project/view.phtml index 17b0a1ab..bb8aec03 100644 --- a/PHPCI/View/Project/view.phtml +++ b/PHPCI/View/Project/view.phtml @@ -19,8 +19,10 @@ -
-

To automatically build this project when new commits are pushed, add the URL below + getType(), array('github', 'bitbucket'))): ?> +
+

To automatically build this project when new commits are pushed, add the URL below + getType()) @@ -83,4 +85,4 @@ setInterval(function() $('#latest-builds').load('project/builds/getId(); ?>'); }, 10000); - \ No newline at end of file + From 6c76208992bf1bf7fc245b4806f97e6d75e86d3a Mon Sep 17 00:00:00 2001 From: Alexander Pirogov Date: Thu, 18 Jul 2013 14:14:22 +0300 Subject: [PATCH 08/12] added smtp_encryption config parameter --- PHPCI/Command/InstallCommand.php | 1 + PHPCI/Plugin/Email.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/PHPCI/Command/InstallCommand.php b/PHPCI/Command/InstallCommand.php index ad9cbeb7..dea4e560 100644 --- a/PHPCI/Command/InstallCommand.php +++ b/PHPCI/Command/InstallCommand.php @@ -50,6 +50,7 @@ class InstallCommand extends Command $conf['phpci']['email_settings']['smtp_address'] = $this->ask('(Optional) Smtp server address: ', true); $conf['phpci']['email_settings']['smtp_port'] = $this->ask('(Optional) Smtp port: ', true); + $conf['phpci']['email_settings']['smtp_encryption'] = $this->ask('(Optional) Smtp encryption: ', true); $conf['phpci']['email_settings']['smtp_username'] = $this->ask('(Optional) Smtp Username: ', true); $conf['phpci']['email_settings']['smtp_password'] = $this->ask('(Optional) Smtp Password: ', true); $conf['phpci']['email_settings']['from_address'] = $this->ask('(Optional) Email address to send from: ', true); diff --git a/PHPCI/Plugin/Email.php b/PHPCI/Plugin/Email.php index ae7ced05..798a01b5 100644 --- a/PHPCI/Plugin/Email.php +++ b/PHPCI/Plugin/Email.php @@ -140,7 +140,8 @@ class Email implements \PHPCI\Plugin /** @var \Swift_SmtpTransport $transport */ $transport = \Swift_SmtpTransport::newInstance( $this->getMailConfig('smtp_address'), - $this->getMailConfig('smtp_port') + $this->getMailConfig('smtp_port'), + $this->getMailConfig('smtp_encryption') ); $transport->setUsername($this->getMailConfig('smtp_username')); $transport->setPassword($this->getMailConfig('smtp_password')); @@ -164,6 +165,8 @@ class Email implements \PHPCI\Plugin return null; case 'smtp_port': return '25'; + case 'smtp_encryption': + return null; case 'from_address': return "notifications-ci@phptesting.org"; default: From a137e9c0c6e05878468a9028bb8817a471ee3620 Mon Sep 17 00:00:00 2001 From: Alexander Pirogov Date: Thu, 18 Jul 2013 16:10:55 +0300 Subject: [PATCH 09/12] added prefer_dist option to composer plugin --- PHPCI/Plugin/Composer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index 42195f52..df2da277 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -19,6 +19,7 @@ class Composer implements \PHPCI\Plugin { protected $directory; protected $action; + protected $preferDist; protected $phpci; public function __construct(\PHPCI\Builder $phpci, array $options = array()) @@ -27,6 +28,7 @@ class Composer implements \PHPCI\Plugin $this->phpci = $phpci; $this->directory = isset($options['directory']) ? $path . '/' . $options['directory'] : $path; $this->action = isset($options['action']) ? $options['action'] : 'update'; + $this->preferDist = isset($options['prefer_dist']) ? $options['prefer_dist'] : true; } /** @@ -34,7 +36,7 @@ class Composer implements \PHPCI\Plugin */ public function execute() { - $cmd = PHPCI_DIR . 'composer.phar --prefer-dist --working-dir="%s" %s'; + $cmd = PHPCI_DIR . 'composer.phar '. ($this->preferDist ? '--prefer-dist' : null) .' --working-dir="%s" %s'; return $this->phpci->executeCommand($cmd, $this->directory, $this->action); } } From 2a0e6d2401328be10c8afdd38fae2c8287965ed7 Mon Sep 17 00:00:00 2001 From: Alexander Pirogov Date: Fri, 19 Jul 2013 16:40:16 +0300 Subject: [PATCH 10/12] added rules option to phpmd plugin --- PHPCI/Plugin/PhpMessDetector.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PHPCI/Plugin/PhpMessDetector.php b/PHPCI/Plugin/PhpMessDetector.php index ea6ff959..d2a2e3dc 100644 --- a/PHPCI/Plugin/PhpMessDetector.php +++ b/PHPCI/Plugin/PhpMessDetector.php @@ -18,10 +18,16 @@ namespace PHPCI\Plugin; class PhpMessDetector implements \PHPCI\Plugin { protected $directory; + /** + * Array of PHPMD rules. Possible values: codesize, unusedcode, naming, design, controversial + * @var array + */ + protected $rules; public function __construct(\PHPCI\Builder $phpci, array $options = array()) { $this->phpci = $phpci; + $this->rules = isset($options['rules']) ? (array)$options['rules'] : array('codesize', 'unusedcode', 'naming'); } /** @@ -35,7 +41,7 @@ class PhpMessDetector implements \PHPCI\Plugin $ignore = ' --exclude ' . implode(',', $this->phpci->ignore); } - $cmd = PHPCI_BIN_DIR . 'phpmd "%s" text codesize,unusedcode,naming %s'; - return $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $ignore); + $cmd = PHPCI_BIN_DIR . 'phpmd "%s" text %s %s'; + return $this->phpci->executeCommand($cmd, $this->phpci->buildPath, implode(',', $this->rules), $ignore); } } From 585a60e9952295966eb060476b48d29ee90db63b Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 25 Jul 2013 12:36:46 +0100 Subject: [PATCH 11/12] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe84080d..16284708 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ PHPCI PHPCI is a free and open source continuous integration tool specifically designed for PHP. We've built it with simplicity in mind, so whilst it doesn't do *everything* Jenkins can do, it is a breeze to set up and use. -_**Please be aware that this is a brand new project, in an alpha state, so there will be bugs and missing features.**_ +_**Please be aware that this is a beta-release project, so there will be bugs and missing features.**_ **Current Build Status** ![Build Status](http://phpci.block8.net/build-status/image/2) ##What it does: -* Clones your project from Github, Bitbucket or a local path (support for standard remote Git repositories coming soon.) +* Clones your project from Github, Bitbucket or a local path * Allows you to set up and tear down test databases. * Installs your project's Composer dependencies. * Runs through any combination of the following plugins: @@ -28,7 +28,6 @@ _**Please be aware that this is a brand new project, in an alpha state, so there * Multiple testing workers. * Install PEAR or PECL extensions. * Deployments. -* Success / Failure emails. ##Installing PHPCI: ####Pre-requisites: From 6793a5f373296146381d0c0bc453b06787379a33 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 25 Jul 2013 13:44:08 +0100 Subject: [PATCH 12/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16284708..aa1eff8a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ PHPCI PHPCI is a free and open source continuous integration tool specifically designed for PHP. We've built it with simplicity in mind, so whilst it doesn't do *everything* Jenkins can do, it is a breeze to set up and use. -_**Please be aware that this is a beta-release project, so there will be bugs and missing features.**_ +_**Please be aware that PHPCI is a beta-release project, so whilst it is very stable, there may be bugs and/or missing features.**_ **Current Build Status**