Improved docs

This commit is contained in:
Dmitry Khomutov 2016-07-19 15:12:28 +06:00
parent ae22073ff0
commit 320a249153
49 changed files with 454 additions and 193 deletions

View file

@ -1,4 +1,9 @@
#### Getting Started
PHPCI documentation
-------------------
Getting Started
===============
* [Installing PHPCI](installing.md)
* [Adding a Virtual Host](virtual_host.md)
* [Run Builds Using a Worker](workers/worker.md)
@ -9,16 +14,20 @@
* [Updating PHPCI](updating.md)
* [Configuring PHPCI](configuring.md)
#### Using PHPCI
Using PHPCI
===========
* Automatically building commits pushed to
* [Github](sources/github.md)
* [Bitbucket](sources/bitbucket.md)
* [GitLab](sources/gitlab.md)
* [Git](sources/git.md)
* [Github](sources/github.md)
* [Bitbucket](sources/bitbucket.md)
* [GitLab](sources/gitlab.md)
* [Git](sources/git.md)
* [Injecting variables into messages](interpolation.md)
* [Project Status Images and Status Page](status.md)
#### Plugins
Plugins
=======
* [Atoum](plugins/atoum.md) - `atoum`
* [Behat](plugins/behat.md) - `behat`
* [Campfire](plugins/campfire.md) - `campfire`

View file

@ -1,3 +1,6 @@
Adding PHPCI Support to Your Projects
-------------------------------------
Similar to Travis CI, to support PHPCI in your project, you simply need to add a `phpci.yml` file to the root of your repository. The file should look something like this:
```yml

View file

@ -1,3 +1,6 @@
Configuring PHPCI
-----------------
The PHPCI configuration on the server is automatically generated into the `phpci/PHPCI/config.yml` file during installation. One might need to also edit the file manually.
For example, to [disable authentication](https://www.phptesting.org/news/phpci-1-5-released), one could log into phpci and go into the settings to disable it. But if you have already set up a username/password pair and have forgotten the password, and if the server is on a local network, and it's not sending the `forgot password` email, then editing the config file manually would be handy. To do so, just edit the `phpci` section in the config file (which is in [yaml format](https://en.wikipedia.org/wiki/YAML)), and add

View file

@ -1,33 +1,35 @@
## What you'll need:
Installing PHPCI
----------------
* PHP 5.3.6 or above
* A web server (we recommend [nginx](http://nginx.org))
What you'll need
================
* PHP 5.4.0 or above
* A web server (Nginx or Apache)
* [Composer](https://getcomposer.org/download/)
* [Git](http://git-scm.com/downloads)
* A MySQL server to connect to. This doesn't have to be on the same server as PHPCI.
* The following functions need to be enabled: `exec()`, `shell_exec()` and `proc_open()`
* A MySQL server to connect to.
* The following functions need to be enabled: `exec()`, `shell_exec()` and `proc_open()` in php.ini.
* PHP must have OpenSSL support enabled.
## Installing PHPCI from Composer:
Installing PHPCI from Composer
==============================
* Go to the directory in which you want to install PHPCI, for example: `/var/www`
* Download Composer if you haven't already: `curl -sS https://getcomposer.org/installer | php`
* Download PHPCI: `./composer.phar create-project block8/phpci phpci --keep-vcs --no-dev`
* Go to the newly created PHPCI directory, and install Composer dependencies: `cd phpci && ../composer.phar install`
* Run the PHPCI installer: `./console phpci:install`
* [Add a virtual host to your web server](/Block8/PHPCI/wiki/Add-a-Virtual-Host), pointing to the `public` directory within your new PHPCI directory. You'll need to set up rewrite rules to point all non-existent requests to PHPCI.
* [Set up the PHPCI Worker](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Worker), or you can run builds using the [PHPCI daemon](/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) or [a cron-job](/Block8/PHPCI/wiki/Run-Builds-Using-Cron) to run PHPCI builds.
* [Add a virtual host to your web server](virtual_host.md), pointing to the `public` directory within your new PHPCI directory. You'll need to set up rewrite rules to point all non-existent requests to PHPCI.
* [Set up the PHPCI Worker](workers/worker.md), or you can run builds using the [PHPCI daemon](workers/daemon.md) or [a cron-job](workers/cron.md) to run PHPCI builds.
## Installing PHPCI Manually:
Installing PHPCI Manually
=========================
* Go to the directory in which you want to install PHPCI, for example: `/var/www`
* [Download PHPCI](https://github.com/Block8/PHPCI/releases/latest) and unzip it.
* Go to the PHPCI directory: `cd /var/www/phpci`
* Install dependencies using Composer: `composer install`
* Install PHPCI itself: `php ./console phpci:install`
* [Add a virtual host to your web server](/Block8/PHPCI/wiki/Add-a-Virtual-Host), pointing to the `public` directory within your new PHPCI directory. You'll need to set up rewrite rules to point all non-existent requests to PHPCI.
* [Set up the PHPCI Worker](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Worker), or you can run builds using the [PHPCI daemon](/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) or [a cron-job](/Block8/PHPCI/wiki/Run-Builds-Using-Cron) to run PHPCI builds.
### Extended Guides
- [Installing PHPCI on Mac OSX Mavericks](https://github.com/Block8/PHPCI/wiki/Vanilla-Mac-Mavericks-Server-Installation-Guide)
- [Installing PHPCI on Mac OSX Yosemite](https://github.com/Block8/PHPCI/wiki/Vanilla-Installation-on-OS-X-10.10-Yosemite-with-OS-X-Server-4)
* [Add a virtual host to your web server](virtual_host.md), pointing to the `public` directory within your new PHPCI directory. You'll need to set up rewrite rules to point all non-existent requests to PHPCI.
* [Set up the PHPCI Worker](workers/worker.md), or you can run builds using the [PHPCI daemon](workers/daemon.md) or [a cron-job](workers/cron.md) to run PHPCI builds.

View file

@ -1,10 +1,12 @@
Injecting variables into messages
---------------------------------
Most strings used in the build configuration can have variables related to the build inserted into them with the following syntax:
"My important message is about %SOMETHING%"
Where something can be one of the following:
* **COMMIT** - The commit hash
* **SHORT_COMMIT** - The shortened version of the commit hash
* **COMMIT_EMAIL** - The email address of the committer

View file

@ -1,7 +1,14 @@
# Basics
Setting up Logging
------------------
Basics
======
The phpci codebase makes use of the [psr3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) logging standard. By default we use [Monolog](https://github.com/Seldaek/monolog) to handle the actual work implementing this standard.
# How to Setup Logging (For people running a PHPCI instance)
How to Setup Logging (For people running a PHPCI instance)
==========================================================
The only step required to activate logging is to create a file in the root directory called loggerconfig.php with content like the following:
```php
@ -19,9 +26,11 @@ This file should return an array of key value pairs. Each key tells phpci which
Once this file is created all plugins and core phpci functionality should start writing to the configured handlers.
# How to write to the Log (For people creating a new plugin)
How to write to the Log (For people creating a new plugin)
==========================================================
### Using the plugin constructor to get a logger directly
## Using the plugin constructor to get a logger directly
For plugin creators the simplest way to get hold of an error logger is to add a parameter to the constructor and typehint on 'Psr\Log\LoggerInterface'. The code that loads your plugin will automatically inject the logger when it sees this. For example:
```php
class ExampleLoggingPlugin implements \PHPCI\Plugin
@ -40,7 +49,7 @@ class ExampleLoggingPlugin implements \PHPCI\Plugin
}
```
## Using convenience methods provided by the Builder
### Using convenience methods provided by the Builder
Your plugin can also call a couple of messages on the Builder object:
logSuccess()

View file

@ -1,6 +1,11 @@
Plugin Atoum
------------
Allows you to run [Atoum](https://github.com/atoum/atoum) unit tests.
## Configuration
Configuration
=============
### Options
- **args** [string, optional] - Allows you to pass command line arguments to Atoum.
@ -8,7 +13,7 @@ Allows you to run [Atoum](https://github.com/atoum/atoum) unit tests.
- **directory** [string, optional] - Path in which to run Atom (defaults to the build root).
- **executable** [string, optional] - Allows you to provide a path to the Atom binary (defaults to PHPCI root, vendor/bin, or a system-provided Atom binary).
### Example
### Examples
```yml
test:
atoum:

View file

@ -1,11 +1,17 @@
Plugin Behat
------------
A very simple plugin for running [Behat](http://behat.org/) BDD tests.
## Configuration
Configuration
=============
### Options
- **executable** [string, optional] - Allows you to provide a path to the Behat binary (defaults to PHPCI root, vendor/bin, or a system-provided Behat binary).
- **features** [string, optional] - Provide a list of Behat features to run.
### Example
### Examples
```yml
test:
behat:

View file

@ -1,13 +1,19 @@
Plugin Campfire
---------------
This plugin joins a [Campfire](https://campfirenow.com/) room and sends a user-defined message, for example a "Build Succeeded" message.
## Configuration
Configuration
=============
### Options
- **authToken** [string, required] - Your Campfire user authentication token.
- **message** [string, required] - The message to send to the room.
- **roomId** [string, required] - Your Campfire room ID number.
- **url** [string, required] - Your Campfire chat room URL.
### Example
### Examples
```yml
build_settings:
campfire:

View file

@ -1,10 +1,16 @@
Plugin Clean build
------------------
Works through a list of files to remove from your build. Useful when used in combination with Copy Build or Package Build.
### Configuration Options:
Configuration
=============
### Options
* **remove** - Required - An array of files and / or directories to remove.
### Example Configuration:
### Examples
```yml
complete:

View file

@ -1,6 +1,12 @@
Plugin Codeception
------------------
A simple plugin that allows you to run [Codeception](http://codeception.com/) tests.
### Configuration Options:
Configuration
=============
### Options
* **config** - Required - Can be either a single string pointing to a Codeception configuration file, or an array of configuration file paths. By default this is called `codeception.yml` and will be in the root of your project.
@ -8,7 +14,7 @@ A simple plugin that allows you to run [Codeception](http://codeception.com/) te
* **path** - Optional - The path from the root of your project to the root of the codeception _output directory
##### Default values
#### Default values
- config
- `codeception.yml` if it exists in the root of the project
@ -21,7 +27,9 @@ A simple plugin that allows you to run [Codeception](http://codeception.com/) te
- path
- `tests/_output/`
##### Example on running codeception with default settings (when tests are in tests/ directory):
### Examples
#### Example on running codeception with default settings (when tests are in tests/ directory):
```
codeception:
@ -29,7 +37,7 @@ A simple plugin that allows you to run [Codeception](http://codeception.com/) te
path: "tests/"
```
##### Example usage against the Yii2 framework
#### Example usage against the Yii2 framework
```
codeception:

View file

@ -1,12 +1,22 @@
Plugin Composer
---------------
Allows you to run Composer within your build, to install dependencies prior to testing. Best run as a "setup" stage plugin.
## Configuration
Configuration
=============
### Options
* **directory** [optional, string] - Directory within which you want Composer to run (default: build root)
* **action** [optional, string, update|install] - Action you wish Composer to run (default: 'install')
* **prefer_dist** [optional, bool, true|false] - whether Composer should run with the `--prefer-dist` flag (default: false)
* **prefer_source** [optional, bool, true|false] - whether Composer should run with the `--prefer-source` flag (default: false)
* **no_dev** [optional, bool, true|false] - whether Composer should run with the `--no-dev` flag (default: false)
* **ignore_platform_reqs** [optional, bool, true|false] - whether Composer should run with the `--ignore-platform-reqs` flag (default: false)
### Examples
### Example
```yml
setup:
composer:
@ -15,7 +25,8 @@ setup:
prefer_dist: true
```
## Warning
Warning
=======
If you are using a Composer private repository like Satis, with HTTP authentication, you must check your username and password inside the ```auth.json``` file. PHPCI uses the ```--no-interaction``` flag, so it will not warn if you must provide that info.

View file

@ -1,6 +1,12 @@
Plugin Copy Build
-----------------
Copies all files from your build, with the exception of those in the "ignore" build settings property, to a directory of your choosing.
### Configuration Options:
Configuration
=============
### Options
* **directory** - Required - The directory to which you want to copy the build.
* **respect_ignore** - Optional - Whether to respect the global "ignore" setting when copying files. Default is false.

View file

@ -1,12 +1,19 @@
Plugin Deployer
---------------
Triggers a deployment of the project to run via [Deployer](http://phpdeployment.org)
**Configuration Options:**
Configuration
=============
### Options
* **webhook_url** [required, string] - The URL to your Deployer WebHook
* **reason** [optional, string] - Your deployment message. Default - PHPCI Build #%BUILD% - %COMMIT_MESSAGE%
* **update_only** [optional, bool, true|false] - Whether the deployment should only be run if the currently deployed branches matches the one being built. Default - true
### Example
### Examples
```yaml
success:
deployer:

View file

@ -1,6 +1,12 @@
Plugin Email
------------
Sends a build status email.
### Configuration Options:
Configuration
=============
### Options
* **committer** - Whether or not to send the email to the committer that prompted this build.
* **addresses** - A list of addresses to send to.
@ -11,7 +17,8 @@ Sends a build status email.
**Note:** _This plugin will only work if you configured email settings during installation or configured them later in Admin Options > Settings > Email Settings_
### Configuration Example
### Examples
See [Adding PHPCI Support to Your Projects](https://www.phptesting.org/wiki/Adding-PHPCI-Support-to-Your-Projects) for more information about how to configure plugins.
Send an email to the committer as well as one@exameple.com if a build fails:

View file

@ -1,6 +1,12 @@
Plugin Env
----------
Sets environment variables on the PHPCI server for the build.
### Sample Configuration:
Configuration
=============
### Examples:
```yml
setup:

View file

@ -1,13 +1,20 @@
Plugin Grunt
------------
This plugin runs [Grunt](http://gruntjs.com/) tasks.
## Configuration
Configuration
=============
### Options
- **directory** [string, optional] - The directory in which to run Grunt (defaults to build root.)
- **grunt** [string, optional] - Allows you to provide a path to Grunt (defaults to PHPCI root, vendor/bin, or a system-provided Grunt).
- **gruntfile** [string, optional] - Gruntfile to run (defaults to `Gruntfile.js`).
- **task** [string, optional] - The Grunt task to run.
### Example
```yml
test:
grunt:

View file

@ -1,6 +1,12 @@
Plugin Hipchat Notify
---------------------
This plugin joins a [HipChat](https://www.hipchat.com/) room and sends a user-defined message, for example a "Build Succeeded" message.
**Configuration Options:**
Configuration
=============
### Options
| Field | Required? | Description |
|-------|-----------|-------------|
@ -15,7 +21,8 @@ Message can be formatted via HTML. Example:
<b>%PROJECT_TITLE%</b> - build <a href="%BUILD_URI%">%BUILD%</a> failed!
```
Configuration example:
### Examples
```yaml
hipchat_notify:
authToken: 123

View file

@ -1,10 +1,16 @@
Plugin IRC
----------
Connects to an IRC server and sends a defined message.
### Configuration Options:
Configuration
=============
### Options
* **message** - Required - The message to send.
### Build Settings
#### Build Settings
* **irc** - All child properties are required
* **server** - IRC server to connect to.

View file

@ -1,12 +1,19 @@
Plugin Lint
-----------
This plugin runs PHP's built in Lint (syntax / error check) functionality.
## Configuration
Configuration
=============
### Options
- **directory** [string, optional] - A single path in which you wish to lint files.
- **directories** [array, optional] - An array of paths in which you wish to lint files. This overrides `directory`.
- **recursive** [bool, optional] - Whether or not you want to recursively check sub-directories of the above (defaults to true).
### Example
### Examples
```yml
test:
lint:

View file

@ -1,6 +1,12 @@
Plugin MySQL
------------
Connects to a given MySQL server and runs a selection of queries.
### Example Configuration:
Configuration
=============
### Examples
```yaml
build_settings:

View file

@ -1,6 +1,12 @@
Plugin Package Build
--------------------
Builds a tar or zip archive of your build and places it in a directory of your choosing.
### Configuration Options:
Configuration
=============
### Options
* **directory** - Required - Directory in which to put the package file.
* **filename** - Required - File name for the package.

View file

@ -1,5 +1,11 @@
Plugin Pdepend
--------------
Runs [PDepend](http://pdepend.org/) software metrics.
### Configuration Options:
Configuration
=============
### Options
* **directory** - Required - Directory in which to run PDepend.

View file

@ -1,6 +1,12 @@
Plugin PostgreSQL
-----------------
Connects to a given PostgreSQL server and runs a list of queries.
### Example Configuration:
Configuration
=============
### Examples
```yaml
build_settings:

View file

@ -1,6 +1,19 @@
Plugin Phar
-----------
Allows you to create a [Phar](http://php.net/manual/en/book.phar.php) archive from your project.
### Example
Configuration
=============
### Options
* **directory**: `phar` output directory. Default: `%buildpath%`;
* **filename**: `phar` filename inside output directory. Default: `build.phar`;
* **regexp**: regular expression for Phar iterator. Default: `/\.php$/`; and
* **stub**: stub content filename. No default value.
### Examples
```
phar:
@ -9,10 +22,3 @@ phar:
regexp: /\.(php|phtml)$/
stub: filestub.php
```
### Configuration Options
* **directory**: `phar` output directory. Default: `%buildpath%`;
* **filename**: `phar` filename inside output directory. Default: `build.phar`;
* **regexp**: regular expression for Phar iterator. Default: `/\.php$/`; and
* **stub**: stub content filename. No default value.

View file

@ -1,13 +1,21 @@
Plugin Phing
------------
This plugin allows you to use the Phing build system to build your project.
### Configuration options:
Configuration
=============
### Options
* **directory** - Relative path to the directory in which you want to run phing.
* **build_file** - Your phing build.xml file.
* **targets** - Which build targets you want to run.
* **properties** - Any custom properties you wish to pass to phing.
* **property_file** - A file containing properties you wish to pass to phing.
### Sample config:
### Examples
```yml
phing:
build_file: 'build.xml'

View file

@ -1,7 +1,13 @@
Plugin PHP Code Sniffer
-----------------------
Runs PHP Code Sniffer against your build.
## Configuration
Configuration
=============
### Options
* **allowed_warnings** [int, optional] - The warning limit for a successful build.
* **allowed_errors** [int, optional] - The error limit for a successful build.
* **suffixes** [array, optional] - An array of file extensions to check.
@ -11,7 +17,8 @@ Runs PHP Code Sniffer against your build.
* **path** [string, optional] - Path in which to run PHP Code Sniffer.
* **ignore** [array, optional] - A list of files / paths to ignore, defaults to the build_settings ignore list.
### Example
### Examples
Simple example where PHPCS will run on app directory, but ignore the views folder, and use PSR-1 and PSR-2 rules for validation:
```yml
test:

View file

@ -1,12 +1,18 @@
Runs PHP Copy / Paste Detector against your build.
Plugin PHP Copy/Paste Detector
------------------------------
Runs PHP Copy/Paste Detector against your build.
Configuration
=============
## Configuration
### Options
* **path** - Optional - Path in which to run PHP Copy/Paste Detector (default: build root).
* **ignore** - Optional - A list of files / paths to ignore (default: build_settings > ignore).
* **standard** [string, optional] - which PSR standard to follow (default: 'PSR1').
### Example
### Examples
```yml
test:

View file

@ -1,13 +1,20 @@
Plugin PHP Coding Standards Fixer
---------------------------------
Runs PHP Coding Standards Fixer against your build.
## Configuration
Configuration
=============
### Options
* **verbose** [bool, optional] - Whether to run in verbose mode (default: false)
* **diff** [bool, optional] - Whether to run with the `--diff` flag enabled (default: false)
* **level** [string, optional] - `psr0`, `psr1`, `psr2`, or `symphony` (default: all)
* **workingdir** [string, optional] - The directory in which PHP CS Fixer should work (default: build root)
### Example
### Examples
```yml
test:
php_cs_fixer:
@ -17,5 +24,7 @@ test:
workingdir: "my/dir/path"
```
## Warning
Warning
=======
There is currently a bug with this plugin that will cause an error if you leave the level to default to `all`. That level does not exist and will cause the build to fail. Instead specify the level explicitly until this is fixed.

View file

@ -1,13 +1,19 @@
Plugin PHP Docblock Checker
---------------------------
Runs the PHP Docblock Checker against your build. This tool verifies that all classes and methods have docblocks.
### Configuration Options:
Configuration
=============
### Options
* **allowed_warnings** - Optional - The warning limit for a successful build.
* **path** - Optional - Directory in which PHP Docblock Checker should run.
* **skip_methods** - Optional - Tells the checker to ignore methods that don't have a docblock.
* **skip_classes** - Optional - Tells the checker to ignore classes that don't have a docblock.
### Example config:
### Examples
```yml
php_docblock_checker:

View file

@ -1,10 +1,17 @@
Plugin PHPLoc
-------------
Runs [PHPLoc](https://github.com/sebastianbergmann/phploc) against your project and records some key metrics.
## Configuration
Configuration
=============
### Options
* **directory** - Optional - The directory in which phploc should run.
### Example
Run PHPLOC against the app directory only. This will prevent inclusion of code from 3rd party libraries that are included outside of the app directory.
```yml

View file

@ -1,7 +1,13 @@
Plugin PHP Mess Detector
------------------------
Runs PHP Mess Detector against your build. Records some key metrics, and also reports errors and warnings.
## Configuration
Configuration
=============
### Options
- **allowed_warnings** [int, optional] - The warning limit for a successful build (default: 0). -1 disables warnings. Setting allowed_warnings in conjunction with zero_config will override zero_config.
- **suffixes** [array, optional] - An array of file extensions to check (default: 'php')
- **ignore** [array, optional] - An array of files/paths to ignore (default: build_settings > ignore)
@ -9,8 +15,8 @@ Runs PHP Mess Detector against your build. Records some key metrics, and also re
- **rules** [array, optional] - Array of rulesets that PHPMD should use when checking your build or a string containing at least one slash, will be treated as path to PHPMD ruleset. See http://phpmd.org/rules/index.html for complete details on the rules. (default: ['codesize', 'unusedcode', 'naming']).
- **zero_config** [bool, optional] - Suppresses build failure on errors and warnings if set to true. (default: false).
### Examples
### Example
```yml
test:
php_mess_detector:

View file

@ -1,11 +1,18 @@
Plugin PHP Parallel Lint
------------------------
Similar to the [standard PHP Lint plugin](https://github.com/Block8/PHPCI/wiki/Lint-plugin), except that it uses the [PHP Parallel Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint) project to run.
## Configuration
Configuration
=============
### Options
* **directory** [string, optional] - directory to inspect (default: build root)
* **ignore** [array, optional] - directory to ignore (default: inherits ignores specified in setup)
### Example
### Examples
```yml
test:
php_parallel_lint:

View file

@ -1,24 +1,18 @@
Plugin PHP Spec
---------------
Runs [PHP Spec](http://www.phpspec.net/) tests against your build.
### Configuration Options:
Configuration
=============
### Options
* **bootstrap** - Optional - Path to a PHPSpec bootstrap file.
### Example
### Examples
```
build_settings:
[...]
setup:
[...]
test:
php_spec:
complete:
[...]
success:
[...]
```

View file

@ -1,9 +1,17 @@
Plugin PHPUnit
--------------
Runs PHPUnit tests against your build.
## Configuration
Configuration
=============
### Options
Has two modes:
#### phpunit.xml Configuration File
Its activated if you have phpunit.xml file in your build path, `tests/` subfolder, or you specify it as a parameter:
* **config** - Optional - Path to a PHP Unit XML configuration file.
* **run_from** - Optional - When running PHPUnit with an XML config, the command is run from this directory
@ -11,12 +19,14 @@ Its activated if you have phpunit.xml file in your build path, `tests/` subfolde
* **path** - Optional - In cases where tests files are in a sub path of the /tests path, allows this path to be set in the config.
#### Running Tests By Specifying Directory
* **directory** - Optional - The directory (or array of dirs) to run PHPUnit on
Both modes accept:
* **args** - Optional - Command line args (in string format) to pass to PHP Unit
### Examples
Specify config file and test directory:
```yml
test:
@ -26,7 +36,9 @@ test:
path: "app/tests/"
```
## Troubleshooting
Troubleshooting
===============
If standard logging of PHPCI is not enough, to get standard output from any command, including PHPUnit, edit `BaseCommandExecutor::executeCommand()` to see what exactly is wrong
* Run `composer update` in phpunit plugin directory of PHPCI to get all of its dependencies
* If phpunit is inside of the project's composer.json, it might interfere with PHPCI's phpunit installation

View file

@ -1,3 +1,6 @@
Plugin Shell
------------
Runs a given Shell command.
**Note: ** Because this plugin could potentially be abused, it requires extra steps to enable it:
@ -13,7 +16,10 @@ define('ENABLE_SHELL_PLUGIN', true);
If `ENABLE_SHELL_PLUGIN` is either false or undefined, the shell plugin won't work.
### Configuration Options:
Configuration
=============
### Options
* **command** - Required - The shell command to run.
@ -24,7 +30,7 @@ setup:
```
You should understand, that in old configuration type, you can run only one command!
### New format of Configuration Options
#### New format of Configuration Options
```yml
setup:
@ -44,5 +50,4 @@ setup:
- "cd %BUILD_PATH% && php artisan migrate" # Laravel Migrations
```
[See variables which you can use in shell commands](../interpolation.md)

View file

@ -1,6 +1,12 @@
Plugin Slack Notify
-------------------
This plugin joins a [Slack](https://www.slack.com/) room and sends a user-defined message, for example a "Build Succeeded" message.
**Configuration Options:**
Configuration
=============
### Options
| Field | Required? | Description |
|-------|-----------|-------------|
@ -11,6 +17,8 @@ This plugin joins a [Slack](https://www.slack.com/) room and sends a user-define
| `message` | No | The message to send to the room. Default - `<%PROJECT_URI%|%PROJECT_TITLE%> - <%BUILD_URI%|Build #%BUILD%> has finished for commit <%COMMIT_URI%|%SHORT_COMMIT% (%COMMIT_EMAIL%)> on branch <%BRANCH_URI%|%BRANCH%>` |
| `show_status` | No | Whether or not to append the build status as an attachment in slack. Default - true
### Examples
Send a message if the build fails:
```yaml
failure:
@ -47,4 +55,4 @@ complete:
icon: ":ghost:"
message: "%PROJECT_TITLE% - build %BUILD% completed"
show_status: true
```
```

View file

@ -1,5 +1,11 @@
Plugin Technical Dept
---------------------
Checks all files in your project for TODOs and other technical debt.
## Configuration Options:
Configuration
=============
### Options
* **searches** - Optional - Case-insensitive array of terms to search for. Defaults to TODO, TO DO, FIXME and FIX ME.

View file

@ -1,11 +1,22 @@
## Requirements
Plugin XMPP
-----------
Requirements
============
- sendxmpp package
## Installation
Installation
============
1. On debian system (for example) use aptitude command to install sendxmpp
2. Add XMPP plugin in "complete" section of your phpci.yml
## Configuration options
Configuration
=============
### Options
- username : Username of your XMPP sender account. (example : login@server.com)
- password : Password of your XMPP sender account.
- recipients : List of your XMPP recipents account.
@ -14,7 +25,7 @@
- alias : Alias of your sender account. (optional)
- date_format : strftime mask date format display in notification message. (optional, default is %c of strftime function)
## Configuration example
### Examples
```
complete:

View file

@ -1,3 +1,6 @@
Automatically building commits pushed to Bitbucket
--------------------------------------------------
If you would like your builds to run automatically whenever there is a commit or other similar activity in your Bitbucket repository, perform the following steps:
1. Log into PHPCI.

View file

@ -1,8 +1,15 @@
## Requirements
Automatically building commits pushed to Git
--------------------------------------------
Requirements
============
- A git repository on a server (bare or plain does not matter)
- [curl](http://curl.haxx.se) to send the web hook
## Installation
Installation
============
1. Create a new file `post-receive` inside the [git `hooks` directory](http://www.git-scm.com/book/en/Customizing-Git-Git-Hooks) with the following content:
```shell
@ -12,40 +19,40 @@ PROJECT_ID=1
PHPCI_URL="http://my.server.com/PHPCI/"
trigger_hook() {
NEWREV="$2"
REFNAME="$3"
if [ "$NEWREV" = "0000000000000000000000000000000000000000" ]; then
# Ignore deletion
return
fi
case "$REFNAME" in
# Triggers only on branches and tags
refs/heads/*|refs/tags/*) ;;
# Bail out on other references
*) return ;;
esac
BRANCH=$(git rev-parse --symbolic --abbrev-ref "$REFNAME")
COMMITTER=$(git log -1 "$NEWREV" --pretty=format:%ce)
MESSAGE=$(git log -1 "$NEWREV" --pretty=format:%s)
echo "Sending webhook"
curl \
--data-urlencode branch="$BRANCH" \
--data-urlencode commit="$NEWREV" \
--data-urlencode committer="$COMMITTER" \
--data-urlencode message="$MESSAGE" \
"$PHPCI_URL/webhook/git/$PROJECT_ID"
NEWREV="$2"
REFNAME="$3"
if [ "$NEWREV" = "0000000000000000000000000000000000000000" ]; then
# Ignore deletion
return
fi
case "$REFNAME" in
# Triggers only on branches and tags
refs/heads/*|refs/tags/*) ;;
# Bail out on other references
*) return ;;
esac
BRANCH=$(git rev-parse --symbolic --abbrev-ref "$REFNAME")
COMMITTER=$(git log -1 "$NEWREV" --pretty=format:%ce)
MESSAGE=$(git log -1 "$NEWREV" --pretty=format:%s)
echo "Sending webhook"
curl \
--data-urlencode branch="$BRANCH" \
--data-urlencode commit="$NEWREV" \
--data-urlencode committer="$COMMITTER" \
--data-urlencode message="$MESSAGE" \
"$PHPCI_URL/webhook/git/$PROJECT_ID"
}
if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
PAGER= trigger_hook $1 $2 $3
PAGER= trigger_hook $1 $2 $3
else
while read oldrev newrev refname; do
trigger_hook $oldrev $newrev $refname
done
while read oldrev newrev refname; do
trigger_hook $oldrev $newrev $refname
done
fi
```

View file

@ -1,3 +1,6 @@
Automatically building commits pushed to GitHub
-----------------------------------------------
If you would like your builds to run automatically whenever there is a commit or other similar activity in your GitHub repository, perform the following steps:
1. Log into PHPCI.

View file

@ -1,4 +1,7 @@
If you would like your builds to run automatically whenever there is a commit or other similar activity in your Gitlab repository, perform the following steps:
Automatically building commits pushed to GitLab
-----------------------------------------------
If you would like your builds to run automatically whenever there is a commit or other similar activity in your GitLab repository, perform the following steps:
1. Log into PHPCI.
2. Click on your Gitlab project.

View file

@ -1,4 +1,9 @@
### Status Image
Project Status Images and Status Page
-------------------------------------
Status Image
============
Most Continuous Integration systems provide a simple image URL that you can use to display your project status on other web sites (like Github) - PHPCI is no different.
You can find the status image at the following location: `http://{PHPCI URL}/build-status/image/{PROJECT ID}`
@ -9,7 +14,9 @@ Example:
![](http://phpci.block8.net/build-status/image/2)
### Status Page
Status Page
===========
PHPCI also provides a public project status page, that is accessible for everyone.
You can find the status page at the following location: `http://{PHPCI URL}/build-status/view/{PROJECT ID}`
@ -17,11 +24,11 @@ You can find the status page at the following location: `http://{PHPCI URL}/buil
Example:
http://phpci.block8.net/build-status/view/2
#### Where do I find my project ID?
### Where do I find my project ID?
Go to your instance of PHPCI, and open the project you are interested in. The project ID is the number in the last part of the URL in your browser.
Example:
http://phpci.block8.net/project/view/2 ~> PROJECT ID: `2`
#### Enable/disable status image and page
### Enable/disable status image and page
You can enable or disable access to the public status image and page in your project's settings.

View file

@ -1,7 +1,10 @@
Updating PHPCI
--------------
Updating PHPCI to the latest release, or even dev-master updates is something that will need to be done from time to time. Most of this may be self-explanatory, but for clarity and completeness, it should be added to the documentation.
1. Go to your PHPCI root folder in a Terminal.
2. Pull the latest code. On Linux and Mac this would look like this: `git pull`
2. Pull the latest code. This would look like this: `git pull`
3. Update the PHPCI database: `./console phpci:update`
4. Update the composer and its packages: `composer self-update && composer update`
5. Return to the PHPCI admin screens and check your desired plugins are still installed correctly.

View file

@ -1,8 +1,12 @@
Adding a Virtual Host
---------------------
In order to access the PHPCI web interface, you need to set up a virtual host in your web server.
Below are a few examples of how to do this for various different web servers.
## Nginx Example:
Nginx Example
=============
```
server {
@ -24,7 +28,8 @@ server {
}
```
## Apache Example:
Apache Example
==============
For Apache, you can use a standard virtual host, as long as your server supports PHP. All you need to do is add the following to a `.htaccess` file in your PHPCI `/public` directory.
@ -38,7 +43,6 @@ For Apache, you can use a standard virtual host, as long as your server supports
</IfModule>
```
### Installing in Vagrant
- Edit virtual host in apache2.
```
<VirtualHost *:80>
@ -57,41 +61,13 @@ For Apache, you can use a standard virtual host, as long as your server supports
</VirtualHost>
```
- In Mac OS X add in /etc/hosts
- Add in /etc/hosts
```
127.0.0.1 phpci.vagrant
```
## Other Servers
### Lighttpd Example (lighttpd >= `1.4.24`):
This example uses the `$HTTP["host"]` conditional block because `$HTTP["url"]` blocks aren't supported with url rewriting in lighttpd <= `1.4.33` (source: [lighttpd docs for mod_rewrite](http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite)). In lighttpd >= `1.4.34` however, [this has been fixed](http://redmine.lighttpd.net/issues/2526).
### lighttpd <= `1.4.33`
```
$HTTP["host"] =~ "^phpci\.example\.com$" {
# Rewrite all requests to non-physical files
url.rewrite-if-not-file =
(
"^(.*)$" => "index.php/$1"
)
}
```
### lighttpd >= `1.4.34`
```
$HTTP["url"] =~ "^\/PHPCI/$" {
# Rewrite all requests to non-physical files
url.rewrite-if-not-file =
(
"^(.*)$" => "index.php/$1"
)
}
```
If you ~~would like~~ are forced to use lighttpd <= `1.4.24`, [you can use mod_magnet and Lua instead] (http://redmine.lighttpd.net/projects/1/wiki/AbsoLUAtion).
### Built-in PHP Server Example:
Built-in PHP Server Example
===========================
You can use the built-in PHP server `php -S localhost:8080` by adding `public/routing.php`.

View file

@ -1,8 +1,12 @@
Run Builds Using Cron
---------------------
Running builds using cron is a quick and simple method of getting up and running with PHPCI. It also removes the need for PHPCI to be running all the time.
If you want a little more control over how PHPCI runs, you may want to [set up the PHPCI daemon](/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) instead.
If you want a little more control over how PHPCI runs, you may want to [set up the PHPCI daemon](workers/daemon.md) instead.
## Setting up the Cron Job:
Setting up the Cron Job
=======================
You'll want to set up PHPCI to run as a regular cronjob, so run `crontab -e` and enter the following:

View file

@ -1,10 +1,14 @@
Run Builds Using a Daemon
-------------------------
The PHPCI daemon runs in the background on your server and continuously checks for new builds. Unless already running a build, the daemon should pick up and start running new builds within seconds of being created.
The daemon is also useful if you want to run multiple PHPCI workers in a virtualised environment (i.e. Docker)
If you want to run PHPCI builds on a regular schedule instead, you should [set up a cron-job](/Block8/PHPCI/wiki/Run-Builds-Using-Cron).
If you want to run PHPCI builds on a regular schedule instead, you should [set up a cron-job](workers/cron.md).
## Starting the Daemon:
Starting the Daemon
===================
On a Linux/Unix server, the following command will start the daemon and keep it running even when you log out of the server:

View file

@ -1,29 +1,35 @@
Run Builds Using a Worker
-------------------------
The PHPCI Worker (added in v1.7) runs in the background on your server and waits for new builds to be added to a Beanstalkd queue. Unless already running a build, the worker will pick up and start running new builds almost immediately after their creation.
The worker is the recommended way to run PHPCI builds. You can run several workers all watching one queue, allowing jobs to be run simultaneously without the overhead of polling your MySQL database.
If you can't run Beanstalkd on your server, or would prefer to run builds on a regular schedule, you should consider using the [build daemon](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-a-Daemon) or [running builds via Cron](https://github.com/Block8/PHPCI/wiki/Run-Builds-Using-Cron).
If you can't run Beanstalkd on your server, or would prefer to run builds on a regular schedule, you should consider using the [build daemon](workers/daemon.md) or [running builds via Cron](workers/cron.md).
## Pre-Requisites
Pre-Requisites
==============
* You need to install [Beanstalkd](http://kr.github.io/beanstalkd/) - On Ubuntu, this is as simple as running `apt-get install beanstalkd`.
* [Supervisord](http://supervisord.org/) needs to be installed and running on your server.
## Setting up the PHPCI Worker
Setting up the PHPCI Worker
===========================
### On a new installation:
### On a new installation
Setting up the worker on a new installation of PHPCI is as simple as entering the appropriate values for your Beanstalkd server hostname and queue name when running the PHPCI installer. By default, the installer assumes that you'll be using beanstalkd on `localhost` and will use the queue name `phpci`.
![PHPCI Worker Installer](https://www.phptesting.org/media/render/f48f63699a04444630352643af18b643)
### On an existing installation:
### On an existing installation
On an existing installation, to set up the worker, you simply need to add the beanstalkd host and queue names directly into your `/PHPCI/config.yml` file. You should add a `worker` key beneath the `phpci` section, with the properties `host` and `queue` as outlined in the screenshot below:
![PHPCI Worker Config](https://www.phptesting.org/media/render/9a88e9298670f2913f5798e68b94c9ed)
## Running the PHPCI Worker:
Running the PHPCI Worker
========================
Once you've set up PHPCI to add your jobs to a beanstalkd queue, you need to start the worker so that it can pick up and run your builds. On most servers, it is best to manage this using supervisord. The following instructions work on Ubuntu, but will need slight amendments for other distributions.