Compare commits

...

112 commits

Author SHA1 Message Date
Arnout Boks 64b0f60368 Removed unused 'standard' option for PhpCpd plugin (#1249) 2016-08-17 12:35:21 +01:00
Dan Cryer 42ca1c6527 Fix for handling old unserialize mode. 2016-06-29 10:13:27 +01:00
Dan Cryer 4d0911f2a9 Bug fixes
Signed-off-by: Dan Cryer <dan@block8.co.uk>
2016-06-23 11:30:41 +01:00
Dan Cryer 3cdaef8fa9 Update README.md 2016-06-03 17:30:45 +01:00
David Rimbault db93f55427 [FIX] Running Complete stage even on Exception catch. (#1186) 2016-04-27 16:59:29 +01:00
Dan Cryer 49db1a26ba
Make sure we always show the correct error count on the build errors tab. 2016-04-27 16:40:55 +01:00
Dan Cryer 77e9710d09
Testing PHPMD error supression 2016-04-27 15:45:24 +01:00
Dan Cryer 7027055711
Merge branch 'feature/bitbucket-webhooks' 2016-04-27 15:35:10 +01:00
Dan Cryer 21ba39e6ff
Fixes 2016-04-27 15:27:27 +01:00
Dan Cryer 6418fde928 Defaulting to using neither --prefer-source or --prefer-dist for composer. Allow user to specify either. 2016-04-27 15:20:20 +01:00
Dan Cryer 21d5f4954f
Adding a debug mode to the worker so you can see what commands are being run. 2016-04-27 14:56:52 +01:00
Dan Cryer 1f035463e4 Merge branch 'patch-4' of https://github.com/wodka/PHPCI into feature/bitbucket-webhooks 2016-04-27 14:26:44 +01:00
Dan Cryer 5ead42a7c2
README tweaks. 2016-04-27 14:18:40 +01:00
Dan Cryer 1e13538c28
Updating README 2016-04-27 14:13:42 +01:00
Dan Cryer 424f1c5c4b Removing Test from README 2016-04-27 14:08:01 +01:00
Dan Cryer dc9aa195d1 Merge branch 'master' of github.com:Block8/PHPCI 2016-04-27 12:35:17 +01:00
Dan Cryer 1e2cbcaf3d Fixing duplicate error listing in builds.
Closes #1130
2016-04-27 12:33:07 +01:00
David Valdez e567088a00 now take in account the errors in the codeception plugin (#1206) 2016-04-27 12:10:46 +01:00
Dan Cryer ffa593f1a3 Fixing PHPCS errors 2016-04-27 12:02:13 +01:00
Dan Cryer cc6d0f2964 Updating dependencies 2016-04-27 11:43:57 +01:00
Dan Cryer e6b02b6019 Merge remote-tracking branch 'origin/master' into v/1.7 2016-04-27 11:32:50 +01:00
Dan Cryer 81eadcf3f5 Contributing guidelines, issue template and PR template. 2016-04-27 11:29:03 +01:00
Dan Cryer f200bd0411 Fixing MySQL strict-mode install error.
Fixes #977
Fixes #818
2016-04-27 11:06:32 +01:00
Mike Bronner fe9289eda5 Remove whitespace from empty lines, reformatted inline comments 2016-02-08 12:59:15 +01:00
Michael Schramm 66ffea12f0 remove whitespace 2016-02-08 12:59:15 +01:00
Michael Schramm 3c8ed45c46 implement bitbucket webhooks
this fixes issue https://github.com/Block8/PHPCI/issues/1015 and adds support for the new bitbucket webhooks
2016-02-08 12:59:15 +01:00
Dan Cryer 2ddda7711e Update README.md 2016-02-08 11:44:35 +00:00
Dan Cryer 42bea5f876 Merge pull request #1154 from staudenmeir/update-german-translation
Update German translation.
2016-01-08 11:04:54 +00:00
Dan Cryer d3af89a0c5 Merge pull request #1157 from Lechus/patch-2
Update Polish translation
2016-01-08 11:03:35 +00:00
Leszek 9af9e0ec35 Update Polish translation
Contribution Type: improvement
Primary Area: front-end

Description of change: Updated Polish translation.
2016-01-06 22:01:38 +00:00
Jonas Staudenmeir 7f43f94cc0 Updated German translation. 2016-01-06 00:24:42 +01:00
Jonas Staudenmeir 949bfc5376 Added default value in settings language select (current language). 2016-01-05 16:21:21 +01:00
Dan Cryer 992cf767a6 Merge pull request #1128 from Block8/Deployer_branch_update
Added branch and update_only parameters
2015-11-24 11:37:16 +00:00
Stephen Ball 6eeddc9dc6 Added branch and update_only parameters
Fixes #1127
2015-11-14 23:08:22 +00:00
Dan Cryer 6eb180ed5f Merge pull request #1124 from Block8/REBELinBLUE-patch-1
Fixes a issue with a double slash in the path meaning ignore doesn't …
2015-11-12 17:47:16 +00:00
Stephen Ball 148e4414fb Fixes a issue with a double slash in the path meaning ignore doesn't work 2015-11-12 17:42:00 +00:00
Dan Cryer b24b01ec65 Fixing tests on install command 2015-11-07 12:47:39 +00:00
Dan Cryer 04c67dc1dd Update installer to support new worker functionality. Closes #1094 2015-11-07 12:25:01 +00:00
Dan Cryer 4b8d25c0f7 Adding rebuild queue option 2015-11-03 20:42:47 +00:00
Dan Cryer 9ea6f299c1 Fix for warnings chart, courtesy of @Henk8 closes #1098 2015-11-03 11:58:22 +00:00
Dan Cryer 7b345cbc49 Making the lines of code chart hide if no data available. Closes #1103 2015-11-03 11:51:45 +00:00
Dan Cryer c95e226496 Allow more errors. Fixes #1104 2015-11-03 11:44:08 +00:00
Dan Cryer 7bfba0ee30 Fixing error duplication bug. Closes #1112 2015-11-03 11:42:28 +00:00
Stephen Ball 551bae312f Merge pull request #1111 from SQweb-team/img_optim
ImageOptim'ed assets/
2015-10-27 10:46:13 +00:00
Pierre Lavaux d8be38ace0 ImageOptim'ed assets/ 2015-10-27 02:17:26 +01:00
Andreus Timm 1d9c610a25 Adding slash in path
Fix / for DIRECTORY_SEPARATOR

Closed #1109
2015-10-26 16:26:47 +01:00
Dan Cryer 943c8124ac Merge pull request #1091 from andreustimm/master
Improvement with rtrim
2015-10-15 14:49:54 +01:00
Dan Cryer f33f0a4512 Fixes 2015-10-15 14:23:55 +01:00
Dan Cryer dd1d3b3d6a Switching charts to use Chart.js instead of Google Charts 2015-10-15 12:34:58 +01:00
Dan Cryer 66cf713ebc Merge branch 'master' of github.com:Block8/PHPCI 2015-10-15 10:41:42 +01:00
Dan Cryer 8fed994921 Fixing login pages 2015-10-15 10:41:35 +01:00
Stephen Ball cb346f6808 Merge pull request #1093 from REBELinBLUE/missing_composer_dependencies
Added missing dependencies to require
2015-10-15 10:30:33 +01:00
Stephen Ball 78690f32c2 Merge branch 'master' into missing_composer_dependencies 2015-10-15 10:26:35 +01:00
Dan Cryer f904cab599 Fixing PHPMD error 2015-10-15 10:26:13 +01:00
Stephen Ball 19a7ab995c Merge branch 'master' into missing_composer_dependencies 2015-10-15 10:21:00 +01:00
Dan Cryer 38b024833f Fixing PHPCI errors 2015-10-15 10:17:22 +01:00
Stephen Ball 7c03c77870 Added missing dependencies to require 2015-10-15 10:11:21 +01:00
Dan Cryer 7f823b37cf Big update: New way of storing build errors, updated UI, AdminLTE 2, fixes, etc. 2015-10-15 10:07:54 +01:00
Andreus Timm d49cecf40a Improvement with rtrim 2015-10-14 14:24:18 -03:00
Dan Cryer 9c7a1c7907 Merge pull request #1085 from corpsee/feature-ru-update-2
Updated russian translation for Summary plugin section
2015-10-14 09:24:55 +01:00
Stephen Ball 82ffbfea5c Merge pull request #1086 from Block8/REBELinBLUE-patch-1
Adding missing closing bracket
2015-10-13 22:23:32 +01:00
Stephen Ball 0f84cc6334 Adding missing closing bracket 2015-10-13 22:02:05 +01:00
corpsee 914067c15a Updated russian translation for Summary plugin section 2015-10-13 22:33:07 +06:00
Dan Cryer 8f3cdd0fb7 Merge pull request #1083 from REBELinBLUE/build_broken_failed
Added 2 new build stages
2015-10-13 16:39:26 +01:00
Dan Cryer 9c2cdbe3d1 Merge pull request #1032 from EmmanuelVella/php-cs-fixer
Update PhpCsFixer plugin
2015-10-13 16:36:21 +01:00
Dan Cryer a821072d27 Merge pull request #1082 from REBELinBLUE/hide_slack_attachment
Add the ability to hide the slack attachment
2015-10-13 16:36:12 +01:00
Stephen Ball 8f8009c30c Fixed parse error..... Apparently I shouldn't be allowed near a computer today 2015-10-13 16:35:27 +01:00
Dan Cryer 2f34c47656 Merge pull request #1076 from corpsee/feature-ru-update
Updated russian translation
2015-10-13 16:33:42 +01:00
Stephen Ball 3f71695013 Clean up PHPCS issue 2015-10-13 16:31:17 +01:00
corpsee 94b79860c5 Merge branch 'master' into feature-ru-update
Conflicts:
	PHPCI/Languages/lang.ru.php
2015-10-13 21:30:54 +06:00
Stephen Ball 4a5b1afb47 Clean up PHPCS issue 2015-10-13 16:28:37 +01:00
Stephen Ball 8e0122f6a0 Added a fixed and broken stage 2015-10-13 16:22:39 +01:00
Stephen Ball 2d667d477d Fix PHPCS error 2015-10-13 16:08:44 +01:00
Stephen Ball d2ab7b300d Add the ability to hide the slack attachment 2015-10-13 16:04:16 +01:00
Emmanuel Vella 6e5ede8073 Update PhpCsFixer plugin 2015-10-13 16:41:41 +02:00
Dan Cryer 6aea2bdb88 Merge pull request #1077 from GeneaLabs/feature/fix-arrangement-of-components
Fix Arrangement of Build Result Components
2015-10-13 15:33:33 +01:00
Dan Cryer 3aeef0650d Merge pull request #1078 from GeneaLabs/feature/fix-bootstrap-datepicker-locale
Fix Datepicker Locale File Include
2015-10-13 15:31:23 +01:00
Dan Cryer 5216270416 Merge pull request #1070 from cooperaj/master
Incorrect docblock
2015-10-13 15:26:57 +01:00
Dan Cryer ad27ca9037 Merge pull request #1025 from delormejonathan/patch-1
Fixed a css issue with Block8 logo
2015-10-13 15:14:59 +01:00
Dan Cryer 1385379f1a Merge pull request #1021 from mrobinsonuk/cleanup/spelling-corrections
Corrected a number of minor spelling errors.
2015-10-13 15:14:44 +01:00
Dan Cryer 10720656f9 Merge pull request #1019 from detain/mysql_plugin_host_support
Contribution Type: improvement / new feature
2015-10-13 15:13:55 +01:00
Dan Cryer 0fbae60f52 Merge pull request #998 from teemule11/bugfix-pdepend-1
Pdepend Module: make check for Pdepend output dir more robust.
2015-10-13 15:04:42 +01:00
Dan Cryer 3d21ad24e9 Merge pull request #993 from corpsee/feature-phpcpd-fix
Fixed GithubBuild::getDiffLineNumber method for correct phpcpd work
2015-10-13 15:04:13 +01:00
Dan Cryer d8cbe68705 Merge pull request #992 from corpsee/feature-phpunit-fixes
Fixed TapParser parse fail
2015-10-13 15:03:09 +01:00
Dan Cryer 6591ada85b Merge pull request #972 from memnuniyetsizim/master
Fixes default value for PHP Cs Fixer ( #833 )
2015-10-13 14:45:20 +01:00
Dan Cryer bee77a25c8 Merge pull request #942 from corpsee/feature-archived-fix
Separated strings for 'archived'/'archived_menu'
2015-10-13 14:33:07 +01:00
Dan Cryer 351b24c91d Merge pull request #939 from drydenmaker/master
adding windows batch file for console
2015-10-13 14:32:12 +01:00
Dan Cryer c49821adf1 Merge pull request #1080 from GeneaLabs/feature/add-logo-icon-images
Add Logo Icons
2015-10-13 14:18:19 +01:00
Dan Cryer ed35dee322 Merge branch 'master' of github.com:Block8/PHPCI 2015-10-13 10:00:17 +01:00
Dan Cryer 156c635af5 Updating deps 2015-10-13 09:59:48 +01:00
Mike Bronner a504789bd4 Merge branch 'master' into feature/add-logo-icon-images 2015-10-12 12:26:42 -07:00
Mike Bronner dc6e4ed6b4 Add logo icons 2015-10-12 12:23:55 -07:00
Dan Cryer c9f6946189 Merge pull request #1079 from GeneaLabs/feature/fix-missing-sprintf-map-file
Add Missing sprintf.min.map File
2015-10-12 16:06:34 +01:00
Mike Bronner 21b59ab4d4 Add missing sprintf.min.map file 2015-10-10 10:07:31 -07:00
Mike Bronner c474a5c73a Check if datepicker locale file exists 2015-10-10 09:54:01 -07:00
Mike Bronner 8845fe63d9 Move id attribute to outer div to hide the result component completely
This will allow the other non-hidden components to properly reflow on the page.
2015-10-10 09:22:53 -07:00
corpsee c9541d630b Updated russian translation 2015-10-10 18:16:07 +06:00
Dan Cryer 97216b0f41 Fixing login stuff 2015-10-09 11:10:14 +01:00
Dan Cryer 725ce70ae9 Fixing ordering on projects for @REBELinBLUE 2015-10-09 10:58:18 +01:00
Dan Cryer edcff1030d Merge pull request #1075 from Block8/dc/phpci-fixes
Fixing PHPCI Errors
2015-10-09 10:40:12 +01:00
Adam Cooper 668ee67617 Incorrect docblock
The "optionally" is not true, the config file is now required.
2015-10-06 10:53:23 +01:00
Mehmet Ali Ergut f55b336900 Fixes default value for PHP Cs Fixer ( #833 ) 2015-08-24 21:24:37 +03:00
DELORME Jonathan 8a3d7605d5 Fixed a css issue with Block8 logo
In Chrome (Android L), when you focus an input, the Block8 logo overrides the view.
See : http://s10.postimg.org/d5ffp7dwp/2015_06_30_07_57_03.png
2015-06-30 11:43:25 +02:00
Mark Robinson d2c512d94b Corrected a number of minor spelling errors.
Originally observed that "successful" was misspelled "succesfull" on the build view page. While correcting that, a number of other spelling errors were also corrected.
2015-06-25 15:21:23 +01:00
Joe Huss 9efd8e06dc Contribution Type: improvement / new feature
Primary Area: plugins

Description of change: Implemented using the same changes mentioned here: https://www.phptesting.org/forums/topic/5-mysql-plugin-setup/
Allows you to specify a hostname for your mysql connection.  Not my original code just patching it into the current source and made a branchs/push for it.

(i.e. Created a new plugin named ToolX, used library X to implement, see link)
2015-06-25 07:48:26 -04:00
mulleto 2672908225 Make check for Pdepend output dir more robust. Before this fix, the pdepend module would check for "is_writable", which returns false even when the directory does not exist. I suggest to a) attempt to crete the dir if it does not exist, and b) make the error message more explanatory in case the dir cannot be created or is not accessible. 2015-05-29 08:26:47 +02:00
corpsee 853107027b Fixed GithubBuild::getDiffLineNumber method for correct phpcpd work 2015-05-24 14:20:51 +06:00
corpsee 3f02e63c92 Fixed TapParser::parseLine Cyclomatic Complexity 2015-05-24 12:43:43 +06:00
corpsee c20ee0533b Fixed TapParser::parseLine Cyclomatic Complexity 2015-05-24 12:39:27 +06:00
corpsee 1c864cebed Fixed TapParser parse fail with valid data + added tests 2015-05-23 15:40:49 +06:00
corpsee 21bf104587 Separated strings for 'archived'/'archived_menu' 2015-04-25 09:54:08 +06:00
alton.crossley 5133d85b99 adding windows batch file for console 2015-04-23 14:35:15 -06:00
940 changed files with 166150 additions and 19855 deletions

41
.github/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,41 @@
Contributions to PHPCI are very much encouraged, and we do our best to make it as welcoming and simple as possible.
### Before You Start
Before you start, please make sure that you are aware of, and agree to, the following conditions of contribution:
* By making a contribution to PHPCI, you accept that you are granting copyright ownership for that contribution to Block 8 Limited - the company responsible for PHPCI. In countries where copyright reassignment is not permitted, you grant Block 8 Limited a perpetual, non-exclusive licence to use your contribution in any way and for any purpose.
* By making a contribution to PHPCI, you accept that your code will be released under the open-source [BSD 2-Clause Licence](https://github.com/Block8/PHPCI/blob/master/LICENSE.md).
Block 8 are committed to PHPCI being a truly free and open source project, providing easy to use continuous integration and testing to as many developers as possible. We may, at our sole discretion, provide paid services based upon PHPCI - but PHPCI will always remain free (as in cost, and freedom) and open source.
### The Contribution Process
1. If you are thinking of making a large change or feature addition, [open an issue](/Block8/PHPCI/issues) titled "Intent to implement: <Your Feature>". Describe your idea in detail and discuss it with the community. It might be that someone already has a plan, could help you out, or your idea may simply not be suitable for the project at this time.
2. Fork the PHPCI project on Github
3. Add a feature or fix a bug - We recommend that you do this on a branch within your repository.
4. Create a pull request containing just the one change you want to contribute back to PHPCI. If you have more than one feature or bug fix, please create separate branches within your repository, and then submit a separate pull request for each one. Your pull request should use the template detailed below.
5. We'll then review your pull request and give any necessary feedback, this could be:
* Suggestions to improve your implementation
* Questions
* Issues/bugs related to the change
* Coding standards pointers
6. Once everyone is happy with the submission, we'll merge it back into PHPCI. Your change will then be included in the next project release.
### Not sure what to start with?
We maintain two labels within our issue tracker that may be of interest to new contributors:
* [The "Easy Fix" List](https://github.com/Block8/PHPCI/labels/flag:easy-fix)
* [The "Priority" List](https://github.com/Block8/PHPCI/labels/flag:priority)
### Coding Standards
We require that all contributions meet at least the following guidelines:
* PSR-1 & PSR-2 compliance for all code
* Doc-blocks for all classes and methods
* All files must contain the standard file-level docblock, including the copyright, license and link tags.
All pull requests will be checked against these standards. If you're modifying a file as part of your change which does not comply with the above, please make the necessary changes to bring it into compliance prior to submitting the pull request.
### Other Requirements
When you're adding new features or functionality, or you're updating existing functionality, please ensure that the relevant documentation is also either created or updated on the Wiki.

28
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,28 @@
Before submitting your issue, please make sure that you've checked all of the checkboxes below.
- [ ] You're running the [latest release](https://github.com/Block8/PHPCI/releases/latest) version of PHPCI.
- [ ] Ensure that you're running at least PHP 5.3.6, you can check this by running `php -v`
- [ ] You've run `composer install --no-dev -o` from the root of your installation.
- [ ] You have set up either the PHPCI [Worker](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Worker), [Daemon](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) or [Cron Job](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-Cron) to run builds.
To help us better understand your issue, please answer the following.
### Expected behaviour
*Please describe what you're expecting to see happen.*
### Actual behaviour
*Please describe what you're actually seeing happen.*
### Steps to reproduce
*If your issue requires any specific steps to reproduce, please outline them here.*
### Environment info
Operating System:
PHP Version:
MySQL Version:
### Logs or other output that would be helpful
(If logs are large, please upload as attachment).

23
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,23 @@
Contribution Type: bug fix | new plugin | new feature | refactor | cosmetic
Link to Intent to Implement:
Link to Bug:
This pull request affects the following areas:
* [ ] Front-End
* [ ] Builder
* [ ] Build Plugins
**In raising this pull request, I confirm the following (please check boxes):**
- [ ] I have read and understood the [contributing guidelines](/.github/CONTRIBUTING.md)?
- [ ] I have checked that another pull request for this purpose does not exist.
- [ ] I have considered, and confirmed that this submission will be valuable to others.
- [ ] I have created or updated the relevant documentation for this change on the PHPCI Wiki.
- [ ] Do the PHPCI tests pass?
Detailed description of change:

View file

@ -8,11 +8,11 @@ build_settings:
- "PHPCI/Migrations" # Ignore the migrations directory, as both PHPMD and PHPCS can't cope with them.
- "PHPCI/Model/Base" # These files are auto-generated, and sometimes hit PHPMD complexity thresholds.
- "PHPCI/Languages" # PHPCS fails on character counts for non-Latin languages
- "public/assets" # If there are any PHP files in here, we didn't write them.
setup:
composer:
action: "install"
prefer_dist: false
test:
php_parallel_lint:
@ -32,7 +32,7 @@ test:
php_docblock_checker:
allowed_warnings: 0
failure:
broken:
email:
committer: true
cc: ["php-ci@googlegroups.com"]

View file

@ -188,6 +188,14 @@ class Builder implements LoggerAwareInterface
$this->build->sendStatusPostback();
$success = true;
$previous_build = $this->build->getProject()->getPreviousBuild($this->build->getBranch());
$previous_state = Build::STATUS_NEW;
if ($previous_build) {
$previous_state = $previous_build->getStatus();
}
try {
// Set up the build:
$this->setupBuild();
@ -205,19 +213,30 @@ class Builder implements LoggerAwareInterface
$this->build->setStatus(Build::STATUS_FAILED);
}
// Complete stage plugins are always run
$this->pluginExecutor->executePlugins($this->config, 'complete');
if ($success) {
$this->pluginExecutor->executePlugins($this->config, 'success');
if ($previous_state == Build::STATUS_FAILED) {
$this->pluginExecutor->executePlugins($this->config, 'fixed');
}
$this->buildLogger->logSuccess(Lang::get('build_success'));
} else {
$this->pluginExecutor->executePlugins($this->config, 'failure');
if ($previous_state == Build::STATUS_SUCCESS || $previous_state == Build::STATUS_NEW) {
$this->pluginExecutor->executePlugins($this->config, 'broken');
}
$this->buildLogger->logFailure(Lang::get('build_failed'));
}
} catch (\Exception $ex) {
$this->build->setStatus(Build::STATUS_FAILED);
$this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage());
}finally{
// Complete stage plugins are always run
$this->pluginExecutor->executePlugins($this->config, 'complete');
}
@ -285,8 +304,7 @@ class Builder implements LoggerAwareInterface
*/
protected function setupBuild()
{
$this->buildPath = $this->build->getBuildPath() . '/';
$this->build->currentBuildPath = $this->buildPath;
$this->buildPath = $this->build->getBuildPath();
$this->interpolator->setupInterpolationVars(
$this->build,

View file

@ -16,10 +16,12 @@ use b8\Config;
use b8\Store\Factory;
use PHPCI\Helper\Lang;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use PHPCI\Service\UserService;
use Symfony\Component\Console\Question\ConfirmationQuestion;
/**
* Install console command - Installs PHPCI.
@ -46,6 +48,9 @@ class InstallCommand extends Command
->addOption('admin-pass', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_pass'))
->addOption('admin-mail', null, InputOption::VALUE_OPTIONAL, Lang::get('admin_email'))
->addOption('config-path', null, InputOption::VALUE_OPTIONAL, Lang::get('config_path'), $defaultPath)
->addOption('queue-disabled', null, InputOption::VALUE_NONE, 'Don\'t ask for queue details')
->addOption('queue-server', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue server hostname')
->addOption('queue-name', null, InputOption::VALUE_OPTIONAL, 'Beanstalkd queue name')
->setDescription(Lang::get('install_phpci'));
}
@ -229,10 +234,45 @@ class InstallCommand extends Command
}
$phpci['url'] = $url;
$phpci['worker'] = $this->getQueueInformation($input, $output, $dialog);
return $phpci;
}
/**
* If the user wants to use a queue, get the necessary details.
* @param InputInterface $input
* @param OutputInterface $output
* @param DialogHelper $dialog
* @return array
*/
protected function getQueueInformation(InputInterface $input, OutputInterface $output, DialogHelper $dialog)
{
if ($input->getOption('queue-disabled')) {
return null;
}
$rtn = [];
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Use beanstalkd to manage build queue? ', true);
if (!$helper->ask($input, $output, $question)) {
$output->writeln('<error>Skipping beanstalkd configuration.</error>');
return null;
}
if (!$rtn['host'] = $input->getOption('queue-server')) {
$rtn['host'] = $dialog->ask($output, 'Enter your beanstalkd hostname [localhost]: ', 'localhost');
}
if (!$rtn['queue'] = $input->getOption('queue-name')) {
$rtn['queue'] = $dialog->ask($output, 'Enter the queue (tube) name to use [phpci]: ', 'phpci');
}
return $rtn;
}
/**
* Load configuration for DB form CLI options or ask info to user.
*

View file

@ -0,0 +1,85 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Command;
use b8\Config;
use b8\Store\Factory;
use Monolog\Logger;
use PHPCI\BuildFactory;
use PHPCI\Helper\Lang;
use PHPCI\Logging\OutputLogHandler;
use PHPCI\Service\BuildService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Console
*/
class RebuildQueueCommand extends Command
{
/**
* @var OutputInterface
*/
protected $output;
/**
* @var Logger
*/
protected $logger;
/**
* @param \Monolog\Logger $logger
* @param string $name
*/
public function __construct(Logger $logger, $name = null)
{
parent::__construct($name);
$this->logger = $logger;
}
protected function configure()
{
$this
->setName('phpci:rebuild-queue')
->setDescription('Rebuilds the PHPCI worker queue.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->output = $output;
// For verbose mode we want to output all informational and above
// messages to the symphony output interface.
if ($input->hasOption('verbose') && $input->getOption('verbose')) {
$this->logger->pushHandler(
new OutputLogHandler($this->output, Logger::INFO)
);
}
$store = Factory::getStore('Build');
$result = $store->getByStatus(0);
$this->logger->addInfo(Lang::get('found_n_builds', count($result['items'])));
$buildService = new BuildService($store);
while (count($result['items'])) {
$build = array_shift($result['items']);
$build = BuildFactory::getBuild($build);
$this->logger->addInfo('Added build #' . $build->getId() . ' to queue.');
$buildService->addBuildToQueue($build);
}
}
}

View file

@ -50,7 +50,8 @@ class WorkerCommand extends Command
{
$this
->setName('phpci:worker')
->setDescription('Runs the PHPCI build worker.');
->setDescription('Runs the PHPCI build worker.')
->addOption('debug', null, null, 'Run PHPCI in Debug Mode');
}
protected function execute(InputInterface $input, OutputInterface $output)
@ -65,6 +66,12 @@ class WorkerCommand extends Command
);
}
// Allow PHPCI to run in "debug mode"
if ($input->hasOption('debug') && $input->getOption('debug')) {
$output->writeln('<comment>Debug mode enabled.</comment>');
define('PHPCI_DEBUG_MODE', true);
}
$config = Config::getInstance()->get('phpci.worker', []);
if (empty($config['host']) || empty($config['queue'])) {

View file

@ -63,24 +63,42 @@ class BuildController extends \PHPCI\Controller
$this->view->plugins = $this->getUiPlugins();
$this->view->build = $build;
$this->view->data = json_encode($this->getBuildData($build));
$this->view->data = $this->getBuildData($build);
$this->layout->title = Lang::get('build_n', $buildId);
$this->layout->subtitle = $build->getProjectTitle();
$nav = array(
'title' => Lang::get('build_n', $buildId),
'icon' => 'cog',
'links' => array(
'build/rebuild/' . $build->getId() => Lang::get('rebuild_now'),
),
);
switch ($build->getStatus()) {
case 0:
$this->layout->skin = 'blue';
break;
if ($this->currentUserIsAdmin()) {
$nav['links']['build/delete/' . $build->getId()] = Lang::get('delete_build');
case 1:
$this->layout->skin = 'yellow';
break;
case 2:
$this->layout->skin = 'green';
break;
case 3:
$this->layout->skin = 'red';
break;
}
$this->layout->nav = $nav;
$rebuild = Lang::get('rebuild_now');
$rebuildLink = PHPCI_URL . 'build/rebuild/' . $build->getId();
$delete = Lang::get('delete_build');
$deleteLink = PHPCI_URL . 'build/delete/' . $build->getId();
$actions = "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
if ($this->currentUserIsAdmin()) {
$actions .= " <a class=\"btn btn-danger\" href=\"{$deleteLink}\">{$delete}</a>";
}
$this->layout->actions = $actions;
}
/**
@ -144,7 +162,7 @@ class BuildController extends \PHPCI\Controller
/**
* Get build data from database and json encode it:
*/
protected function getBuildData($build)
protected function getBuildData(Build $build)
{
$data = array();
$data['status'] = (int)$build->getStatus();
@ -152,6 +170,19 @@ class BuildController extends \PHPCI\Controller
$data['created'] = !is_null($build->getCreated()) ? $build->getCreated()->format('Y-m-d H:i:s') : null;
$data['started'] = !is_null($build->getStarted()) ? $build->getStarted()->format('Y-m-d H:i:s') : null;
$data['finished'] = !is_null($build->getFinished()) ? $build->getFinished()->format('Y-m-d H:i:s') : null;
$data['duration'] = $build->getDuration();
/** @var \PHPCI\Store\BuildErrorStore $errorStore */
$errorStore = b8\Store\Factory::getStore('BuildError');
$errors = $errorStore->getErrorsForBuild($build->getId(), $this->getParam('since', null));
$errorView = new b8\View('Build/errors');
$errorView->build = $build;
$errorView->errors = $errors;
$data['errors'] = $errorStore->getErrorTotalForBuild($build->getId());
$data['error_html'] = $errorView->render();
$data['since'] = (new \DateTime())->format('Y-m-d H:i:s');
return $data;
}
@ -169,6 +200,10 @@ class BuildController extends \PHPCI\Controller
$build = $this->buildService->createDuplicateBuild($copy);
if ($this->buildService->queueError) {
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
}
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
return $response;

View file

@ -104,7 +104,6 @@ class BuildStatusController extends \PHPCI\Controller
}
}
}
} catch (\Exception $e) {
$xml = new \SimpleXMLElement('<projects/>');
}

View file

@ -116,6 +116,10 @@ class ProjectController extends PHPCI\Controller
$email = $_SESSION['phpci_user']->getEmail();
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email);
if ($this->buildService->queueError) {
$_SESSION['global_error'] = Lang::get('add_to_queue_failed');
}
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
return $response;

View file

@ -444,7 +444,7 @@ class SettingsController extends Controller
$field->setClass('form-control');
$field->setContainerClass('form-group');
$field->setOptions(Lang::getLanguageOptions());
$field->setValue('en');
$field->setValue(Lang::getLanguage());
$form->addField($field);

View file

@ -27,6 +27,8 @@ use PHPCI\Store\ProjectStore;
* @author Guillaume Perréal <adirelle@gmail.com>
* @package PHPCI
* @subpackage Web
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class WebhookController extends \b8\Controller
{
@ -80,11 +82,64 @@ class WebhookController extends \b8\Controller
}
/**
* Called by Bitbucket POST service.
* Called by Bitbucket.
*/
public function bitbucket($projectId)
{
$project = $this->fetchProject($projectId, 'bitbucket');
// Support both old services and new webhooks
if ($payload = $this->getParam('payload')) {
return $this->bitbucketService(json_decode($payload, true), $project);
}
$payload = json_decode(file_get_contents("php://input"), true);
if (empty($payload['push']['changes'])) {
// Invalid event from bitbucket
return [
'status' => 'failed',
'commits' => []
];
}
return $this->bitbucketWebhook($payload, $project);
}
/**
* Bitbucket webhooks.
*/
protected function bitbucketWebhook($payload, $project)
{
$results = array();
$status = 'failed';
foreach ($payload['push']['changes'] as $commit) {
try {
$email = $commit['new']['target']['author']['raw'];
$email = substr($email, 0, strpos($email, '>'));
$email = substr($email, strpos($email, '<') + 1);
$results[$commit['new']['target']['hash']] = $this->createBuild(
$project,
$commit['new']['target']['hash'],
$commit['new']['name'],
$email,
$commit['new']['target']['message']
);
$status = 'ok';
} catch (Exception $ex) {
$results[$commit['new']['target']['hash']] = array('status' => 'failed', 'error' => $ex->getMessage());
}
}
return array('status' => $status, 'commits' => $results);
}
/**
* Bitbucket POST service.
*/
protected function bitbucketService($payload, $project)
{
$payload = json_decode($this->getParam('payload'), true);
$results = array();
@ -170,7 +225,7 @@ class WebhookController extends \b8\Controller
protected function githubCommitRequest(Project $project, array $payload)
{
// Github sends a payload when you close a pull request with a
// non-existant commit. We don't want this.
// non-existent commit. We don't want this.
if (array_key_exists('after', $payload) && $payload['after'] === '0000000000000000000000000000000000000000') {
return array('status' => 'ignored');
}

View file

@ -21,7 +21,7 @@ final class AnsiConverter
static private $converter = null;
/**
* Initialize the singletion.
* Initialize the singleton.
*
* @return AnsiToHtmlConverter
*/
@ -35,7 +35,7 @@ final class AnsiConverter
}
/**
* Convert a text containing ANSI colr sequences into HTML code.
* Convert a text containing ANSI color sequences into HTML code.
*
* @param string $text The text to convert
*
@ -47,7 +47,7 @@ final class AnsiConverter
}
/**
* Do not instanciate this class.
* Do not instantiate this class.
*/
private function __construct()
{

View file

@ -76,6 +76,7 @@ abstract class BaseCommandExecutor implements CommandExecutor
$this->lastOutput = array();
$command = call_user_func_array('sprintf', $args);
$this->logger->logDebug($command);
if ($this->quiet) {
$this->logger->log('Executing: ' . $command);
@ -89,7 +90,6 @@ abstract class BaseCommandExecutor implements CommandExecutor
);
$pipes = array();
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
if (is_resource($process)) {

View file

@ -12,7 +12,7 @@ namespace PHPCI\Helper;
use b8\Config;
/**
* Login Is Disabled Helper - Checks if login is disalbed in the view
* Login Is Disabled Helper - Checks if login is disabled in the view
* @author Stephen Ball <phpci@stephen.rebelinblue.com>
* @package PHPCI
* @subpackage Web

View file

@ -114,6 +114,7 @@ i din foretrukne hosting-platform.',
'default_branch' => 'Default branch navn',
'allow_public_status' => 'Tillad offentlig status-side og -billede for dette projekt?',
'archived' => 'Archived',
'archived_menu' => 'Archived',
'save_project' => 'Gem Projekt',
'error_mercurial' => 'Mercurial repository-URL skal starte med http:// eller https://',
@ -203,7 +204,7 @@ Services</a> sektionen under dit Bitbucket-repository.',
'build_finished' => 'Build Afsluttet',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_success' => 'Successful: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',

View file

@ -39,7 +39,7 @@ PHPCI',
'reset_email_title' => 'PHPCI Passwort zurücksetzen für %s',
'reset_invalid' => 'Fehlerhafte Anfrage für das Zurücksetzen eines Passwortes',
'email_address' => 'Emailadresse',
'login' => 'Login / Email Address',
'login' => 'Login / Emailadresse',
'password' => 'Passwort',
'log_in' => 'Einloggen',
@ -103,7 +103,7 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'local' => 'Lokaler Pfad',
'hg' => 'Mercurial',
'svn' => 'Subversion',
'where_hosted' => 'Wo wird Ihr Projekt gehostet?',
'choose_github' => 'Wählen Sie ein GitHub Repository:',
@ -115,7 +115,8 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
(falls Sie Ihrem Projektrepository kein phpci.yml hinzufügen können)',
'default_branch' => 'Name des Standardbranches',
'allow_public_status' => 'Öffentliche Statusseite und -bild für dieses Projekt einschalten?',
'archived' => 'Archived',
'archived' => 'Archiviert',
'archived_menu' => 'Archiviert',
'save_project' => 'Projekt speichern',
'error_mercurial' => 'Mercurial Repository-URL muss mit http://, oder https:// beginnen',
@ -129,7 +130,7 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'all_branches' => 'Alle Branches',
'builds' => 'Builds',
'id' => 'ID',
'date' => 'Date',
'date' => 'Datum',
'project' => 'Projekt',
'commit' => 'Commit',
'branch' => 'Branch',
@ -150,6 +151,9 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'webhooks_help_bitbucket' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL als "POST" Service in der <a href="https://bitbucket.org/%s/admin/services">Services</a>-Sektion Ihres Bitbucket Repositories hinzu.',
// View Build
'errors' => 'Fehler',
'information' => 'Information',
'build_x_not_found' => 'Build mit ID %d existiert nicht.',
'build_n' => 'Build %d',
'rebuild_now' => 'Build neu starten',
@ -191,8 +195,8 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'codeception_suite' => 'Suite',
'codeception_time' => 'Zeit',
'codeception_synopsis' => '<strong>%1$d</strong> Tests in <strong>%2$f</strong> Sekunden ausgeführt.
<strong>%3$d</strong> Fehler.',
<strong>%3$d</strong> Fehler.',
'file' => 'Datei',
'line' => 'Zeile',
'class' => 'Klasse',
@ -208,14 +212,14 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'build_created' => 'Build erstellt',
'build_started' => 'Build gestartet',
'build_finished' => 'Build abgeschlossen',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',
'test_message' => 'Nachricht',
'test_no_message' => 'Keine Nachricht',
'test_success' => 'Erfolgreich: %d',
'test_fail' => 'Fehlschläge: %d',
'test_skipped' => 'Übersprungen: %d',
'test_error' => 'Fehler: %d',
'test_todo' => 'Todos: %d',
'test_total' => '%d test(s)',
'test_total' => '%d Test(s)',
// Users
'name' => 'Name',
@ -291,6 +295,19 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'search_packagist_for_more' => 'Packagist nach mehr Packages durchsuchen',
'search' => 'Suchen &raquo;',
// Summary plugin
'build-summary' => 'Zusammenfassung',
'stage' => 'Abschnitt',
'duration' => 'Dauer',
'plugin' => 'Plugin',
'stage_setup' => 'Vorbereitung',
'stage_test' => 'Test',
'stage_complete' => 'Vollständig',
'stage_success' => 'Erfolg',
'stage_failure' => 'Fehlschlag',
'stage_broken' => 'Defekt',
'stage_fixed' => 'Behoben',
// Installer
'installation_url' => 'PHPCI Installations-URL',
'db_host' => 'Datenbankserver',
@ -399,5 +416,18 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'build_file_missing' => 'Angegebene Builddatei existiert nicht.',
'property_file_missing' => 'Angegebene Eigenschaftsdatei existiert nicht.',
'could_not_process_report' => 'Konnte den von diesem Tool erstellten Bericht nicht verarbeiten.',
'shell_not_enabled' => 'Das Shell-Plugin ist nicht aktiviert. Bitte aktivieren Sie es via config.yml.'
'shell_not_enabled' => 'Das Shell-Plugin ist nicht aktiviert. Bitte aktivieren Sie es via config.yml.',
// Error Levels:
'critical' => 'Kritisch',
'high' => 'Hoch',
'normal' => 'Normal',
'low' => 'Niedrig',
// Plugins that generate errors:
'php_mess_detector' => 'PHP Mess Detector',
'php_code_sniffer' => 'PHP Code Sniffer',
'php_unit' => 'PHP Unit',
'php_cpd' => 'PHP Copy/Paste Detector',
'php_docblock_checker' => 'PHP Docblock Checker',
);

View file

@ -115,6 +115,7 @@ PHPCI',
'default_branch' => 'Προκαθορισμένο όνομα διακλάδωσης',
'allow_public_status' => 'Ενεργοποίηση της σελίδας δημόσιας κατάστασης και την εικόνα για το έργο αυτό;',
'archived' => 'Archived',
'archived_menu' => 'Archived',
'save_project' => 'Αποθήκευση έργου',
'error_mercurial' => 'Ο σύνδεσμος URL του ευμετάβλητου αποθετηρίου πρέπει να ξεκινάει με http:// ή https://',
@ -204,7 +205,7 @@ Services</a> του Bitbucket αποθετηρίου σας.',
'build_finished' => 'Η κατασκευή ολοκληρώθηκε',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_success' => 'Successful: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',

View file

@ -116,6 +116,7 @@ PHPCI',
'default_branch' => 'Default branch name',
'allow_public_status' => 'Enable public status page and image for this project?',
'archived' => 'Archived',
'archived_menu' => 'Archived',
'save_project' => 'Save Project',
'error_mercurial' => 'Mercurial repository URL must be start with http:// or https://',
@ -153,6 +154,9 @@ PHPCI',
Services</a> section of your Bitbucket repository.',
// View Build
'errors' => 'Errors',
'information' => 'Information',
'build_x_not_found' => 'Build with ID %d does not exist.',
'build_n' => 'Build %d',
'rebuild_now' => 'Rebuild Now',
@ -213,7 +217,7 @@ PHPCI',
'build_finished' => 'Build Finished',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_success' => 'Successful: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',
@ -305,6 +309,8 @@ PHPCI',
'stage_complete' => 'Complete',
'stage_success' => 'Success',
'stage_failure' => 'Failure',
'stage_broken' => 'Broken',
'stage_fixed' => 'Fixed',
// Installer
'installation_url' => 'PHPCI Installation URL',
@ -366,6 +372,9 @@ PHPCI',
'project_id_argument' => 'A project ID',
'commit_id_option' => 'Commit ID to build',
'branch_name_option' => 'Branch to build',
'add_to_queue_failed' => 'Build created successfully, but failed to add to build queue. This usually happens
when PHPCI is set to use a beanstalkd server that does not exist,
or your beanstalkd server has stopped.',
// Run Command
'run_all_pending' => 'Run all pending PHPCI builds.',
@ -414,5 +423,22 @@ PHPCI',
'build_file_missing' => 'Specified build file does not exist.',
'property_file_missing' => 'Specified property file does not exist.',
'could_not_process_report' => 'Could not process the report generated by this tool.',
'shell_not_enabled' => 'The shell plugin is not enabled. Please enable it via config.yml.'
'shell_not_enabled' => 'The shell plugin is not enabled. Please enable it via config.yml.',
// Error Levels:
'critical' => 'Critical',
'high' => 'High',
'normal' => 'Normal',
'low' => 'Low',
// Plugins that generate errors:
'php_mess_detector' => 'PHP Mess Detector',
'php_code_sniffer' => 'PHP Code Sniffer',
'php_unit' => 'PHP Unit',
'php_cpd' => 'PHP Copy/Paste Detector',
'php_docblock_checker' => 'PHP Docblock Checker',
'behat' => 'Behat',
'technical_debt' => 'Technical Debt',
);

View file

@ -115,6 +115,7 @@ PHPCI',
'default_branch' => 'Nombre de la rama por defecto',
'allow_public_status' => '¿Activar página pública con el estado del proyecto?',
'archived' => 'Archivado',
'archived_menu' => 'Archivado',
'save_project' => 'Guardar Proyecto',
'error_mercurial' => 'La URL del repositorio de Mercurial debe comenzar con http:// or https://',

View file

@ -115,6 +115,7 @@ PHPCI',
'default_branch' => 'Nom de la branche par défaut',
'allow_public_status' => 'Activer la page de statut publique et l\'image pour ce projet&nbsp;?',
'archived' => 'Archived',
'archived_menu' => 'Archived',
'save_project' => 'Enregistrer le projet',
'error_mercurial' => 'Les URLs de dépôt Mercurial doivent commencer par http:// ou https://',

View file

@ -113,8 +113,9 @@ PHPCI',
(se non puoi aggiungere il file phpci.yml nel repository di questo progetto)',
'default_branch' => 'Nome del branch di default',
'allow_public_status' => 'Vuoi rendere pubblica la pagina dello stato e l\'immagine per questo progetto?',
'save_project' => 'Salva il Progetto',
'archived' => 'Archived',
'archived_menu' => 'Archived',
'save_project' => 'Salva il Progetto',
'error_mercurial' => 'L\'URL del repository Mercurial URL deve iniziare con http:// o https://',
'error_remote' => 'L\'URL del repository deve iniziare con git://, http:// o https://',
@ -206,7 +207,7 @@ PHPCI',
'build_finished' => 'Build Terminata',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_success' => 'Successful: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',

View file

@ -115,6 +115,7 @@ van je gekozen source code hosting platform',
'default_branch' => 'Standaard branch naam',
'allow_public_status' => 'Publieke statuspagina en afbeelding beschikbaar maken voor dit project?',
'archived' => 'Archived',
'archived_menu' => 'Archived',
'save_project' => 'Project opslaan',
'error_mercurial' => 'Mercurial repository URL dient te starten met http:// of https://',
@ -204,7 +205,7 @@ Services</a> sectie van je Bitbucket repository toegevoegd worden.',
'build_finished' => 'Build beëindigd',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_success' => 'Successful: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',

View file

@ -116,6 +116,7 @@ od wybranego kodu źródłowego platformy hostingowej.',
'default_branch' => 'Domyślna nazwa gałęzi',
'allow_public_status' => 'Włączyć status publiczny dla tego projektu?',
'archived' => 'W archiwum',
'archived_menu' => 'W archiwum',
'save_project' => 'Zachowaj Projekt',
'error_mercurial' => 'URL repozytorium Mercurialnego powinno zaczynać się od http:// and https://',
@ -129,7 +130,7 @@ od wybranego kodu źródłowego platformy hostingowej.',
'all_branches' => 'Wszystkie Gałęzie',
'builds' => 'Budowania',
'id' => 'ID',
'date' => 'Date',
'date' => 'Data',
'project' => 'Projekt',
'commit' => 'Commit',
'branch' => 'Gałąź',
@ -205,14 +206,14 @@ Services</a> repozytoria Bitbucket.',
'build_created' => 'Budowanie Stworzone',
'build_started' => 'Budowanie Rozpoczęte',
'build_finished' => 'Budowanie Zakończone',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',
'test_todo' => 'Todos: %d',
'test_total' => '%d test(s)',
'test_message' => 'Wiadomość',
'test_no_message' => 'Brak wiadomości',
'test_success' => 'Powodzenie: %d',
'test_fail' => 'Niepowodzenia: %d',
'test_skipped' => 'Pominęte: %d',
'test_error' => 'Błędy: %d',
'test_todo' => 'Do zrobienia: %d',
'test_total' => '%d test(ów)',
// Users
'name' => 'Nazwa',
@ -343,10 +344,10 @@ Przejrzyj powyższą listę błędów przed kontynuowaniem.',
'incorrect_format' => 'Niepoprawny format',
// Create Build Command
'create_build_project' => 'Create a build for a project',
'project_id_argument' => 'A project ID',
'commit_id_option' => 'Commit ID to build',
'branch_name_option' => 'Branch to build',
'create_build_project' => 'Utwórz budowanie dla projektu',
'project_id_argument' => 'ID projektu',
'commit_id_option' => 'ID Commita do budowania',
'branch_name_option' => 'Gałąź do budowania',
// Run Command
'run_all_pending' => 'Uruchom wszystkie oczekujące budowy w PHPCI',

View file

@ -42,7 +42,6 @@ PHPCI',
'password' => 'Пароль',
'log_in' => 'Войти',
// Top Nav
'toggle_navigation' => 'Скрыть/показать панель навигации',
'n_builds_pending' => '%d сборок ожидает',
@ -108,12 +107,13 @@ PHPCI',
'repo_name' => 'Репозиторий / Внешний URL / Локальный путь',
'project_title' => 'Название проекта',
'project_private_key' => 'Приватный ключ для доступа к репозиторию
(оставьте поле пустым для локального использования и/или анонимного доступа)',
(оставьте поле пустым для локального использования и/или анонимного доступа)',
'build_config' => 'Конфигурация сборки проекта для PHPCI
(если вы не добавили файл phpci.yml в репозиторий вашего проекта)',
(если вы не добавили файл phpci.yml в репозиторий вашего проекта)',
'default_branch' => 'Ветка по умолчанию',
'allow_public_status' => 'Разрешить публичный статус и изображение (статуса) для проекта',
'archived' => 'Запакован',
'archived' => 'Архивный',
'archived_menu' => 'Архив',
'save_project' => 'Сохранить проект',
'error_mercurial' => 'URL репозитория Mercurial должен начинаться с http:// или https://',
@ -139,13 +139,13 @@ PHPCI',
'webhooks' => 'Webhooks',
'webhooks_help_github' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве нового хука в разделе настроек <a href="https://github.com/%s/settings/hooks">Webhooks
and Services</a> вашего GitHub репозитория.',
and Services</a> вашего GitHub репозитория.',
'webhooks_help_gitlab' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве "WebHook URL"
в разделе "Web Hooks" вашего GitLab репозитория.',
'webhooks_help_bitbucket' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже как "POST" сервис в разделе <a href="https://bitbucket.org/%s/admin/services">
Services</a> вашего Bitbucket репозитория.',
Services</a> вашего Bitbucket репозитория.',
// View Build
'build_x_not_found' => 'Сборки с ID %d не существует.',
@ -185,6 +185,11 @@ PHPCI',
'technical_debt' => 'Технические долги',
'behat' => 'Behat',
'codeception_feature' => 'Свойство',
'codeception_suite' => 'Набор',
'codeception_time' => 'Время',
'codeception_synopsis' => 'Тестов выполнено: <strong>%1$d</strong> (за <strong>%2$f</strong> сек.). Провалов: <strong>%3$d</strong>.',
'file' => 'Файл',
'line' => 'Строка',
'class' => 'Класс',
@ -202,12 +207,12 @@ PHPCI',
'build_finished' => 'Сборка окончена',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',
'test_todo' => 'Todos: %d',
'test_total' => '%d test(s)',
'test_success' => 'Успешно: %d',
'test_fail' => 'Провалено: %d',
'test_skipped' => 'Пропущено: %d',
'test_error' => 'Ошибок: %d',
'test_todo' => 'Todo: %d',
'test_total' => 'Тестов: %d',
// Users
'name' => 'Имя',
@ -282,6 +287,19 @@ PHPCI',
'search_packagist_for_more' => 'Искать на Packagist',
'search' => 'Искать &raquo;',
// Summary plugin
'build-summary' => 'Сводка',
'stage' => 'Этап',
'duration' => 'Продолжительность',
'plugin' => 'Плагин',
'stage_setup' => 'Установка',
'stage_test' => 'тестирование',
'stage_complete' => 'Завершение',
'stage_success' => 'Успешное завершение',
'stage_failure' => 'Провал',
'stage_broken' => 'Поломка',
'stage_fixed' => 'Исправление',
// Installer
'installation_url' => 'URL-адрес PHPCI для установки',
'db_host' => 'Хост базы данных',

View file

@ -113,7 +113,8 @@ PHPCI',
(якщо ви не додали файл phpci.yml до репозиторію вашого проекту)',
'default_branch' => 'Назва гілки за замовчуванням',
'allow_public_status' => 'Увімкнути публічну сторінку статусу та зображення для цього проекта?',
'archived' => 'Archived',
'archived' => 'Архівний',
'archived_menu' => 'Архів',
'save_project' => 'Зберегти проект',
'error_mercurial' => 'URL репозиторію Mercurial повинен починатись із http:// або https://',
@ -204,7 +205,7 @@ PHPCI',
'build_finished' => 'Збірка завершена',
'test_message' => 'Message',
'test_no_message' => 'No message',
'test_success' => 'Succesfull: %d',
'test_success' => 'Successful: %d',
'test_fail' => 'Failures: %d',
'test_skipped' => 'Skipped: %d',
'test_error' => 'Errors: %d',

View file

@ -67,7 +67,7 @@ class BuildLogger implements LoggerAwareInterface
}
}
/**
/**
* Add a success-coloured message to the log.
* @param string
*/
@ -98,6 +98,17 @@ class BuildLogger implements LoggerAwareInterface
);
}
/**
* Add a debug message to the log.
* @param string
*/
public function logDebug($message)
{
if (defined('PHPCI_DEBUG_MODE') && PHPCI_DEBUG_MODE) {
$this->log("\033[0;33m" . $message . "\033[0m");
}
}
/**
* Sets a logger instance on the object
*

View file

@ -20,7 +20,7 @@ class FixDatabaseColumns extends AbstractMigration
$build->changeColumn('project_id', 'integer', array('null' => false));
$build->changeColumn('commit_id', 'string', array('limit' => 50, 'null' => false));
$build->changeColumn('status', 'integer', array('null' => false));
$build->changeColumn('log', 'text', array('null' => true, 'default' => ''));
$build->changeColumn('log', 'text', array('null' => true));
$build->changeColumn('branch', 'string', array('limit' => 50, 'null' => false, 'default' => 'master'));
$build->changeColumn('created', 'datetime', array('null' => true));
$build->changeColumn('started', 'datetime', array('null' => true));

View file

@ -14,7 +14,6 @@ class FixColumnTypes extends AbstractMigration
$build = $this->table('build');
$build->changeColumn('log', 'text', array(
'null' => true,
'default' => '',
'limit' => MysqlAdapter::TEXT_MEDIUM,
));

View file

@ -0,0 +1,40 @@
<?php
use Phinx\Migration\AbstractMigration;
class RemoveUniqueNameIndex extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$user = $this->table('user');
if ($user->hasIndex('name', array('unique' => true))) {
$user->removeIndex('name', array('unique' => true));
$user->save();
}
$user->addIndex('name', array('unique' => false));
$user->save();
}
}

View file

@ -0,0 +1,24 @@
<?php
use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;
class ErrorsTable extends AbstractMigration
{
public function change()
{
$table = $this->table('build_error');
$table->addColumn('build_id', 'integer', array('signed' => true));
$table->addColumn('plugin', 'string', array('limit' => 100));
$table->addColumn('file', 'string', array('limit' => 250, 'null' => true));
$table->addColumn('line_start', 'integer', array('signed' => false, 'null' => true));
$table->addColumn('line_end', 'integer', array('signed' => false, 'null' => true));
$table->addColumn('severity', 'integer', array('signed' => false, 'limit' => MysqlAdapter::INT_TINY));
$table->addColumn('message', 'string', array('limit' => 250));
$table->addColumn('created_date', 'datetime');
$table->addIndex(array('build_id', 'created_date'), array('unique' => false));
$table->addForeignKey('build_id', 'build', 'id', array('delete'=> 'CASCADE', 'update' => 'CASCADE'));
$table->save();
}
}

View file

@ -0,0 +1,183 @@
<?php
use Phinx\Migration\AbstractMigration;
use PHPCI\Model\BuildMeta;
use PHPCI\Model\BuildError;
class ConvertErrors extends AbstractMigration
{
/**
* @var \PHPCI\Store\BuildMetaStore
*/
protected $metaStore;
/**
* @var \PHPCI\Store\BuildErrorStore
*/
protected $errorStore;
public function change()
{
$count = 100;
$this->metaStore = \b8\Store\Factory::getStore('BuildMeta');
$this->errorStore = \b8\Store\Factory::getStore('BuildError');
while ($count == 100) {
$data = $this->metaStore->getErrorsForUpgrade(100);
$count = count($data);
/** @var \PHPCI\Model\BuildMeta $meta */
foreach ($data as $meta) {
try {
switch ($meta->getMetaKey()) {
case 'phpmd-data':
$this->processPhpMdMeta($meta);
break;
case 'phpcs-data':
$this->processPhpCsMeta($meta);
break;
case 'phpdoccheck-data':
$this->processPhpDocCheckMeta($meta);
break;
case 'phpcpd-data':
$this->processPhpCpdMeta($meta);
break;
case 'technicaldebt-data':
$this->processTechnicalDebtMeta($meta);
break;
}
} catch (\Exception $ex) {}
$this->metaStore->delete($meta);
}
}
}
protected function processPhpMdMeta(BuildMeta $meta)
{
$data = json_decode($meta->getMetaValue(), true);
if (is_array($data) && count($data)) {
foreach ($data as $error) {
$buildError = new BuildError();
$buildError->setBuildId($meta->getBuildId());
$buildError->setPlugin('php_mess_detector');
$buildError->setCreatedDate(new \DateTime());
$buildError->setFile($error['file']);
$buildError->setLineStart($error['line_start']);
$buildError->setLineEnd($error['line_end']);
$buildError->setSeverity(BuildError::SEVERITY_HIGH);
$buildError->setMessage($error['message']);
$this->errorStore->save($buildError);
}
}
}
protected function processPhpCsMeta(BuildMeta $meta)
{
$data = json_decode($meta->getMetaValue(), true);
if (is_array($data) && count($data)) {
foreach ($data as $error) {
$buildError = new BuildError();
$buildError->setBuildId($meta->getBuildId());
$buildError->setPlugin('php_code_sniffer');
$buildError->setCreatedDate(new \DateTime());
$buildError->setFile($error['file']);
$buildError->setLineStart($error['line']);
$buildError->setLineEnd($error['line']);
$buildError->setMessage($error['message']);
switch ($error['type']) {
case 'ERROR':
$buildError->setSeverity(BuildError::SEVERITY_HIGH);
break;
case 'WARNING':
$buildError->setSeverity(BuildError::SEVERITY_LOW);
break;
}
$this->errorStore->save($buildError);
}
}
}
protected function processPhpDocCheckMeta(BuildMeta $meta)
{
$data = json_decode($meta->getMetaValue(), true);
if (is_array($data) && count($data)) {
foreach ($data as $error) {
$buildError = new BuildError();
$buildError->setBuildId($meta->getBuildId());
$buildError->setPlugin('php_docblock_checker');
$buildError->setCreatedDate(new \DateTime());
$buildError->setFile($error['file']);
$buildError->setLineStart($error['line']);
$buildError->setLineEnd($error['line']);
switch ($error['type']) {
case 'method':
$buildError->setMessage($error['class'] . '::' . $error['method'] . ' is missing a docblock.');
$buildError->setSeverity(BuildError::SEVERITY_NORMAL);
break;
case 'class':
$buildError->setMessage('Class ' . $error['class'] . ' is missing a docblock.');
$buildError->setSeverity(BuildError::SEVERITY_LOW);
break;
}
$this->errorStore->save($buildError);
}
}
}
protected function processPhpCpdMeta(BuildMeta $meta)
{
$data = json_decode($meta->getMetaValue(), true);
if (is_array($data) && count($data)) {
foreach ($data as $error) {
$buildError = new BuildError();
$buildError->setBuildId($meta->getBuildId());
$buildError->setPlugin('php_cpd');
$buildError->setCreatedDate(new \DateTime());
$buildError->setFile($error['file']);
$buildError->setLineStart($error['line_start']);
$buildError->setLineEnd($error['line_end']);
$buildError->setSeverity(BuildError::SEVERITY_NORMAL);
$buildError->setMessage('Copy and paste detected.');
$this->errorStore->save($buildError);
}
}
}
protected function processTechnicalDebtMeta(BuildMeta $meta)
{
$data = json_decode($meta->getMetaValue(), true);
if (is_array($data) && count($data)) {
foreach ($data as $error) {
$buildError = new BuildError();
$buildError->setBuildId($meta->getBuildId());
$buildError->setPlugin('technical_debt');
$buildError->setCreatedDate(new \DateTime());
$buildError->setFile($error['file']);
$buildError->setLineStart($error['line']);
$buildError->setSeverity(BuildError::SEVERITY_NORMAL);
$buildError->setMessage($error['message']);
$this->errorStore->save($buildError);
}
}
}
}

View file

@ -0,0 +1,18 @@
<?php
use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;
class ProjectTableDefaults extends AbstractMigration
{
public function change()
{
$this->table('project')
->changeColumn('build_config', MysqlAdapter::PHINX_TYPE_TEXT, array('null' => true))
->changeColumn('archived', MysqlAdapter::PHINX_TYPE_INTEGER, array(
'length' => MysqlAdapter::INT_TINY,
'default' => 0,
))
->save();
}
}

View file

@ -621,6 +621,18 @@ class BuildBase extends Model
return $this->setProjectId($value->getId());
}
/**
* Get BuildError models by BuildId for this Build.
*
* @uses \PHPCI\Store\BuildErrorStore::getByBuildId()
* @uses \PHPCI\Model\BuildError
* @return \PHPCI\Model\BuildError[]
*/
public function getBuildBuildErrors()
{
return Factory::getStore('BuildError', 'PHPCI')->getByBuildId($this->getId());
}
/**
* Get BuildMeta models by BuildId for this Build.
*

View file

@ -0,0 +1,503 @@
<?php
/**
* BuildError base model for table: build_error
*/
namespace PHPCI\Model\Base;
use PHPCI\Model;
use b8\Store\Factory;
/**
* BuildError Base Model
*/
class BuildErrorBase extends Model
{
/**
* @var array
*/
public static $sleepable = array();
/**
* @var string
*/
protected $tableName = 'build_error';
/**
* @var string
*/
protected $modelName = 'BuildError';
/**
* @var array
*/
protected $data = array(
'id' => null,
'build_id' => null,
'plugin' => null,
'file' => null,
'line_start' => null,
'line_end' => null,
'severity' => null,
'message' => null,
'created_date' => null,
);
/**
* @var array
*/
protected $getters = array(
// Direct property getters:
'id' => 'getId',
'build_id' => 'getBuildId',
'plugin' => 'getPlugin',
'file' => 'getFile',
'line_start' => 'getLineStart',
'line_end' => 'getLineEnd',
'severity' => 'getSeverity',
'message' => 'getMessage',
'created_date' => 'getCreatedDate',
// Foreign key getters:
'Build' => 'getBuild',
);
/**
* @var array
*/
protected $setters = array(
// Direct property setters:
'id' => 'setId',
'build_id' => 'setBuildId',
'plugin' => 'setPlugin',
'file' => 'setFile',
'line_start' => 'setLineStart',
'line_end' => 'setLineEnd',
'severity' => 'setSeverity',
'message' => 'setMessage',
'created_date' => 'setCreatedDate',
// Foreign key setters:
'Build' => 'setBuild',
);
/**
* @var array
*/
public $columns = array(
'id' => array(
'type' => 'int',
'length' => 11,
'primary_key' => true,
'auto_increment' => true,
'default' => null,
),
'build_id' => array(
'type' => 'int',
'length' => 11,
'default' => null,
),
'plugin' => array(
'type' => 'varchar',
'length' => 100,
'default' => null,
),
'file' => array(
'type' => 'varchar',
'length' => 250,
'nullable' => true,
'default' => null,
),
'line_start' => array(
'type' => 'int',
'length' => 11,
'nullable' => true,
'default' => null,
),
'line_end' => array(
'type' => 'int',
'length' => 11,
'nullable' => true,
'default' => null,
),
'severity' => array(
'type' => 'tinyint',
'length' => 3,
'default' => null,
),
'message' => array(
'type' => 'varchar',
'length' => 250,
'default' => null,
),
'created_date' => array(
'type' => 'datetime',
'default' => null,
),
);
/**
* @var array
*/
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'build_id' => array('columns' => 'build_id, created_date'),
);
/**
* @var array
*/
public $foreignKeys = array(
'build_error_ibfk_1' => array(
'local_col' => 'build_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'build',
'col' => 'id'
),
);
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
{
$rtn = $this->data['id'];
return $rtn;
}
/**
* Get the value of BuildId / build_id.
*
* @return int
*/
public function getBuildId()
{
$rtn = $this->data['build_id'];
return $rtn;
}
/**
* Get the value of Plugin / plugin.
*
* @return string
*/
public function getPlugin()
{
$rtn = $this->data['plugin'];
return $rtn;
}
/**
* Get the value of File / file.
*
* @return string
*/
public function getFile()
{
$rtn = $this->data['file'];
return $rtn;
}
/**
* Get the value of LineStart / line_start.
*
* @return int
*/
public function getLineStart()
{
$rtn = $this->data['line_start'];
return $rtn;
}
/**
* Get the value of LineEnd / line_end.
*
* @return int
*/
public function getLineEnd()
{
$rtn = $this->data['line_end'];
return $rtn;
}
/**
* Get the value of Severity / severity.
*
* @return int
*/
public function getSeverity()
{
$rtn = $this->data['severity'];
return $rtn;
}
/**
* Get the value of Message / message.
*
* @return string
*/
public function getMessage()
{
$rtn = $this->data['message'];
return $rtn;
}
/**
* Get the value of CreatedDate / created_date.
*
* @return \DateTime
*/
public function getCreatedDate()
{
$rtn = $this->data['created_date'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->_validateNotNull('Id', $value);
$this->_validateInt('Id', $value);
if ($this->data['id'] === $value) {
return;
}
$this->data['id'] = $value;
$this->_setModified('id');
}
/**
* Set the value of BuildId / build_id.
*
* Must not be null.
* @param $value int
*/
public function setBuildId($value)
{
$this->_validateNotNull('BuildId', $value);
$this->_validateInt('BuildId', $value);
if ($this->data['build_id'] === $value) {
return;
}
$this->data['build_id'] = $value;
$this->_setModified('build_id');
}
/**
* Set the value of Plugin / plugin.
*
* Must not be null.
* @param $value string
*/
public function setPlugin($value)
{
$this->_validateNotNull('Plugin', $value);
$this->_validateString('Plugin', $value);
if ($this->data['plugin'] === $value) {
return;
}
$this->data['plugin'] = $value;
$this->_setModified('plugin');
}
/**
* Set the value of File / file.
*
* @param $value string
*/
public function setFile($value)
{
$this->_validateString('File', $value);
if ($this->data['file'] === $value) {
return;
}
$this->data['file'] = $value;
$this->_setModified('file');
}
/**
* Set the value of LineStart / line_start.
*
* @param $value int
*/
public function setLineStart($value)
{
$this->_validateInt('LineStart', $value);
if ($this->data['line_start'] === $value) {
return;
}
$this->data['line_start'] = $value;
$this->_setModified('line_start');
}
/**
* Set the value of LineEnd / line_end.
*
* @param $value int
*/
public function setLineEnd($value)
{
$this->_validateInt('LineEnd', $value);
if ($this->data['line_end'] === $value) {
return;
}
$this->data['line_end'] = $value;
$this->_setModified('line_end');
}
/**
* Set the value of Severity / severity.
*
* Must not be null.
* @param $value int
*/
public function setSeverity($value)
{
$this->_validateNotNull('Severity', $value);
$this->_validateInt('Severity', $value);
if ($this->data['severity'] === $value) {
return;
}
$this->data['severity'] = $value;
$this->_setModified('severity');
}
/**
* Set the value of Message / message.
*
* Must not be null.
* @param $value string
*/
public function setMessage($value)
{
$this->_validateNotNull('Message', $value);
$this->_validateString('Message', $value);
if ($this->data['message'] === $value) {
return;
}
$this->data['message'] = $value;
$this->_setModified('message');
}
/**
* Set the value of CreatedDate / created_date.
*
* Must not be null.
* @param $value \DateTime
*/
public function setCreatedDate($value)
{
$this->_validateNotNull('CreatedDate', $value);
$this->_validateDate('CreatedDate', $value);
if ($this->data['created_date'] === $value) {
return;
}
$this->data['created_date'] = $value;
$this->_setModified('created_date');
}
/**
* Get the Build model for this BuildError by Id.
*
* @uses \PHPCI\Store\BuildStore::getById()
* @uses \PHPCI\Model\Build
* @return \PHPCI\Model\Build
*/
public function getBuild()
{
$key = $this->getBuildId();
if (empty($key)) {
return null;
}
$cacheKey = 'Cache.Build.' . $key;
$rtn = $this->cache->get($cacheKey, null);
if (empty($rtn)) {
$rtn = Factory::getStore('Build', 'PHPCI')->getById($key);
$this->cache->set($cacheKey, $rtn);
}
return $rtn;
}
/**
* Set Build - Accepts an ID, an array representing a Build or a Build model.
*
* @param $value mixed
*/
public function setBuild($value)
{
// Is this an instance of Build?
if ($value instanceof \PHPCI\Model\Build) {
return $this->setBuildObject($value);
}
// Is this an array representing a Build item?
if (is_array($value) && !empty($value['id'])) {
return $this->setBuildId($value['id']);
}
// Is this a scalar value representing the ID of this foreign key?
return $this->setBuildId($value);
}
/**
* Set Build - Accepts a Build model.
*
* @param $value \PHPCI\Model\Build
*/
public function setBuildObject(\PHPCI\Model\Build $value)
{
return $this->setBuildId($value->getId());
}
}

View file

@ -107,7 +107,7 @@ class UserBase extends Model
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'idx_email' => array('unique' => true, 'columns' => 'email'),
'email' => array('unique' => true, 'columns' => 'email'),
'name' => array('unique' => true, 'columns' => 'name'),
'name' => array('columns' => 'name'),
);
/**

View file

@ -28,7 +28,7 @@ class Build extends BuildBase
const STATUS_SUCCESS = 2;
const STATUS_FAILED = 3;
public $currentBuildPath = null;
public $currentBuildPath;
/**
* Get link to commit from another source (i.e. Github)
@ -213,14 +213,36 @@ class Build extends BuildBase
/**
* Allows specific build types (e.g. Github) to report violations back to their respective services.
* @param Builder $builder
* @param $file
* @param $line
* @param $plugin
* @param $message
* @return mixed
* @param int $severity
* @param null $file
* @param null $lineStart
* @param null $lineEnd
* @return BuildError
*/
public function reportError(Builder $builder, $file, $line, $message)
{
return array($builder, $file, $line, $message);
public function reportError(
Builder $builder,
$plugin,
$message,
$severity = BuildError::SEVERITY_NORMAL,
$file = null,
$lineStart = null,
$lineEnd = null
) {
unset($builder);
$error = new BuildError();
$error->setBuild($this);
$error->setCreatedDate(new \DateTime());
$error->setPlugin($plugin);
$error->setMessage($message);
$error->setSeverity($severity);
$error->setFile($file);
$error->setLineStart($lineStart);
$error->setLineEnd($lineEnd);
return Factory::getStore('BuildError')->save($error);
}
/**
@ -233,7 +255,13 @@ class Build extends BuildBase
if (!$this->getId()) {
return null;
}
return PHPCI_BUILD_ROOT_DIR . $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
if (empty($this->currentBuildPath)) {
$buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
$this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DIRECTORY_SEPARATOR;
}
return $this->currentBuildPath;
}
/**
@ -249,4 +277,25 @@ class Build extends BuildBase
exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath));
}
/**
* Get the number of seconds a build has been running for.
* @return int
*/
public function getDuration()
{
$start = $this->getStarted();
if (empty($start)) {
return 0;
}
$end = $this->getFinished();
if (empty($end)) {
$end = new \DateTime();
}
return $end->getTimestamp() - $start->getTimestamp();
}
}

View file

@ -151,7 +151,7 @@ class GithubBuild extends RemoteGitBuild
$link = 'https://github.com/' . $reference . '/';
$link .= 'blob/' . $branch . '/';
$link .= '{FILE}';
$link .= '#L{LINE}';
$link .= '#L{LINE}-L{LINE_END}';
return $link;
}
@ -190,9 +190,16 @@ class GithubBuild extends RemoteGitBuild
/**
* @inheritDoc
*/
public function reportError(Builder $builder, $file, $line, $message)
{
$diffLineNumber = $this->getDiffLineNumber($builder, $file, $line);
public function reportError(
Builder $builder,
$plugin,
$message,
$severity = BuildError::SEVERITY_NORMAL,
$file = null,
$lineStart = null,
$lineEnd = null
) {
$diffLineNumber = $this->getDiffLineNumber($builder, $file, $lineStart);
if (!is_null($diffLineNumber)) {
$helper = new Github();
@ -207,6 +214,8 @@ class GithubBuild extends RemoteGitBuild
$helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message);
}
}
return parent::reportError($builder, $plugin, $message, $severity, $file, $lineStart, $lineEnd);
}
/**
@ -218,6 +227,8 @@ class GithubBuild extends RemoteGitBuild
*/
protected function getDiffLineNumber(Builder $builder, $file, $line)
{
$line = (integer)$line;
$builder->logExecOutput(false);
$prNumber = $this->getExtra('pull_request_number');

View file

@ -0,0 +1,63 @@
<?php
/**
* BuildError model for table: build_error
*/
namespace PHPCI\Model;
use PHPCI\Model\Base\BuildErrorBase;
/**
* BuildError Model
* @uses PHPCI\Model\Base\BuildErrorBase
*/
class BuildError extends BuildErrorBase
{
const SEVERITY_CRITICAL = 0;
const SEVERITY_HIGH = 1;
const SEVERITY_NORMAL = 2;
const SEVERITY_LOW = 3;
/**
* Get the language string key for this error's severity level.
* @return string
*/
public function getSeverityString()
{
switch ($this->getSeverity()) {
case self::SEVERITY_CRITICAL:
return 'critical';
case self::SEVERITY_HIGH:
return 'high';
case self::SEVERITY_NORMAL:
return 'normal';
case self::SEVERITY_LOW:
return 'low';
}
}
/**
* Get the class to apply to HTML elements representing this error.
* @return string
*/
public function getSeverityClass()
{
switch ($this->getSeverity()) {
case self::SEVERITY_CRITICAL:
return 'danger';
case self::SEVERITY_HIGH:
return 'warning';
case self::SEVERITY_NORMAL:
return 'info';
case self::SEVERITY_LOW:
return 'default';
}
}
}

View file

@ -50,6 +50,29 @@ class Project extends ProjectBase
return null;
}
/**
* Return the previous build from a specific branch, for this project.
* @param string $branch
* @return mixed|null
*/
public function getPreviousBuild($branch = 'master')
{
$criteria = array('branch' => $branch, 'project_id' => $this->getId());
$order = array('id' => 'DESC');
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order);
if (is_array($builds['items']) && count($builds['items'])) {
$previous = array_shift($builds['items']);
if (isset($previous) && $previous instanceof Build) {
return $previous;
}
}
return null;
}
/**
* Store this project's access_information data
* @param string|array $value
@ -73,7 +96,7 @@ class Project extends ProjectBase
$info = $this->data['access_information'];
// Handle old-format (serialized) access information first:
if (!empty($info) && substr($info, 0, 1) != '{') {
if (!empty($info) && !in_array(substr($info, 0, 1), array('{', '['))) {
$data = unserialize($info);
} else {
$data = json_decode($info, true);

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Model\BuildError;
/**
* Behat BDD Plugin
@ -119,7 +120,14 @@ class Behat implements \PHPCI\Plugin
'line' => $lineParts[1]
);
$this->build->reportError($this->phpci, $lineParts[0], $lineParts[1], 'Behat scenario failed.');
$this->build->reportError(
$this->phpci,
'behat',
'Behat scenario failed.',
BuildError::SEVERITY_HIGH,
$lineParts[0],
$lineParts[1]
);
}
}

View file

@ -38,19 +38,19 @@ class Campfire implements \PHPCI\Plugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$this->phpci = $phpci;
$this->build = $build;
$this->message = $options['message'];
$this->phpci = $phpci;
$this->build = $build;
$this->message = $options['message'];
$this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)";
$this->cookie = "phpcicookie";
$this->cookie = "phpcicookie";
$buildSettings = $phpci->getConfig('build_settings');
if (isset($buildSettings['campfire'])) {
$campfire = $buildSettings['campfire'];
$this->url = $campfire['url'];
$campfire = $buildSettings['campfire'];
$this->url = $campfire['url'];
$this->authToken = $campfire['authToken'];
$this->roomId = $campfire['roomId'];
$this->roomId = $campfire['roomId'];
} else {
throw new \Exception(Lang::get('no_campfire_settings'));
}
@ -63,7 +63,7 @@ class Campfire implements \PHPCI\Plugin
*/
public function execute()
{
$url = PHPCI_URL."build/view/".$this->build->getId();
$url = PHPCI_URL . "build/view/" . $this->build->getId();
$message = str_replace("%buildurl%", $url, $this->message);
$this->joinRoom($this->roomId);
$status = $this->speak($message, $this->roomId);
@ -101,6 +101,7 @@ class Campfire implements \PHPCI\Plugin
public function speak($message, $roomId, $isPaste = false)
{
$page = '/room/'.$roomId.'/speak.json';
if ($isPaste) {
$type = 'PasteMessage';
} else {
@ -143,10 +144,12 @@ class Campfire implements \PHPCI\Plugin
// We tend to get one space with an otherwise blank response
$output = trim($output);
if (strlen($output)) {
/* Responses are JSON. Decode it to a data structure */
return json_decode($output);
}
// Simple 200 OK response (such as for joining a room)
return true;
}

View file

@ -39,9 +39,9 @@ class CleanBuild implements \PHPCI\Plugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$this->phpci = $phpci;
$this->build = $build;
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array();
$this->phpci = $phpci;
$this->build = $build;
$this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array();
}
/**
@ -57,7 +57,7 @@ class CleanBuild implements \PHPCI\Plugin
$this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock');
$success = true;
foreach ($this->remove as $file) {
$ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file);

View file

@ -83,7 +83,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
{
$this->phpci = $phpci;
$this->build = $build;
$this->path = 'tests/_output/';
$this->path = 'tests' . DIRECTORY_SEPARATOR . '_output' . DIRECTORY_SEPARATOR;
if (empty($options['config'])) {
$this->ymlConfigFile = self::findConfigFile($this->phpci->buildPath);
@ -99,7 +99,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
}
/**
* Runs Codeception tests, optionally using specified config file(s).
* Runs Codeception tests
*/
public function execute()
{
@ -148,9 +148,9 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
$output = $parser->parse();
$meta = array(
'tests' => $parser->getTotalTests(),
'tests' => $parser->getTotalTests(),
'timetaken' => $parser->getTotalTimeTaken(),
'failures' => $parser->getTotalFailures()
'failures' => $parser->getTotalFailures()
);
$this->build->storeMeta('codeception-meta', $meta);

View file

@ -38,7 +38,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
$path = $builder->buildPath . '/composer.json';
$path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.json';
if (file_exists($path) && $stage == 'setup') {
return true;
@ -55,16 +55,17 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = $path;
$this->action = 'install';
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = $path;
$this->action = 'install';
$this->preferDist = false;
$this->nodev = false;
$this->preferSource = false;
$this->nodev = false;
if (array_key_exists('directory', $options)) {
$this->directory = $path . '/' . $options['directory'];
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
}
if (array_key_exists('action', $options)) {
@ -75,6 +76,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$this->preferDist = (bool)$options['prefer_dist'];
}
if (array_key_exists('prefer_source', $options)) {
$this->preferDist = false;
$this->preferSource = (bool)$options['prefer_source'];
}
if (array_key_exists('no_dev', $options)) {
$this->nodev = (bool)$options['no_dev'];
}
@ -97,10 +103,12 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
if ($this->preferDist) {
$this->phpci->log('Using --prefer-dist flag');
$cmd .= '--prefer-dist';
} else {
$cmd .= ' --prefer-dist';
}
if ($this->preferSource) {
$this->phpci->log('Using --prefer-source flag');
$cmd .= '--prefer-source';
$cmd .= ' --prefer-source';
}
if ($this->nodev) {

View file

@ -35,12 +35,12 @@ class CopyBuild implements \PHPCI\Plugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
$this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false;
$this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false;
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
$this->wipe = isset($options['wipe']) ? (bool)$options['wipe'] : false;
$this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false;
}
/**

View file

@ -23,6 +23,7 @@ class Deployer implements \PHPCI\Plugin
{
protected $webhookUrl;
protected $reason;
protected $updateOnly;
/**
* Set up the plugin, configure options, etc.
@ -43,6 +44,8 @@ class Deployer implements \PHPCI\Plugin
if (isset($options['reason'])) {
$this->reason = $options['reason'];
}
$this->updateOnly = isset($options['update_only']) ? (bool) $options['update_only'] : true;
}
/**
@ -61,6 +64,8 @@ class Deployer implements \PHPCI\Plugin
'reason' => $this->phpci->interpolate($this->reason),
'source' => 'PHPCI',
'url' => $this->phpci->interpolate('%BUILD_URI%'),
'branch' => $this->phpci->interpolate('%BRANCH%'),
'update_only' => $this->updateOnly
));
return $response['success'];

View file

@ -52,9 +52,9 @@ class Email implements \PHPCI\Plugin
Build $build,
array $options = array()
) {
$this->phpci = $phpci;
$this->build = $build;
$this->options = $options;
$this->phpci = $phpci;
$this->build = $build;
$this->options = $options;
}
/**
@ -134,7 +134,7 @@ class Email implements \PHPCI\Plugin
* Send an email to a list of specified subjects.
*
* @param array $toAddresses
* List of destinatary of message.
* List of destination addresses for message.
* @param string $subject
* Mail subject
* @param string $body

View file

@ -52,7 +52,7 @@ class Env implements \PHPCI\Plugin
// This allows the standard syntax: "FOO: bar"
$env_var = "$key=$value";
}
if (!putenv($this->phpci->interpolate($env_var))) {
$success = false;
$this->phpci->logFailure(Lang::get('unable_to_set_env'));

View file

@ -52,7 +52,7 @@ class Grunt implements \PHPCI\Plugin
// Handle options:
if (isset($options['directory'])) {
$this->directory = $path . '/' . $options['directory'];
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
}
if (isset($options['task'])) {

View file

@ -52,7 +52,7 @@ class Gulp implements \PHPCI\Plugin
// Handle options:
if (isset($options['directory'])) {
$this->directory = $path . '/' . $options['directory'];
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
}
if (isset($options['task'])) {

View file

@ -41,9 +41,9 @@ class Lint implements PHPCI\Plugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$this->phpci = $phpci;
$this->phpci = $phpci;
$this->build = $build;
$this->directories = array('');
$this->directories = array('');
$this->ignore = $phpci->ignore;
if (!empty($options['directory'])) {
@ -93,7 +93,7 @@ class Lint implements PHPCI\Plugin
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
$success = false;
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . '/')) {
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTORY_SEPARATOR)) {
$success = false;
}

View file

@ -166,10 +166,11 @@ class Mysql implements \PHPCI\Plugin
$args = array(
':import_file' => escapeshellarg($import_file),
':decomp_cmd' => $decomp_cmd,
':host' => escapeshellarg($this->host),
':user' => escapeshellarg($this->user),
':pass' => escapeshellarg($this->pass),
':database' => ($database === null)? '': escapeshellarg($database),
);
return strtr('cat :import_file :decomp_cmd | mysql -u:user -p:pass :database', $args);
return strtr('cat :import_file :decomp_cmd | mysql -h:host -u:user -p:pass :database', $args);
}
}

View file

@ -33,12 +33,12 @@ class PackageBuild implements \PHPCI\Plugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$path = $phpci->buildPath;
$this->build = $build;
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
$this->filename = isset($options['filename']) ? $options['filename'] : 'build';
$this->format = isset($options['format']) ? $options['format'] : 'zip';
$path = $phpci->buildPath;
$this->build = $build;
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
$this->filename = isset($options['filename']) ? $options['filename'] : 'build';
$this->format = isset($options['format']) ? $options['format'] : 'zip';
}
/**
@ -46,7 +46,7 @@ class PackageBuild implements \PHPCI\Plugin
*/
public function execute()
{
$path = $this->phpci->buildPath;
$path = $this->phpci->buildPath;
$build = $this->build;
if ($this->directory == $path) {

View file

@ -73,8 +73,11 @@ class Pdepend implements \PHPCI\Plugin
*/
public function execute()
{
if (!file_exists($this->location)) {
mkdir($this->location);
}
if (!is_writable($this->location)) {
throw new \Exception(sprintf('The location %s is not writable.', $this->location));
throw new \Exception(sprintf('The location %s is not writable or does not exist.', $this->location));
}
$pdepend = $this->phpci->findBinary('pdepend');

View file

@ -73,9 +73,9 @@ class Pgsql implements \PHPCI\Plugin
}
/**
* Connects to PgSQL and runs a specified set of queries.
* @return boolean
*/
* Connects to PgSQL and runs a specified set of queries.
* @return boolean
*/
public function execute()
{
try {

View file

@ -213,7 +213,7 @@ class Phar implements \PHPCI\Plugin
$content = '';
$filename = $this->getStub();
if ($filename) {
$content = file_get_contents($this->getPHPCI()->buildPath . '/' . $this->getStub());
$content = file_get_contents($this->getPHPCI()->buildPath . DIRECTORY_SEPARATOR . $this->getStub());
}
return $content;
}
@ -227,7 +227,8 @@ class Phar implements \PHPCI\Plugin
$success = false;
try {
$phar = new PHPPhar($this->getDirectory() . '/' . $this->getFilename(), 0, $this->getFilename());
$file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename();
$phar = new PHPPhar($file, 0, $this->getFilename());
$phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp());
$stub = $this->getStubContent();
@ -236,7 +237,6 @@ class Phar implements \PHPCI\Plugin
}
$success = true;
} catch (Exception $e) {
$this->getPHPCI()->log(Lang::get('phar_internal_error'));
$this->getPHPCI()->log($e->getMessage());

View file

@ -47,7 +47,7 @@ class Phing implements \PHPCI\Plugin
* Set working directory
*/
if (isset($options['directory'])) {
$directory = $phpci->buildPath . '/' . $options['directory'];
$directory = $phpci->buildPath . DIRECTORY_SEPARATOR . $options['directory'];
} else {
$directory = $phpci->buildPath;
}
@ -255,7 +255,7 @@ class Phing implements \PHPCI\Plugin
*/
public function setPropertyFile($propertyFile)
{
if (!file_exists($this->getDirectory() . '/' . $propertyFile)) {
if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) {
throw new \Exception(Lang::get('property_file_missing'));
}

View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Model\BuildError;
/**
* PHP Code Sniffer Plugin - Allows PHP Code Sniffer testing.
@ -163,14 +164,13 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
);
$output = $this->phpci->getLastOutput();
list($errors, $warnings, $data) = $this->processReport($output);
list($errors, $warnings) = $this->processReport($output);
$this->phpci->logExecOutput(true);
$success = true;
$this->build->storeMeta('phpcs-warnings', $warnings);
$this->build->storeMeta('phpcs-errors', $errors);
$this->build->storeMeta('phpcs-data', $data);
if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) {
$success = false;
@ -226,23 +226,21 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$errors = $data['totals']['errors'];
$warnings = $data['totals']['warnings'];
$rtn = array();
foreach ($data['files'] as $fileName => $file) {
$fileName = str_replace($this->phpci->buildPath, '', $fileName);
foreach ($file['messages'] as $message) {
$this->build->reportError($this->phpci, $fileName, $message['line'], 'PHPCS: ' . $message['message']);
$rtn[] = array(
'file' => $fileName,
'line' => $message['line'],
'type' => $message['type'],
'message' => $message['message'],
$this->build->reportError(
$this->phpci,
'php_code_sniffer',
'PHPCS: ' . $message['message'],
$message['type'] == 'ERROR' ? BuildError::SEVERITY_HIGH : BuildError::SEVERITY_LOW,
$fileName,
$message['line']
);
}
}
return array($errors, $warnings, $rtn);
return array($errors, $warnings);
}
}

37
PHPCI/Plugin/PhpCpd.php Normal file → Executable file
View file

@ -12,6 +12,7 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Model\BuildError;
/**
* PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing.
@ -28,7 +29,7 @@ class PhpCpd implements \PHPCI\Plugin
/**
* @var string, based on the assumption the root may not hold the code to be
* tested, exteds the base path
* tested, extends the base path
*/
protected $path;
@ -49,17 +50,12 @@ class PhpCpd implements \PHPCI\Plugin
$this->build = $build;
$this->path = $phpci->buildPath;
$this->standard = 'PSR1';
$this->ignore = $phpci->ignore;
if (!empty($options['path'])) {
$this->path = $phpci->buildPath . $options['path'];
}
if (!empty($options['standard'])) {
$this->standard = $options['standard'];
}
if (!empty($options['ignore'])) {
$this->ignore = $options['ignore'];
}
@ -74,9 +70,9 @@ class PhpCpd implements \PHPCI\Plugin
if (count($this->ignore)) {
$map = function ($item) {
// remove the trailing slash
$item = (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
$item = rtrim($item, DIRECTORY_SEPARATOR);
if (is_file($this->path . '/' . $item)) {
if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
return ' --names-exclude ' . $item;
} else {
return ' --exclude ' . $item;
@ -97,9 +93,8 @@ class PhpCpd implements \PHPCI\Plugin
print $this->phpci->getLastOutput();
list($errorCount, $data) = $this->processReport(file_get_contents($tmpfilename));
$errorCount = $this->processReport(file_get_contents($tmpfilename));
$this->build->storeMeta('phpcpd-warnings', $errorCount);
$this->build->storeMeta('phpcpd-data', $data);
unlink($tmpfilename);
@ -122,20 +117,11 @@ class PhpCpd implements \PHPCI\Plugin
}
$warnings = 0;
$data = array();
foreach ($xml->duplication as $duplication) {
foreach ($duplication->file as $file) {
$fileName = (string)$file['path'];
$fileName = str_replace($this->phpci->buildPath, '', $fileName);
$data[] = array(
'file' => $fileName,
'line_start' => (int) $file['line'],
'line_end' => (int) $file['line'] + (int) $duplication['lines'],
'code' => (string) $duplication->codefragment
);
$message = <<<CPD
Copy and paste detected:
@ -144,13 +130,20 @@ Copy and paste detected:
```
CPD;
$this->build->reportError($this->phpci, $fileName, $file['line'], $message);
$this->build->reportError(
$this->phpci,
'php_cpd',
$message,
BuildError::SEVERITY_NORMAL,
$fileName,
$file['line'],
(int) $file['line'] + (int) $duplication['lines']
);
}
$warnings++;
}
return array($warnings, $data);
return $warnings;
}
}

View file

@ -32,10 +32,10 @@ class PhpCsFixer implements \PHPCI\Plugin
protected $build;
protected $workingDir = '';
protected $level = ' --level=all';
protected $verbose = '';
protected $diff = '';
protected $levels = array('psr0', 'psr1', 'psr2', 'all');
protected $level = ' --level=psr2';
protected $verbose = '';
protected $diff = '';
protected $levels = array('psr0', 'psr1', 'psr2', 'symfony');
/**
* Standard Constructor

View file

@ -143,7 +143,6 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$success = true;
$this->build->storeMeta('phpdoccheck-warnings', $errors);
$this->build->storeMeta('phpdoccheck-data', $output);
$this->reportErrors($output);
if ($this->allowed_warnings != -1 && $errors > $this->allowed_warnings) {
@ -160,13 +159,22 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected function reportErrors($output)
{
foreach ($output as $error) {
$message = 'Class ' . $error['class'] . ' does not have a Docblock comment.';
$message = 'Class ' . $error['class'] . ' is missing a docblock.';
$severity = PHPCI\Model\BuildError::SEVERITY_LOW;
if ($error['type'] == 'method') {
$message = 'Method ' . $error['class'] . '::' . $error['method'] . ' does not have a Docblock comment.';
$message = $error['class'] . '::' . $error['method'] . ' is missing a docblock.';
$severity = PHPCI\Model\BuildError::SEVERITY_NORMAL;
}
$this->build->reportError($this->phpci, $error['file'], $error['line'], $message);
$this->build->reportError(
$this->phpci,
'php_docblock_checker',
$message,
$severity,
$error['file'],
$error['line']
);
}
}
}

View file

@ -69,19 +69,20 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
public function execute()
{
$ignore = '';
if (count($this->phpci->ignore)) {
$map = function ($item) {
return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
};
$ignore = array_map($map, $this->phpci->ignore);
if (count($this->phpci->ignore)) {
$map = function ($item) {
return ' --exclude ' . rtrim($item, DIRECTORY_SEPARATOR);
};
$ignore = array_map($map, $this->phpci->ignore);
$ignore = implode('', $ignore);
}
$phploc = $this->phpci->findBinary('phploc');
$success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory);
$output = $this->phpci->getLastOutput();
$output = $this->phpci->getLastOutput();
if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) {
$data = array();

View file

@ -38,7 +38,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* @var string, based on the assumption the root may not hold the code to be
* tested, exteds the base path only if the provided path is relative. Absolute
* tested, extends the base path only if the provided path is relative. Absolute
* paths are used verbatim
*/
protected $path;
@ -50,7 +50,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Array of PHPMD rules. Can be one of the builtins (codesize, unusedcode, naming, design, controversial)
* or a filenname (detected by checking for a / in it), either absolute or relative to the project root.
* or a filename (detected by checking for a / in it), either absolute or relative to the project root.
* @var array
*/
protected $rules;
@ -123,9 +123,8 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$this->executePhpMd($phpmdBinaryPath);
list($errorCount, $data) = $this->processReport(trim($this->phpci->getLastOutput()));
$errorCount = $this->processReport(trim($this->phpci->getLastOutput()));
$this->build->storeMeta('phpmd-warnings', $errorCount);
$this->build->storeMeta('phpmd-data', $data);
return $this->wasLastExecSuccessful($errorCount);
}
@ -158,7 +157,6 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
$warnings = 0;
$data = array();
foreach ($xml->file as $file) {
$fileName = (string)$file['name'];
@ -166,22 +164,20 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
foreach ($file->violation as $violation) {
$warnings++;
$warning = array(
'file' => $fileName,
'line_start' => (int)$violation['beginline'],
'line_end' => (int)$violation['endline'],
'rule' => (string)$violation['rule'],
'ruleset' => (string)$violation['ruleset'],
'priority' => (int)$violation['priority'],
'message' => (string)$violation,
);
$this->build->reportError($this->phpci, $fileName, (int)$violation['beginline'], (string)$violation);
$data[] = $warning;
$this->build->reportError(
$this->phpci,
'php_mess_detector',
(string)$violation,
PHPCI\Model\BuildError::SEVERITY_HIGH,
$fileName,
(int)$violation['beginline'],
(int)$violation['endline']
);
}
}
return array($warnings, $data);
return $warnings;
}
/**

View file

@ -55,10 +55,10 @@ class PhpParallelLint implements \PHPCI\Plugin
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$this->phpci = $phpci;
$this->build = $build;
$this->directory = $phpci->buildPath;
$this->ignore = $this->phpci->ignore;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = $phpci->buildPath;
$this->ignore = $this->phpci->ignore;
if (isset($options['directory'])) {
$this->directory = $phpci->buildPath.$options['directory'];

View file

@ -155,7 +155,7 @@ class PhpTalLint implements PHPCI\Plugin
if (!$this->lintFile($itemPath)) {
$success = false;
}
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . '/')) {
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . DIRECTORY_SEPARATOR)) {
$success = false;
}
@ -202,7 +202,9 @@ class PhpTalLint implements PHPCI\Plugin
list($suffixes, $tales) = $this->getFlags();
$lint = dirname(__FILE__) . '/../../vendor/phptal/phptal/tools/phptal_lint.php';
$lint = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
$lint .= 'vendor' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR;
$lint .= 'tools' . DIRECTORY_SEPARATOR . 'phptal_lint.php';
$cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"';
$this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path);
@ -222,7 +224,7 @@ class PhpTalLint implements PHPCI\Plugin
$row = str_replace('(use -i to include your custom modifier functions)', '', $row);
$message = str_replace($name . ': ', '', $row);
$parts = explode(' (line ', $message);
$message = trim($parts[0]);

View file

@ -76,8 +76,8 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
return 'phpunit.xml';
}
if (file_exists($buildPath . 'tests/phpunit.xml')) {
return 'tests/phpunit.xml';
if (file_exists($buildPath . 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml')) {
return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml';
}
if (file_exists($buildPath . 'phpunit.xml.dist')) {
@ -85,7 +85,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
if (file_exists($buildPath . 'tests/phpunit.xml.dist')) {
return 'tests/phpunit.xml.dist';
return 'tests' . DIRECTORY_SEPARATOR . 'phpunit.xml.dist';
}
return null;
@ -194,7 +194,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
} else {
if ($this->runFrom) {
$curdir = getcwd();
chdir($this->phpci->buildPath.'/'.$this->runFrom);
chdir($this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->runFrom);
}
$phpunit = $this->phpci->findBinary('phpunit');

View file

@ -24,6 +24,7 @@ class SlackNotify implements \PHPCI\Plugin
private $username;
private $message;
private $icon;
private $show_status;
/**
* Set up the plugin, configure options, etc.
@ -60,6 +61,12 @@ class SlackNotify implements \PHPCI\Plugin
$this->username = 'PHPCI';
}
if (isset($options['show_status'])) {
$this->show_status = (bool) $options['show_status'];
} else {
$this->show_status = true;
}
if (isset($options['icon'])) {
$this->icon = $options['icon'];
}
@ -74,31 +81,7 @@ class SlackNotify implements \PHPCI\Plugin
*/
public function execute()
{
$message = $this->phpci->interpolate($this->message);
$successfulBuild = $this->build->isSuccessful();
if ($successfulBuild) {
$status = 'Success';
$color = 'good';
} else {
$status = 'Failed';
$color = 'danger';
}
// Build up the attachment data
$attachment = new \Maknz\Slack\Attachment(array(
'fallback' => $message,
'pretext' => $message,
'color' => $color,
'fields' => array(
new \Maknz\Slack\AttachmentField(array(
'title' => 'Status',
'value' => $status,
'short' => false
))
)
));
$body = $this->phpci->interpolate($this->message);
$client = new \Maknz\Slack\Client($this->webHook);
@ -116,12 +99,39 @@ class SlackNotify implements \PHPCI\Plugin
$message->setIcon($this->icon);
}
$message->attach($attachment);
// Include an attachment which shows the status and hide the message
if ($this->show_status) {
$successfulBuild = $this->build->isSuccessful();
$success = true;
if ($successfulBuild) {
$status = 'Success';
$color = 'good';
} else {
$status = 'Failed';
$color = 'danger';
}
$message->send('');
// Build up the attachment data
$attachment = new \Maknz\Slack\Attachment(array(
'fallback' => $body,
'pretext' => $body,
'color' => $color,
'fields' => array(
new \Maknz\Slack\AttachmentField(array(
'title' => 'Status',
'value' => $status,
'short' => false
))
)
));
return $success;
$message->attach($attachment);
$body = '';
}
$message->send($body);
return true;
}
}

View file

@ -124,12 +124,11 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$success = true;
$this->phpci->logExecOutput(false);
list($errorCount, $data) = $this->getErrorList();
$errorCount = $this->getErrorList();
$this->phpci->log("Found $errorCount instances of " . implode(', ', $this->searches));
$this->build->storeMeta('technical_debt-warnings', $errorCount);
$this->build->storeMeta('technical_debt-data', $data);
if ($this->allowed_errors != -1 && $errorCount > $this->allowed_errors) {
$success = false;
@ -164,7 +163,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
// Ignore hidden files, else .git, .sass_cache, etc. all get looped over
if (stripos($filePath, '/.') !== false) {
if (stripos($filePath, DIRECTORY_SEPARATOR . '.') !== false) {
$skipFile = true;
}
@ -175,7 +174,6 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$files = array_filter(array_unique($files));
$errorCount = 0;
$data = array();
foreach ($files as $file) {
foreach ($this->searches as $search) {
@ -191,18 +189,19 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$errorCount++;
$fileName = str_replace($this->directory, '', $file);
$data[] = array(
'file' => $fileName,
'line' => $lineNumber,
'message' => $content
$this->build->reportError(
$this->phpci,
'technical_debt',
$content,
PHPCI\Model\BuildError::SEVERITY_LOW,
$fileName,
$lineNumber
);
$this->build->reportError($this->phpci, $fileName, $lineNumber, $content);
}
}
}
return array( $errorCount, $data );
return $errorCount;
}
}

View file

@ -8,8 +8,8 @@ namespace PHPCI\Plugin\Util;
*/
class Factory
{
const TYPE_ARRAY = "array";
const TYPE_CALLABLE = "callable";
const TYPE_ARRAY = "array";
const TYPE_CALLABLE = "callable";
const INTERFACE_PHPCI_PLUGIN = '\PHPCI\Plugin';
private $currentPluginOptions;

View file

@ -56,6 +56,7 @@ class FilesPluginInformation implements InstalledPluginInformation
if ($this->pluginInfo === null) {
$this->loadPluginInfo();
}
return $this->pluginInfo;
}
@ -83,7 +84,7 @@ class FilesPluginInformation implements InstalledPluginInformation
$this->pluginInfo = array();
foreach ($this->files as $fileInfo) {
if ($fileInfo instanceof \SplFileInfo) {
if ($fileInfo->isFile() && $fileInfo->getExtension()=='php') {
if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') {
$this->addPluginFromFile($fileInfo);
}
}
@ -99,11 +100,11 @@ class FilesPluginInformation implements InstalledPluginInformation
$class = $this->getFullClassFromFile($fileInfo);
if (!is_null($class)) {
$newPlugin = new \stdClass();
$newPlugin->class = $class;
$newPlugin = new \stdClass();
$newPlugin->class = $class;
$newPlugin->source = "core";
$parts = explode('\\', $newPlugin->class);
$newPlugin->name = end($parts);
$parts = explode('\\', $newPlugin->class);
$newPlugin->name = end($parts);
$this->pluginInfo[] = $newPlugin;
}
@ -123,11 +124,11 @@ class FilesPluginInformation implements InstalledPluginInformation
if (isset($matches[1])) {
$className = $matches[1];
$matches = array();
preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches);
$namespace = $matches[1];
return $namespace . '\\' . $className;
} else {
return null;

View file

@ -32,9 +32,11 @@ class PluginInformationCollection implements InstalledPluginInformation
public function getInstalledPlugins()
{
$arr = array();
foreach ($this->pluginInformations as $single) {
$arr = array_merge($arr, $single->getInstalledPlugins());
}
return $arr;
}
@ -47,9 +49,11 @@ class PluginInformationCollection implements InstalledPluginInformation
public function getPluginClasses()
{
$arr = array();
foreach ($this->pluginInformations as $single) {
$arr = array_merge($arr, $single->getPluginClasses());
}
return $arr;
}
}

View file

@ -13,9 +13,10 @@ use Symfony\Component\Yaml\Yaml;
class TapParser
{
const TEST_COUNTS_PATTERN = '/^\d+\.\.(\d+)/';
const TEST_LINE_PATTERN = '/^(ok|not ok)(?:\s+\d+)?(?:\s+\-)?\s*(.*?)(?:\s*#\s*(skip|todo)\s*(.*))?\s*$/i';
const TEST_YAML_START = '/^(\s*)---/';
const TEST_DIAGNOSTIC = '/^#/';
const TEST_LINE_PATTERN = '/^(ok|not ok)(?:\s+\d+)?(?:\s+\-)?\s*(.*?)(?:\s*#\s*(skip|todo)\s*(.*))?\s*$/i';
const TEST_YAML_START = '/^(\s*)---/';
const TEST_DIAGNOSTIC = '/^#/';
const TEST_COVERAGE = '/^Generating/';
/**
* @var string
@ -73,7 +74,7 @@ class TapParser
$line = $this->nextLine();
if ($line === $header) {
throw new Exception("Duplicated TAP log, please check the configration.");
throw new Exception("Duplicated TAP log, please check the configuration.");
}
while ($line !== false && ($this->testCount === false || count($this->results) < $this->testCount)) {
@ -81,7 +82,7 @@ class TapParser
$line = $this->nextLine();
}
if (count($this->results) !== $this->testCount) {
if (false !== $this->testCount && count($this->results) !== $this->testCount) {
throw new Exception(Lang::get('tap_error'));
}
@ -96,7 +97,7 @@ class TapParser
*/
protected function findTapLog()
{
// Look for the beggning of the TAP output
// Look for the beginning of the TAP output
do {
$header = $this->nextLine();
} while ($header !== false && substr($header, 0, 12) !== 'TAP version ');
@ -123,19 +124,14 @@ class TapParser
return false;
}
/** Parse a single line.
*
/**
* @param string $line
*
* @return boolean
*/
protected function parseLine($line)
protected function testLine($line)
{
if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) {
$this->testCount = intval($matches[1]);
} elseif (preg_match(self::TEST_DIAGNOSTIC, $line)) {
return;
} elseif (preg_match(self::TEST_LINE_PATTERN, $line, $matches)) {
if (preg_match(self::TEST_LINE_PATTERN, $line, $matches)) {
$this->results[] = $this->processTestLine(
$matches[1],
isset($matches[2]) ? $matches[2] : '',
@ -143,18 +139,61 @@ class TapParser
isset($matches[4]) ? $matches[4] : null
);
} elseif (preg_match(self::TEST_YAML_START, $line, $matches)) {
return true;
}
return false;
}
/**
* @param string $line
*
* @return boolean
*/
protected function yamlLine($line)
{
if (preg_match(self::TEST_YAML_START, $line, $matches)) {
$diagnostic = $this->processYamlBlock($matches[1]);
$test = array_pop($this->results);
$test = array_pop($this->results);
if (isset($test['message'], $diagnostic['message'])) {
$test['message'] .= PHP_EOL . $diagnostic['message'];
unset($diagnostic['message']);
}
$this->results[] = array_replace($test, $diagnostic);
} else {
throw new Exception(sprintf('Incorrect TAP data, line %d: %s', $this->lineNumber, $line));
return true;
}
return false;
}
/** Parse a single line.
*
* @param string $line
*
* @throws Exception
*/
protected function parseLine($line)
{
if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) {
return;
}
if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) {
$this->testCount = intval($matches[1]);
return;
}
if ($this->testLine($line)) {
return;
}
if ($this->yamlLine($line)) {
return;
}
throw new Exception(sprintf('Incorrect TAP data, line %d: %s', $this->lineNumber, $line));
}
/**
@ -196,18 +235,20 @@ class TapParser
*/
protected function processYamlBlock($indent)
{
$startLine = $this->lineNumber+1;
$endLine = $indent.'...';
$startLine = $this->lineNumber + 1;
$endLine = $indent . '...';
$yamlLines = array();
do {
$line = $this->nextLine();
if ($line === false) {
throw new Exception(Lang::get('tap_error_endless_yaml', $startLine));
} elseif ($line === $endLine) {
break;
}
$yamlLines[] = substr($line, strlen($indent));
$yamlLines[] = substr($line, strlen($indent));
} while (true);
return Yaml::parse(join("\n", $yamlLines));

View file

@ -20,6 +20,7 @@ class Codeception implements ParserInterface
protected $totalTests;
protected $totalTimeTaken;
protected $totalFailures;
protected $totalErrors;
/**
* @param Builder $phpci
@ -29,7 +30,6 @@ class Codeception implements ParserInterface
{
$this->phpci = $phpci;
$this->resultsXml = $resultsXml;
$this->totalTests = 0;
}
@ -47,6 +47,7 @@ class Codeception implements ParserInterface
$this->totalTests += (int) $testsuite['tests'];
$this->totalTimeTaken += (float) $testsuite['time'];
$this->totalFailures += (int) $testsuite['failures'];
$this->totalErrors += (int) $testsuite['errors'];
foreach ($testsuite->testcase as $testcase) {
$testresult = array(
@ -67,9 +68,9 @@ class Codeception implements ParserInterface
$testresult['feature'] = sprintf('%s::%s', $testresult['class'], $testresult['name']);
}
if (isset($testcase->failure)) {
if (isset($testcase->failure) || isset($testcase->error)) {
$testresult['pass'] = false;
$testresult['message'] = (string) $testcase->failure;
$testresult['message'] = (string)$testcase->failure . (string)$testcase->error;
} else {
$testresult['pass'] = true;
}
@ -108,6 +109,6 @@ class Codeception implements ParserInterface
*/
public function getTotalFailures()
{
return $this->totalFailures;
return $this->totalFailures + $this->totalErrors;
}
}

View file

@ -132,8 +132,9 @@ class XMPP implements \PHPCI\Plugin
*/
public function findConfigFile()
{
if (file_exists($this->phpci->buildPath . '/.sendxmpprc')) {
if (md5(file_get_contents($this->phpci->buildPath . '/.sendxmpprc')) !== md5($this->getConfigFormat())) {
if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) {
if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc'))
!== md5($this->getConfigFormat())) {
return null;
}
@ -160,7 +161,7 @@ class XMPP implements \PHPCI\Plugin
/*
* Try to build conf file
*/
$config_file = $this->phpci->buildPath . '/.sendxmpprc';
$config_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc';
if (is_null($this->findConfigFile())) {
file_put_contents($config_file, $this->getConfigFormat());
chmod($config_file, 0600);
@ -174,7 +175,7 @@ class XMPP implements \PHPCI\Plugin
$tls = ' -t';
}
$message_file = $this->phpci->buildPath . '/' . uniqid('xmppmessage');
$message_file = $this->phpci->buildPath . DIRECTORY_SEPARATOR . uniqid('xmppmessage');
if ($this->buildMessage($message_file) === false) {
return false;
}

View file

@ -31,7 +31,7 @@ class PosixProcessControl implements ProcessControlInterface
* Sends a TERMINATE or KILL signal to the process using posix_kill.
*
* @param int $pid
* @param bool $forcefully Whetehr to send TERMINATE (false) or KILL (true).
* @param bool $forcefully Whether to send TERMINATE (false) or KILL (true).
*/
public function kill($pid, $forcefully = false)
{

View file

@ -30,6 +30,11 @@ class BuildService
*/
protected $buildStore;
/**
* @var bool
*/
public $queueError = false;
/**
* @param BuildStore $buildStore
*/
@ -155,27 +160,30 @@ class BuildService
}
$config = Config::getInstance();
$settings = $config->get('phpci.worker', []);
if (!empty($settings['host']) && !empty($settings['queue'])) {
$jobData = array(
'type' => 'phpci.build',
'build_id' => $build->getId(),
);
try {
$jobData = array(
'type' => 'phpci.build',
'build_id' => $build->getId(),
);
if ($config->get('using_custom_file')) {
$jobData['config'] = $config->getArray();
if ($config->get('using_custom_file')) {
$jobData['config'] = $config->getArray();
}
$pheanstalk = new Pheanstalk($settings['host']);
$pheanstalk->useTube($settings['queue']);
$pheanstalk->put(
json_encode($jobData),
PheanstalkInterface::DEFAULT_PRIORITY,
PheanstalkInterface::DEFAULT_DELAY,
$config->get('phpci.worker.job_timeout', 600)
);
} catch (\Exception $ex) {
$this->queueError = true;
}
$pheanstalk = new Pheanstalk($settings['host']);
$pheanstalk->useTube($settings['queue']);
$pheanstalk->put(
json_encode($jobData),
PheanstalkInterface::DEFAULT_PRIORITY,
PheanstalkInterface::DEFAULT_DELAY,
$config->get('phpci.worker.job_timeout', 600)
);
}
}
}

View file

@ -0,0 +1,85 @@
<?php
/**
* BuildError base store for table: build_error
*/
namespace PHPCI\Store\Base;
use b8\Database;
use b8\Exception\HttpException;
use PHPCI\Store;
use PHPCI\Model\BuildError;
/**
* BuildError Base Store
*/
class BuildErrorStoreBase extends Store
{
protected $tableName = 'build_error';
protected $modelName = '\PHPCI\Model\BuildError';
protected $primaryKey = 'id';
/**
* Get a BuildError by primary key (Id)
*/
public function getByPrimaryKey($value, $useConnection = 'read')
{
return $this->getById($value, $useConnection);
}
/**
* Get a single BuildError by Id.
* @return null|BuildError
*/
public function getById($value, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `build_error` WHERE `id` = :id LIMIT 1';
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':id', $value);
if ($stmt->execute()) {
if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
return new BuildError($data);
}
}
return null;
}
/**
* Get multiple BuildError by BuildId.
* @return array
*/
public function getByBuildId($value, $limit = 1000, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `build_error` WHERE `build_id` = :build_id LIMIT :limit';
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':build_id', $value);
$stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT);
if ($stmt->execute()) {
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$map = function ($item) {
return new BuildError($item);
};
$rtn = array_map($map, $res);
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
} else {
return array('items' => array(), 'count' => 0);
}
}
}

View file

@ -75,25 +75,34 @@ class UserStoreBase extends Store
}
/**
* Get a single User by Name.
* @return null|User
* Get multiple User by Name.
* @return array
*/
public function getByName($value, $useConnection = 'read')
public function getByName($value, $limit = 1000, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `user` WHERE `name` = :name LIMIT 1';
$query = 'SELECT * FROM `user` WHERE `name` = :name LIMIT :limit';
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':name', $value);
$stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT);
if ($stmt->execute()) {
if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
return new User($data);
}
}
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return null;
$map = function ($item) {
return new User($item);
};
$rtn = array_map($map, $res);
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
} else {
return array('items' => array(), 'count' => 0);
}
}
}

View file

@ -0,0 +1,80 @@
<?php
/**
* BuildError store for table: build_error
*/
namespace PHPCI\Store;
use b8\Database;
use PHPCI\Model\BuildError;
use PHPCI\Store\Base\BuildErrorStoreBase;
/**
* BuildError Store
* @uses PHPCI\Store\Base\BuildErrorStoreBase
*/
class BuildErrorStore extends BuildErrorStoreBase
{
/**
* Get a list of errors for a given build, since a given time.
* @param $buildId
* @param string $since date string
* @return array
*/
public function getErrorsForBuild($buildId, $since = null)
{
$query = 'SELECT * FROM build_error
WHERE build_id = :build';
if (!is_null($since)) {
$query .= ' AND created_date > :since';
}
$query .= ' LIMIT 15000';
$stmt = Database::getConnection('read')->prepare($query);
$stmt->bindValue(':build', $buildId, \PDO::PARAM_INT);
if (!is_null($since)) {
$stmt->bindValue(':since', $since);
}
if ($stmt->execute()) {
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$map = function ($item) {
return new BuildError($item);
};
$rtn = array_map($map, $res);
return $rtn;
} else {
return array();
}
}
/**
* Gets the total number of errors for a given build.
* @param $buildId
* @param string $since date string
* @return array
*/
public function getErrorTotalForBuild($buildId)
{
$query = 'SELECT COUNT(*) AS total FROM build_error
WHERE build_id = :build';
$stmt = Database::getConnection('read')->prepare($query);
$stmt->bindValue(':build', $buildId, \PDO::PARAM_INT);
if ($stmt->execute()) {
$res = $stmt->fetch(\PDO::FETCH_ASSOC);
return $res['total'];
} else {
return array();
}
}
}

View file

@ -10,6 +10,8 @@
namespace PHPCI\Store;
use PHPCI\Store\Base\BuildMetaStoreBase;
use b8\Database;
use PHPCI\Model\BuildMeta;
/**
* BuildMeta Store
@ -17,5 +19,33 @@ use PHPCI\Store\Base\BuildMetaStoreBase;
*/
class BuildMetaStore extends BuildMetaStoreBase
{
// This class has been left blank so that you can modify it - changes in this file will not be overwritten.
/**
* Only used by an upgrade migration to move errors from build_meta to build_error
* @param $start
* @param $limit
* @return array
*/
public function getErrorsForUpgrade($limit)
{
$query = 'SELECT * FROM build_meta
WHERE meta_key IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\')
ORDER BY id ASC LIMIT :limit';
$stmt = Database::getConnection('read')->prepare($query);
$stmt->bindValue(':limit', $limit, \PDO::PARAM_INT);
if ($stmt->execute()) {
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$map = function ($item) {
return new BuildMeta($item);
};
$rtn = array_map($map, $res);
return $rtn;
} else {
return array();
}
}
}

View file

@ -165,6 +165,7 @@ class BuildStore extends BuildStoreBase
$stmt->bindValue(':projectId', (int)$projectId, \PDO::PARAM_INT);
$stmt->bindValue(':buildId', (int)$buildId, \PDO::PARAM_INT);
$stmt->bindValue(':numResults', (int)$numResults, \PDO::PARAM_INT);
if (!is_null($branch)) {
$stmt->bindValue(':branch', $branch, \PDO::PARAM_STR);
}
@ -183,7 +184,6 @@ class BuildStore extends BuildStoreBase
} else {
return $rtn;
}
} else {
return null;
}

View file

@ -66,6 +66,41 @@ class ProjectStore extends ProjectStoreBase
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
} else {
return array('items' => array(), 'count' => 0);
}
}
/**
* Get multiple Project by GroupId.
* @param int $value
* @param int $limit
* @param string $useConnection
* @return array
* @throws \Exception
*/
public function getByGroupId($value, $limit = 1000, $useConnection = 'read')
{
if (is_null($value)) {
throw new \Exception('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `project` WHERE `group_id` = :group_id ORDER BY title LIMIT :limit';
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':group_id', $value);
$stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT);
if ($stmt->execute()) {
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$map = function ($item) {
return new Project($item);
};
$rtn = array_map($map, $res);
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
} else {
return array('items' => array(), 'count' => 0);

View file

@ -0,0 +1,37 @@
<?php
use PHPCI\Helper\Lang;
$linkTemplate = $build->getFileLinkTemplate();
/** @var \PHPCI\Model\BuildError $error */
foreach ($errors as $error):
$link = str_replace('{FILE}', $error->getFile(), $linkTemplate);
$link = str_replace('{LINE}', $error->getLineStart(), $link);
$link = str_replace('{LINE_END}', $error->getLineEnd(), $link);
?>
<tr class="bg-<?php print $error->getSeverityClass(); ?>">
<td>
<span class="label label-<?php print $error->getSeverityClass(); ?>">
<?php print Lang::get($error->getSeverityString()); ?>
</span>
</td>
<td><?php print Lang::get($error->getPlugin()); ?></td>
<td><a href="<?php print $link; ?>" target="_blank"><?php print $error->getFile(); ?></a></td>
<td>
<a href="<?php print $link; ?>" target="_blank">
<?php
if ($error->getLineStart() == $error->getLineEnd() || !$error->getLineEnd()) {
print $error->getLineStart();
} else {
print $error->getLineStart() . ' - ' . $error->getLineEnd();
}
?>
</a>
</td>
<td><?php print $error->getMessage(); ?></td>
</tr>
<?php endforeach; ?>

View file

@ -1,36 +1,161 @@
<?php use PHPCI\Helper\Lang; ?>
<div class="build-info-panel box box-solid">
<div class="box-header">
<h1 class="box-title">
<?php Lang::out('committed_by_x', $build->getCommitterEmail()); ?>
<label class="pull-right label"></label>
</h1>
</div>
<div class="box-body">
<img class="pull-left" src="//www.gravatar.com/avatar/<?php print md5($build->getCommitterEmail()); ?>?d=mm">
<div id="build-info">
<?php if ($build->getCommitMessage()): ?>
<div class="commit-message">
<?php print $build->getCommitMessage(); ?>
</div>
<?php endif; ?>
<?php Lang::out('branch_x', $build->getBranch()); ?>
<?php if ($build->getCommitId() != 'Manual'): ?>
<br><?php Lang::out('commit_id_x', $build->getCommitId()); ?>
<?php endif; ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="status"></div>
<div id="plugins" class="row"></div>
<div class="col-sm-4">
<div class="box">
<div class="box-header">
<h3 class="box-title">
Build Details
</h3>
</div>
<div class="box-body no-padding">
<table class="table">
<tr>
<th>Project</th>
<td style="text-align: right">
<a href="<?php print PHPCI_URL . 'project/view/' . $build->getProjectId(); ?>">
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?>"></i>
<?php print $build->getProject()->getTitle(); ?>
</a>
</td>
</tr>
<tr>
<th>Branch</th>
<td style="text-align: right">
<a target="_blank" href="<?php print $build->getBranchLink(); ?>">
<span class="label label-default"><?php print $build->getBranch(); ?></span>
</a>
</td>
</tr>
<tr>
<th>Duration</th>
<td style="text-align: right" class="build-duration duration" data-duration="<?php print $build->getDuration(); ?>">
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="box">
<div class="box-header">
<h3 class="box-title">
Commit Details
</h3>
</div>
<div class="box-body no-padding">
<table class="table">
<tr>
<th>Commit</th>
<td style="text-align: right">
<a target="_blank" href="<?php print $build->getCommitLink(); ?>">
<?php print substr($build->getCommitId(), 0, 7); ?>
</a>
</td>
</tr>
<tr>
<th>Committer</th>
<td style="text-align: right">
<?php print $build->getCommitterEmail(); ?>
</td>
</tr>
<tr>
<td colspan="2">
<?php print $build->getCommitMessage(); ?>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="box">
<div class="box-header">
<h3 class="box-title">
Timing
</h3>
</div>
<div class="box-body no-padding">
<table class="table">
<tr>
<th>Created</th>
<td style="text-align: right" class="build-created datetime" data-date="<?php print $build->getCreated() ? $build->getCreated()->format('Y-m-d H:i:s') : ''; ?>">
</td>
</tr>
<tr>
<th>Started</th>
<td style="text-align: right" class="build-started datetime" data-date="<?php print $build->getStarted() ? $build->getStarted()->format('Y-m-d H:i:s') : ''; ?>">
</td>
</tr>
<tr>
<th>Finished</th>
<td style="text-align: right" class="build-finished datetime" data-date="<?php print $build->getFinished() ? $build->getFinished()->format('Y-m-d H:i:s') : ''; ?>">
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#log" data-toggle="tab"><i class="fa fa-cogs"></i> <?php print Lang::get('build_log'); ?></a>
</li>
<li class="">
<a href="#errors" data-toggle="tab">
<i class="fa fa-exclamation-triangle"></i> <?php print Lang::get('errors'); ?>
<?php if ($data['errors'] == 0): ?>
<span class="errors-label label label-danger" style="display: none">0</span>
<?php else: ?>
<span class="errors-label label label-danger"><?php print $data['errors']; ?></span>
<?php endif; ?>
</a>
</li>
<li class="">
<a href="#information" data-toggle="tab"><i class="fa fa-info-circle"></i> <?php print Lang::get('information'); ?></a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="log">
<pre style="height: 400px; overflow-y: auto;"><?php print $data['log']; ?></pre>
</div>
<div class="tab-pane" id="errors">
<table class="errors-table table table-hover dataTable">
<thead>
<tr>
<th>Severity</th>
<th>Plugin</th>
<th>File</th>
<th data-orderable="false">Lines</th>
<th data-orderable="false">Message</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane" id="information">
<div id="plugins" class="row"></div>
</div>
</div>
</div>
@ -38,14 +163,13 @@
<script>
var ActiveBuild = new Build(<?php print $build->getId() ?>);
ActiveBuild.buildData = <?php print $data; ?>;
ActiveBuild.fileLinkTemplate = <?php print json_encode($build->getFileLinkTemplate()); ?>;
ActiveBuild.setupBuild(<?php print json_encode($data); ?>, <?php print json_encode($build->getFileLinkTemplate()); ?>);
</script>
<?php
foreach ($plugins as $plugin) {
print '<script src="'.PHPCI_URL.'assets/js/build-plugins/' . $plugin . '"></script>';
print '<script src="'.PHPCI_URL.'assets/js/build-plugins/' . $plugin . '"></script>' . PHP_EOL;
}
?>
@ -59,47 +183,7 @@ foreach ($plugins as $plugin) {
"<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>", "Build"
).onCloseConfirmed = function () {window.location = '/'};
});
$(window).on('build-updated', function(data) {
updateBuildStatus(data.queryData.status);
});
updateBuildStatus(<?php print $build->getStatus(); ?>);
});
function updateBuildStatus(status) {
switch (status) {
case 0:
$('.build-info-panel')
.removeClass('bg-yellow')
.removeClass('bg-green')
.removeClass('bg-red')
.addClass('bg-blue');
break;
case 1:
$('.build-info-panel')
.removeClass('bg-green')
.removeClass('bg-red')
.removeClass('bg-blue')
.addClass('bg-yellow');
break;
case 2:
$('.build-info-panel')
.removeClass('bg-yellow')
.removeClass('bg-red')
.removeClass('bg-blue')
.addClass('bg-green');
break;
case 3:
$('.build-info-panel')
.removeClass('bg-yellow')
.removeClass('bg-green')
.removeClass('bg-blue')
.addClass('bg-red');
break;
}
}
</script>

View file

@ -41,7 +41,9 @@ switch($build->getStatus())
<td><a href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
<td><?php print $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
<td><a href="<?php echo PHPCI_URL ?>project/view/<?php print $build->getProjectId(); ?>">
<?php
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?>"></i>
<?php
if (is_object($build->getProject())) {
print htmlspecialchars($build->getProject()->getTitle());
} else {

View file

@ -9,7 +9,7 @@
<?php Lang::out('edit_project'); ?>
</a>
<a class="btn btn-danger" href="javascript:confirmDelete('<?php print PHPCI_URL . 'project/delete/' . $project->getId(); ?>', '<?php print Lang::out('project'); ?>', true">
<a class="btn btn-danger" href="javascript:confirmDelete('<?php print PHPCI_URL . 'project/delete/' . $project->getId(); ?>', '<?php print Lang::out('project'); ?>', true)">
<?php Lang::out('delete_project'); ?>
</a>

View file

@ -7,9 +7,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="<?php echo PHPCI_URL ?>assets/css/bootstrap.min.css">
<script src="//code.jquery.com/jquery-1.8.1.min.js"></script>
<script src="<?php echo PHPCI_URL ?>assets/js/bootstrap.min.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<style type="text/css">
@ -56,7 +56,7 @@
}
#logo {
background: transparent url('https://www.block8.co.uk/assets/images/b8-phpci-logo-muted.png') no-repeat top left;
background: transparent url('https://block8.digital/assets/images/b8-phpci-logo-muted.png') no-repeat top left;
background-size: 130px 46px;
display: inline-block;
height: 46px;
@ -67,9 +67,17 @@
bottom: 50px;
right: 50px;
}
@media(max-width:767px) {
#logo {
position: inherit;
margin: 0 auto;
margin-top: 50px;
}
}
#logo:hover {
background-image: url('https://www.block8.co.uk/assets/images/b8-phpci-logo.png');
background-image: url('https://block8.digital/assets/images/b8-phpci-logo.png');
}
#phpci-logo img {
@ -81,14 +89,14 @@
<body>
<div class="container">
<div class="row" style="margin-top: 10%; text-align: center">
<a id="phpci-logo" href="http://www.phptesting.org">
<a id="phpci-logo" href="https://www.phptesting.org">
<img src="<?php print PHPCI_URL; ?>/assets/img/logo-large.png">
</a>
<div class="" id="login-box">
<?php print $content; ?>
</div>
<a id="logo" href="https://www.block8.co.uk">Block 8 - Manchester Web Development Specialists</a>
<a target="_blank" id="logo" href="https://block8.digital">Block 8 - Digital Development Experts</a>
</div>
</div>
</body>

View file

@ -5,18 +5,16 @@
</p>
<?php else: ?>
<?php if (empty($error)): ?>
<div class="panel panel-success" style="margin-bottom: 0">
<div class="box-header">
<div class="" style="margin-bottom: 15px;">
<?php Lang::out('reset_header'); ?>
</div>
<?php else: ?>
<div class="panel panel-danger" style="margin-bottom: 0">
<div class="box-header">
<div class="alert alert-danger">
<?php print $error; ?>
</div>
<?php endif; ?>
<div class="box-body">
<div class="">
<form class="form" action="<?php print PHPCI_URL; ?>session/forgot-password" method="POST">
<div class="form-group">
<label for="email"><?php Lang::out('reset_email_address'); ?></label>
@ -28,7 +26,6 @@
</div>
</form>
</div>
</div>
<?php endif; ?>

View file

@ -1,6 +1,6 @@
<?php use PHPCI\Helper\Lang; ?>
<?php if (empty($error)): ?>
<div class="panel panel-success" style="margin-bottom: 0">
<div class="box-header">
<?php Lang::out('reset_enter_password'); ?>
</div>
@ -17,7 +17,6 @@
</div>
</form>
</div>
</div>
<?php else: ?>
<div class="alert alert-danger" style="margin-bottom: 0">
<?php print $error; ?>

View file

@ -40,7 +40,7 @@
<td><?php print $status; ?></td>
<td>
<?php if($this->User()->getIsAdmin()): ?>
<div class="btn-group">
<div class="btn-group pull-right">
<a class="btn btn-default btn-small" href="<?php echo PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>

View file

@ -9,14 +9,14 @@
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="//cdnjs.cloudflare.com/ajax/libs/ionicons/1.5.2/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/ansi-colors.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE-skins.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE-custom.css" rel="stylesheet" type="text/css" />
<script>
@ -35,27 +35,28 @@
<script src="<?php print PHPCI_URL; ?>assets/js/sprintf.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/moment.min.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/phpci.js" type="text/javascript"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="skin-blue">
<body class="phpci <?php print !empty($skin) ? 'skin-' . $skin : 'skin-blue'; ?>">
<div class="wrapper row-offcanvas row-offcanvas-left">
<!-- header logo: style can be found in header.less -->
<header class="header">
<header class="main-header">
<a href="<?php print PHPCI_URL; ?>" class="logo">PHPCI</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only"><?php Lang::out('toggle_navigation'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="navbar-right">
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown messages-menu phpci-pending">
@ -118,9 +119,8 @@
</div>
</nav>
</header>
<div class="wrapper row-offcanvas row-offcanvas-left">
<!-- Left side column. contains the logo and sidebar -->
<aside class="left-side sidebar-offcanvas">
<aside class="main-sidebar sidebar-offcanvas">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
@ -130,7 +130,7 @@
<div class="pull-left image">
<img src="https://www.gravatar.com/avatar/<?php print md5($this->User()->getEmail()); ?>?d=mm" class="img-circle" alt="<?php print $this->User()->getName(); ?>" />
</div>
<div class="info">
<div class="pull-left info">
<p><?php Lang::out('hello_name', $this->User()->getName()); ?></p>
</div>
</div>
@ -143,7 +143,7 @@
<i class="fa fa-dashboard"></i> <span><?php Lang::out('dashboard'); ?></span>
</a>
</li>
<?php if ($this->User()->getIsAdmin()): ?>
<li class="treeview">
<a href="#">
@ -262,7 +262,7 @@
<li class="archive<?php print (array_key_exists('archived', $_GET) ? ' active' : ''); ?>">
<a href="<?php print PHPCI_URL . (array_key_exists('archived', $_GET) ? '' : '?archived'); ?>">
<i class="fa fa-archive"></i> <span><?php Lang::out('archived'); ?></span>
<i class="fa fa-archive"></i> <span><?php Lang::out('archived_menu'); ?></span>
</a>
</li>
@ -272,9 +272,13 @@
</aside>
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="right-side">
<aside class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="pull-right">
<?php print (!empty($actions) ? $actions : ''); ?>
</div>
<h1>
<?php print !empty($title) ? $title : 'PHPCI'; ?>
@ -282,25 +286,37 @@
<small><?php print $subtitle; ?></small>
<?php endif; ?>
</h1>
</section>
<!-- Main content -->
<section class="content">
<?php
if (!empty($_SESSION['global_error'])) {
$message = $_SESSION['global_error'];
unset($_SESSION['global_error']);
print '<div class="alert alert-danger">' . $message . '</div>';
}
?>
<?php print $content; ?>
</section><!-- /.content -->
</aside><!-- /.right-side -->
</aside><!-- /.content-wrapper -->
</div><!-- ./wrapper -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/plugins/datepicker/locales/bootstrap-datepicker.<?php print Lang::getLanguage(); ?>.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/AdminLTE/app.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/plugins/chartjs/Chart.min.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
<?php if (file_exists(PHPCI_DIR . 'assets/plugins/datepicker/locales/bootstrap-datepicker.' . Lang::getLanguage() . '.js')) :?>
<script src="<?php print PHPCI_URL; ?>assets/plugins/datepicker/locales/bootstrap-datepicker.<?php print Lang::getLanguage(); ?>.js" type="text/javascript"></script>
<?php endif; ?>
<script src="<?php print PHPCI_URL; ?>assets/js/AdminLTE/app.min.js" type="text/javascript"></script>
</body>
</html>

View file

@ -11,7 +11,13 @@ PHPCI is a free and open source (BSD License) continuous integration tool specif
We have a chat room for discussing PHPCI, you can access it here: [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/Block8/PHPCI?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
##What it does:
**Support the development of PHPCI**
We [now accept donations](https://www.phptesting.org/support) to directly support the ongoing development of PHPCI. There is of course no obligation to donate, nor any commitment if you do.
[Donate](https://www.phptesting.org/support)
## What it does:
* 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.
@ -19,17 +25,17 @@ We have a chat room for discussing PHPCI, you can access it here: [![Gitter](htt
* You can mark directories for the plugins to ignore.
* You can mark certain plugins as being allowed to fail (but still run.)
##What it doesn't do (yet):
* Virtualised testing. *(In progress)*
* Multiple PHP-version tests. *(In progress)*
### What it doesn't do (yet):
* Virtualised testing.
* Multiple PHP-version tests.
* Install PEAR or PECL extensions.
* [Deployments](http://phpdeployment.org)
* Deployments - We strongly recommend using [Deployer](http://phpdeployment.org)
## Getting Started:
We've got documentation on our website on [installing PHPCI](https://www.phptesting.org/install-phpci) and [adding support for PHPCI to your projects](https://www.phptesting.org/wiki/Adding-PHPCI-Support-to-Your-Projects).
##Contributing
Contributions from others would be very much appreciated! Please read our [guide to contributing](https://www.phptesting.org/wiki/Contributing-to-PHPCI) for more information on how to get involved.
## Contributing
Contributions from others would be very much appreciated! Please read our [guide to contributing](https://github.com/Block8/PHPCI/blob/master/.github/CONTRIBUTING.md) for more information on how to get involved.
##Questions?
Your best place to go is the [mailing list](https://groups.google.com/forum/#!forum/php-ci), if you're already a member of the mailing list, you can simply email php-ci@googlegroups.com.
## Questions?
Your best place to go is the [mailing list](https://groups.google.com/forum/#!forum/php-ci). If you're already a member of the mailing list, you can simply email php-ci@googlegroups.com.

View file

@ -78,7 +78,7 @@ class CreateBuildCommandTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \InvalidArgumentException
*/
public function testExecuteWithUnknowProjectId()
public function testExecuteWithUnknownProjectId()
{
$commandTester = $this->getCommandTester();
$commandTester->execute(array('projectId' => 2));

View file

@ -107,6 +107,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
'--admin-name' => 'phpci4',
'--admin-pass' => 'phpci5',
'--url' => 'http://test.phpci.org',
'--queue-disabled' => null,
);
if (!is_null($exclude)) {
@ -175,7 +176,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('testedvalue', $this->config['b8']['database']['name']);
}
public function testDatabaseUserameConfig()
public function testDatabaseUserConfig()
{
$dialog = $this->getDialogHelperMock();
@ -243,7 +244,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('test@phpci.com', $this->admin['mail']);
}
public function testAdminUserameConfig()
public function testAdminNameConfig()
{
$dialog = $this->getDialogHelperMock();

View file

@ -236,11 +236,11 @@ class EmailTest extends \PHPUnit_Framework_TestCase
/**
* @covers PHPUnit::execute
*/
public function testExecute_UniqueRecipientsWithCommiter()
public function testExecute_UniqueRecipientsWithCommitter()
{
$this->loadEmailPluginWithOptions(
array(
'commiter' => true,
'committer' => true,
'addresses' => array('test-receiver@example.com', 'committer@test.com')
)
);

View file

@ -15,7 +15,7 @@ use PHPCI\Plugin\Util\FilesPluginInformation;
class FilesPluginInformationTest extends \PHPUnit_Framework_TestCase
{
public function testGetInstalledPlugins_returnsObjectes()
public function testGetInstalledPlugins_returnsObjects()
{
$pluginDirPath = realpath(__DIR__ . "/../../../../PHPCI/Plugin/");
$test = FilesPluginInformation::newFromDir($pluginDirPath);

View file

@ -23,6 +23,28 @@ ok 1 - SomeTest::testAnother
not ok
1..2
Trailing garbage !
TAP;
$parser = new TapParser($content);
$result = $parser->parse();
$this->assertEquals(array(
array('pass' => true, 'severity' => 'success', 'message' => 'SomeTest::testAnother'),
array('pass' => false, 'severity' => 'fail', 'message' => ''),
), $result);
$this->assertEquals(1, $parser->getTotalFailures());
}
public function testSimple2()
{
$content = <<<TAP
Leading garbage !
TAP version 13
ok 1 - SomeTest::testAnother
not ok
1..2
TAP;
$parser = new TapParser($content);
$result = $parser->parse();
@ -48,6 +70,20 @@ TAP;
$parser->parse();
}
public function testTapCoverage()
{
$content = <<<TAP
TAP version 13
Generating code coverage report in HTML format ... done
TAP;
$parser = new TapParser($content);
$result = $parser->parse();
$this->assertEquals(array(), $result);
}
/**
* @expectedException \Exception
* @expectedExceptionMessageRegExp /Duplicated TAP/

View file

@ -65,7 +65,7 @@ if (file_exists($configFile)) {
/**
* Allow to modify PHPCI configuration without modify versioned code.
* Dameons should be killed to apply changes in the file.
* Daemons should be killed to apply changes in the file.
*
* @ticket 781
*/

Some files were not shown because too many files have changed in this diff Show more