Adding requirements to the PHPCI composer.json file is no longer recommended as a method of installing your required testing tools.
5 | For this reason, we have removed the ability for PHPCI to modify the composer.json file for you.
6 | We recommend that you install testing tools using your project's own composer.json file, by adding them to the "require-dev" section of the file.
--------------------------------------------------------------------------------
/PHPCI/ZeroConfigPlugin.php:
--------------------------------------------------------------------------------
1 |
17 | */
18 | interface ZeroConfigPlugin
19 | {
20 | public static function canExecute($stage, Builder $builder, Build $build);
21 | }
22 |
--------------------------------------------------------------------------------
/PHPCI/build/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PHPCI
2 | =====
3 |
4 | PHPCI is a free and open source (BSD License) continuous integration tool specifically designed for PHP. We've built it with simplicity in mind, so whilst it doesn't do *everything* Jenkins can do, it is a breeze to set up and use.
5 |
6 |
7 | ## What it does:
8 | * Clones your project from Github, Bitbucket or a local path
9 | * Allows you to set up and tear down test databases.
10 | * Installs your project's Composer dependencies.
11 | * Runs through any combination of the [supported plugins](https://docs.phptesting.org/en/latest/#plugins).
12 | * You can mark directories for the plugins to ignore.
13 | * You can mark certain plugins as being allowed to fail (but still run.)
14 |
15 | ### What it doesn't do (yet):
16 | * Virtualised testing.
17 | * Multiple PHP-version tests.
18 | * Install PEAR or PECL extensions.
19 | * Deployments - We strongly recommend using [Deployer](http://phpdeployment.org)
20 |
21 | ## Getting Started:
22 | We've got documentation on our website on [installing PHPCI](https://docs.phptesting.org/en/latest/installing-phpci/) and [adding support for PHPCI to your projects](https://docs.phptesting.org/en/latest/adding-phpci-support-to-your-projects/).
23 |
24 | ## Contributing
25 | Contributions from others would be very much appreciated! Please read our [guide to contributing](https://github.com/dancryer/PHPCI/blob/master/.github/CONTRIBUTING.md) for more information on how to get involved.
26 |
27 | ## Questions?
28 | 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.
29 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Controller/WebhookControllerTest.php:
--------------------------------------------------------------------------------
1 | prophesize('b8\Config')->reveal(),
21 | $this->prophesize('b8\Http\Request')->reveal(),
22 | $this->prophesize('b8\Http\Response')->reveal()
23 | );
24 |
25 | $error = $webController->handleAction('test', []);
26 |
27 | $this->assertInstanceOf('b8\Http\Response\JsonResponse', $error);
28 |
29 | $responseData = $error->getData();
30 | $this->assertEquals(500, $responseData['code']);
31 |
32 | $this->assertEquals('failed', $responseData['body']['status']);
33 |
34 | $this->assertEquals('application/json', $responseData['headers']['Content-Type']);
35 |
36 | // @todo: we can't text the result is JSON file with
37 | // $this->assertJson((string) $error);
38 | // since the flush method automatically add the header and break the
39 | // testing framework.
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Helper/AnsiConverterTest.php:
--------------------------------------------------------------------------------
1 | markTestSkipped('External library do not support PHP 5.3');
22 | }
23 | }
24 |
25 | public function testConvert_convertToHtml()
26 | {
27 | $input = "\e[31mThis is red !\e[0m";
28 |
29 | $expectedOutput = 'This is red !';
30 |
31 | $actualOutput = AnsiConverter::convert($input);
32 |
33 | $this->assertEquals($expectedOutput, $actualOutput);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Helper/BuildInterpolatorTest.php:
--------------------------------------------------------------------------------
1 | testedInterpolator = new BuildInterpolator();
26 | }
27 |
28 | public function testInterpolate_LeavesStringsUnchangedByDefault()
29 | {
30 | $string = "Hello World";
31 | $expectedOutput = "Hello World";
32 |
33 | $actualOutput = $this->testedInterpolator->interpolate($string);
34 |
35 | $this->assertEquals($expectedOutput, $actualOutput);
36 | }
37 |
38 | public function testInterpolate_LeavesStringsUnchangedWhenBuildIsSet()
39 | {
40 | $build = $this->prophesize('PHPCI\\Model\\Build')->reveal();
41 |
42 | $string = "Hello World";
43 | $expectedOutput = "Hello World";
44 |
45 | $this->testedInterpolator->setupInterpolationVars(
46 | $build,
47 | "/buildpath/",
48 | "phpci.com"
49 | );
50 |
51 | $actualOutput = $this->testedInterpolator->interpolate($string);
52 |
53 | $this->assertEquals($expectedOutput, $actualOutput);
54 | }
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Helper/LangTest.php:
--------------------------------------------------------------------------------
1 | prophesize('DateTime');
21 | $dateTime->format(DateTime::ISO8601)->willReturn("ISODATE");
22 | $dateTime->format(DateTime::RFC2822)->willReturn("RFCDATE");
23 |
24 | $this->assertEquals('', Lang::formatDateTime($dateTime->reveal(), 'FORMAT'));
25 | }
26 |
27 | public function testLang_UseDefaultFormat()
28 | {
29 | $dateTime = $this->prophesize('DateTime');
30 | $dateTime->format(DateTime::ISO8601)->willReturn("ISODATE");
31 | $dateTime->format(DateTime::RFC2822)->willReturn("RFCDATE");
32 |
33 | $this->assertEquals('', Lang::formatDateTime($dateTime->reveal()));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Model/BuildTest.php:
--------------------------------------------------------------------------------
1 |
20 | */
21 | class BuildTest extends \PHPUnit_Framework_TestCase
22 | {
23 | public function setUp()
24 | {
25 | }
26 |
27 | public function testExecute_TestIsAValidModel()
28 | {
29 | $build = new Build();
30 | $this->assertTrue($build instanceof \b8\Model);
31 | $this->assertTrue($build instanceof Model);
32 | $this->assertTrue($build instanceof Model\Base\BuildBase);
33 | }
34 |
35 | public function testExecute_TestBaseBuildDefaults()
36 | {
37 | $build = new Build();
38 | $this->assertEquals('#', $build->getCommitLink());
39 | $this->assertEquals('#', $build->getBranchLink());
40 | $this->assertEquals(null, $build->getFileLinkTemplate());
41 | }
42 |
43 | public function testExecute_TestIsSuccessful()
44 | {
45 | $build = new Build();
46 | $build->setStatus(Build::STATUS_NEW);
47 | $this->assertFalse($build->isSuccessful());
48 |
49 | $build->setStatus(Build::STATUS_RUNNING);
50 | $this->assertFalse($build->isSuccessful());
51 |
52 | $build->setStatus(Build::STATUS_FAILED);
53 | $this->assertFalse($build->isSuccessful());
54 |
55 | $build->setStatus(Build::STATUS_SUCCESS);
56 | $this->assertTrue($build->isSuccessful());
57 | }
58 |
59 | public function testExecute_TestBuildExtra()
60 | {
61 | $info = array(
62 | 'item1' => 'Item One',
63 | 'item2' => 2,
64 | );
65 |
66 | $build = new Build();
67 | $build->setExtra(json_encode($info));
68 |
69 | $this->assertEquals('Item One', $build->getExtra('item1'));
70 | $this->assertEquals(2, $build->getExtra('item2'));
71 | $this->assertNull($build->getExtra('item3'));
72 | $this->assertEquals($info, $build->getExtra());
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Plugin/Util/ComposerPluginInformationTest.php:
--------------------------------------------------------------------------------
1 | testedInformation = ComposerPluginInformation::buildFromYaml($file);
25 | }
26 |
27 | protected function phpciSetup()
28 | {
29 | $this->setUpFromFile(
30 | __DIR__ . "/../../../../vendor/composer/installed.json"
31 | );
32 | }
33 |
34 | public function testBuildFromYaml_ReturnsInstance()
35 | {
36 | $this->phpciSetup();
37 | $this->assertInstanceOf(
38 | '\PHPCI\Plugin\Util\ComposerPluginInformation',
39 | $this->testedInformation
40 | );
41 | }
42 |
43 | public function testGetInstalledPlugins_ReturnsStdClassArray()
44 | {
45 | $this->phpciSetup();
46 | $plugins = $this->testedInformation->getInstalledPlugins();
47 | $this->assertInternalType("array", $plugins);
48 | $this->assertContainsOnly("stdClass", $plugins);
49 | }
50 |
51 | public function testGetPluginClasses_ReturnsStringArray()
52 | {
53 | $this->phpciSetup();
54 | $classes = $this->testedInformation->getPluginClasses();
55 | $this->assertInternalType("array", $classes);
56 | $this->assertContainsOnly("string", $classes);
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Plugin/Util/ExamplePluginConfig.php:
--------------------------------------------------------------------------------
1 | registerResource(
13 | // This function will be called when the resource is needed.
14 | function() {
15 | return array(
16 | 'bar' => "Hello",
17 | );
18 | },
19 | "requiredArgument",
20 | null
21 | );
22 | };
23 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php:
--------------------------------------------------------------------------------
1 | Options = $options;
30 | }
31 |
32 | public function execute()
33 | {
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Plugin/Util/Fake/ExamplePluginWithNoConstructorArgs.php:
--------------------------------------------------------------------------------
1 | RequiredArgument = $requiredArgument;
23 | }
24 |
25 | public function execute()
26 | {
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Plugin/Util/Fake/ExamplePluginWithSingleTypedRequiredArg.php:
--------------------------------------------------------------------------------
1 | RequiredArgument = $requiredArgument;
23 | }
24 |
25 | public function execute()
26 | {
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Tests/PHPCI/Plugin/Util/FilesPluginInformationTest.php:
--------------------------------------------------------------------------------
1 | getInstalledPlugins();
23 | $this->assertContainsOnlyInstancesOf('stdClass', $pluginInfos);
24 | }
25 |
26 | public function testGetPluginClasses_returnsStrings()
27 | {
28 | $pluginDirPath = realpath(__DIR__ . "/../../../../PHPCI/Plugin/");
29 | $test = FilesPluginInformation::newFromDir($pluginDirPath);
30 | $pluginInfos = $test->getPluginClasses();
31 | $this->assertContainsOnly('string', $pluginInfos);
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/Tests/PHPCI/ProcessControl/PosixProcessControlTest.php:
--------------------------------------------------------------------------------
1 | object = new PosixProcessControl();
11 | }
12 |
13 | public function testIsAvailable()
14 | {
15 | $this->assertEquals(function_exists('posix_kill'), PosixProcessControl::isAvailable());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Tests/PHPCI/ProcessControl/UnixProcessControlTest.php:
--------------------------------------------------------------------------------
1 | object = new UnixProcessControl();
11 | }
12 |
13 | public function getTestCommand()
14 | {
15 | return "read SOMETHING";
16 | }
17 |
18 | public function testIsAvailable()
19 | {
20 | $this->assertEquals(DIRECTORY_SEPARATOR === '/', UnixProcessControl::isAvailable());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tests/PHPCI/ProcessControl/WindowsProcessControlTest.php:
--------------------------------------------------------------------------------
1 | object = new WindowsProcessControl;
11 | }
12 |
13 | public function getTestCommand()
14 | {
15 | return "pause";
16 | }
17 |
18 | public function testIsAvailable()
19 | {
20 | $this->assertEquals(DIRECTORY_SEPARATOR === '\\', WindowsProcessControl::isAvailable());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tests/bootstrap.php:
--------------------------------------------------------------------------------
1 | loadYaml($configFile);
38 | }
39 |
40 | require_once(dirname(__DIR__) . '/vars.php');
41 |
42 | \PHPCI\Helper\Lang::init($config);
43 | \PHPCI\Helper\Lang::setLanguage("en");
44 |
--------------------------------------------------------------------------------
/Tests/temp/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | # PHPCI Changelog
2 |
3 | ## v.Next
4 |
5 | ### New Features:
6 | - SSH-based Mercurial clones (Commit: [e98647bd](https://github.com/Block8/PHPCI/commit/e98647bd97d49741242d252514b8703504a62869), PR: [#812](https://github.com/Block8/PHPCI/pull/812))
7 | - Ability to archive projects (Commit: [1466ad06](https://github.com/Block8/PHPCI/commit/1466ad06ef708cbab2b53112fc59e8c1d70c2e33), PR: [#771](https://github.com/Block8/PHPCI/pull/771))
8 |
9 | ### Bug Fixes and Tweaks:
10 |
11 |
--------------------------------------------------------------------------------
/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | add(new RunCommand($loggerConfig->getFor('RunCommand')));
33 | $application->add(new RebuildCommand($loggerConfig->getFor('RunCommand')));
34 | $application->add(new InstallCommand);
35 | $application->add(new UpdateCommand($loggerConfig->getFor('UpdateCommand')));
36 | $application->add(new GenerateCommand);
37 | $application->add(new DaemonCommand($loggerConfig->getFor('DaemonCommand')));
38 | $application->add(new PollCommand($loggerConfig->getFor('PollCommand')));
39 | $application->add(new CreateAdminCommand(Factory::getStore('User')));
40 | $application->add(new CreateBuildCommand(Factory::getStore('Project'), new BuildService(Factory::getStore('Build'))));
41 | $application->add(new WorkerCommand($loggerConfig->getFor('WorkerCommand')));
42 | $application->add(new RebuildQueueCommand($loggerConfig->getFor('RebuildQueueCommand')));
43 |
44 | $application->run();
45 |
--------------------------------------------------------------------------------
/console.bat:
--------------------------------------------------------------------------------
1 | @php console %*
--------------------------------------------------------------------------------
/daemon/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/daemonise:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | add(new DaemoniseCommand($loggerConfig->getFor('DaemoniseCommand')));
20 | $application->run();
21 |
--------------------------------------------------------------------------------
/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | web:
4 | image: nginx:latest
5 | ports:
6 | - "80:80"
7 | volumes:
8 | - ./public/assets:/phpci/public/assets
9 | - ./public/favicon.ico:/phpci/public/favicon.ico
10 | - ./public/robots.txt:/phpci/public/robots.txt
11 | - ./docker/nginx.conf:/etc/nginx/conf.d/phpci.conf
12 | links:
13 | - fpm
14 |
15 | worker:
16 | image: phpci-worker
17 | build:
18 | context: .
19 | dockerfile: docker/worker.dockerfile
20 | links:
21 | - beanstalkd
22 | volumes:
23 | - .:/phpci
24 |
25 | fpm:
26 | image: phpci-fpm
27 | build:
28 | context: .
29 | dockerfile: docker/fpm.dockerfile
30 | links:
31 | - beanstalkd
32 | volumes:
33 | - .:/phpci
34 |
35 | beanstalkd:
36 | image: schickling/beanstalkd:latest
37 | ports:
38 | - "11300:11300"
--------------------------------------------------------------------------------
/docker/fpm-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cd /phpci
4 |
5 | # Install composer:
6 | php -r "readfile('https://getcomposer.org/installer');" | php \
7 | && mv composer.phar /usr/local/bin/composer
8 |
9 | # Install composer dependencies:
10 | composer install -o --no-dev
11 |
12 | # Install npm dependencies:
13 | npm install --production
14 |
15 | mkdir -p /phpci/public/assets/js/AdminLTE
16 | mkdir -p /phpci/public/assets/css
17 | mkdir -p /phpci/public/assets/plugins
18 |
19 | cp -f /phpci/node_modules/admin-lte/dist/js/adminlte.min.js /phpci/public/assets/js/AdminLTE/app.min.js
20 | cp -f /phpci/node_modules/admin-lte/dist/js/pages/dashboard.js /phpci/public/assets/js/AdminLTE/dashboard.js
21 | cp -f /phpci/node_modules/admin-lte/dist/js/demo.js /phpci/public/assets/js/AdminLTE/demo.js
22 | cp -Rf /phpci/node_modules/admin-lte/dist/css/AdminLTE.min.css /phpci/public/assets/css/AdminLTE.min.css
23 | cp -Rf /phpci/node_modules/admin-lte/dist/css/skins/_all-skins.min.css /phpci/public/assets/css/AdminLTE-skins.min.css
24 | cp -Rf /phpci/node_modules/admin-lte/dist/img /phpci/public/assets/
25 | cp -Rf /phpci/node_modules/admin-lte/plugins /phpci/public/assets/
26 | cp -f /phpci/node_modules/bootstrap/dist/js/bootstrap.min.js /phpci/public/assets/js/bootstrap.min.js
27 | cp -f /phpci/node_modules/moment/min/moment.min.js /phpci/public/assets/js/moment.min.js
28 | cp -f /phpci/node_modules/sprintf-js/dist/sprintf.min.js /phpci/public/assets/js/sprintf.js
29 |
30 | php-fpm
31 |
--------------------------------------------------------------------------------
/docker/fpm.dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7-fpm
2 | RUN apt update && apt install -qy libcurl3-dev curl gnupg
3 | RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
4 | RUN apt update && apt install -qy nodejs
5 | RUN docker-php-ext-install -j$(nproc) pdo_mysql
6 | RUN docker-php-ext-install -j$(nproc) curl
7 |
8 | COPY docker/fpm-entrypoint.sh /fpm-entrypoint.sh
9 |
10 | ENTRYPOINT ["/bin/bash", "/fpm-entrypoint.sh"]
11 |
--------------------------------------------------------------------------------
/docker/nginx.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80 default_server;
3 |
4 | root /phpci/public;
5 |
6 | location / {
7 | try_files $uri @phpci;
8 | }
9 |
10 | location @phpci {
11 | fastcgi_pass fpm:9000;
12 | fastcgi_index index.php;
13 | fastcgi_buffers 256 4k;
14 | include fastcgi_params;
15 |
16 | fastcgi_param SCRIPT_FILENAME /phpci/public/index.php;
17 | fastcgi_param REQUEST_URI $uri;
18 | fastcgi_param PATH_INFO $uri;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/docker/worker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cd /phpci
4 |
5 | # Install composer:
6 | php -r "readfile('https://getcomposer.org/installer');" | php \
7 | && mv composer.phar /usr/local/bin/composer
8 |
9 | # Install composer dependencies:
10 | composer install -o --no-dev
11 |
12 | php /phpci/console phpci:worker
13 |
--------------------------------------------------------------------------------
/docker/worker.dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7
2 | RUN apt update && apt install -qy git-core libcurl3-dev curl
3 | RUN docker-php-ext-install -j$(nproc) pdo_mysql
4 | RUN docker-php-ext-install -j$(nproc) curl
5 |
6 | RUN git config --global user.name "PHPCI" \
7 | && git config --global user.email "hello@phptesting.org"
8 |
9 | COPY docker/worker-entrypoint.sh /worker-entrypoint.sh
10 |
11 | ENTRYPOINT ["/bin/bash", "/worker-entrypoint.sh"]
12 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SOURCEDIR = source
8 | BUILDDIR = build
9 |
10 | # Put it first so that "make" without argument is like "make help".
11 | help:
12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13 |
14 | .PHONY: help Makefile
15 |
16 | # Catch-all target: route all unknown targets to Sphinx using the new
17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18 | %: Makefile
19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/docs/source/adding-phpci-support-to-your-projects.md:
--------------------------------------------------------------------------------
1 | # Add PHPCI Support to Your Projects
2 |
3 | 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:
4 |
5 | ```yml
6 | build_settings:
7 | clone_depth: 1 # depth of 1 is a shallow clone, remove this line to clone entire repo
8 | ignore:
9 | - "vendor"
10 | - "tests"
11 | mysql:
12 | host: "localhost"
13 | user: "root"
14 | pass: ""
15 |
16 | setup:
17 | mysql:
18 | - "DROP DATABASE IF EXISTS test;"
19 | - "CREATE DATABASE test;"
20 | - "GRANT ALL PRIVILEGES ON test.* TO test@'localhost' IDENTIFIED BY 'test';"
21 | composer:
22 | action: "install"
23 |
24 | test:
25 | php_unit:
26 | config:
27 | - "PHPUnit-all.xml"
28 | - "PHPUnit-ubuntu-fix.xml"
29 | directory:
30 | - "tests/"
31 | run_from: "phpunit/"
32 | coverage: "tests/logs/coverage"
33 | php_mess_detector:
34 | allow_failures: true
35 | php_code_sniffer:
36 | standard: "PSR2"
37 | php_cpd:
38 | allow_failures: true
39 | grunt:
40 | task: "build"
41 |
42 | complete:
43 | mysql:
44 | host: "localhost"
45 | user: "root"
46 | pass: ""
47 | - "DROP DATABASE IF EXISTS test;"
48 | ```
49 |
50 | As mentioned earlier, PHPCI is powered by plugins, there are several phases in which plugins can be run:
51 |
52 | * `setup` - This phase is designed to initialize the build procedure.
53 | * `test` - The tests that should be run during the build. Plugins run during this phase will contribute to the success or failure of the build.
54 | * `complete` - Always called when the `test` phase completes, regardless of success or failure. **Note** that is you do any mysql stuff here, you will need to add the mysql credentials to this section as well, as it runs in a separate instance.
55 | * `success` - Called upon success of the `test` phase.
56 | * `failure` - Called upon failure of the `test` phase.
57 | * `fixed` - Called upon success of the `test` phase if the previous build of the branch was a failure.
58 | * `broken` - Called upon failure of the `test` phase if the previous build of the branch was a success.
59 |
60 | The `ignore` section is merely an array of paths that should be ignored in all tests (where possible.)
--------------------------------------------------------------------------------
/docs/source/atoum-plugin.md:
--------------------------------------------------------------------------------
1 | Allows you to run [Atoum](https://github.com/atoum/atoum) unit tests.
2 |
3 | ## Configuration
4 | ### Options
5 |
6 | - **args** [string, optional] - Allows you to pass command line arguments to Atoum.
7 | - **config** [string, optional] - Path to an Atoum configuration file.
8 | - **directory** [string, optional] - Path in which to run Atom (defaults to the build root).
9 | - **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).
10 |
11 | ### Example
12 | ```yml
13 | test:
14 | atoum:
15 | args: "command line arguments go here"
16 | config: "path to config file"
17 | directory: "directory to run tests"
18 | executable: "path to atoum executable"
19 | ```
20 |
--------------------------------------------------------------------------------
/docs/source/autobuilding from atlassian stash.md:
--------------------------------------------------------------------------------
1 | It is possible to use Stashes External Post Receive Hooks.
2 | Create a post_receive.sh script with execution rights.
3 | Have the EPRH execute the shell script with a positional parameter of your PHPCI build id.
4 |
5 | PROJECT_ID=$1
6 | PHPCI_URL="http://ci.site.com"
7 | while read from_ref to_ref ref_name; do
8 | BRANCH=$(git rev-parse --symbolic --abbrev-ref $ref_name)
9 | echo "Sending webhook"
10 | curl "$PHPCI_URL/webhook/git/$PROJECT_ID?branch=$BRANCH&commit=$to_ref"
11 | done
12 |
13 | Optional, here is a way to send the stash user e-mail and the first 50 characters of the commit message.
14 | ```
15 | #!/bin/bash
16 | PROJECT_ID=$1
17 | PHPCI_URL="http://ci.site.com"
18 | while read from_ref to_ref ref_name; do
19 | BRANCH=$(git rev-parse --symbolic --abbrev-ref $ref_name)
20 | COMMITMESSAGE=$(git log -n 1 --pretty=format:%s $to_ref | cut -c1-50)
21 | curl -G \
22 | "$PHPCI_URL/webhook/git/$PROJECT_ID" \
23 | --data branch=$BRANCH \
24 | --data commit=$to_ref \
25 | --data committer=$STASH_USER_EMAIL \
26 | --data-urlencode message="$COMMITMESSAGE"
27 | done
28 | ```
--------------------------------------------------------------------------------
/docs/source/autobuilding from git by cron.md:
--------------------------------------------------------------------------------
1 | **Example 1:**
2 |
3 | `curl --data "branch=&commit=" http://phpci.example.com/webhook/git/`
4 |
5 | **Example 2:**
6 |
7 | `curl http://phpci.example.com/webhook/git/`
8 |
9 | The default branch is the master branch.
10 |
11 | You can create a cron with one of the commands above:
12 |
13 | `0 1 * * * /usr/bin/curl http://phpci.example.com/webhook/git/`
--------------------------------------------------------------------------------
/docs/source/autobuilding-from-bitbucket.md:
--------------------------------------------------------------------------------
1 | # Bitbucket Webhooks
2 |
3 | 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:
4 |
5 | 1. Log into PHPCI.
6 | 2. Click on your Bitbucket project.
7 | 3. Copy the web hook link specified on the left.
8 | 4. Log into Bitbucket and go to your repo.
9 | 5. Click the settings cog icon at the top right of the page.
10 | 6. Click on "Hooks" in the left hand menu
11 | 7. Select "POST" from the drop-down and click "Add hook"
12 | 8. Paste the web hook link you copied above, and press save.
13 |
--------------------------------------------------------------------------------
/docs/source/autobuilding-from-git.md:
--------------------------------------------------------------------------------
1 | # Git Post Commit Hook
2 |
3 | ## Requirements
4 | - A git repository on a server (bare or plain does not matter)
5 | - [curl](http://curl.haxx.se) to send the web hook
6 |
7 | ## Installation
8 | 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:
9 |
10 | ```shell
11 | #!/bin/sh
12 |
13 | PROJECT_ID=1
14 | PHPCI_URL="http://my.server.com/PHPCI/"
15 |
16 | trigger_hook() {
17 | NEWREV="$2"
18 | REFNAME="$3"
19 |
20 | if [ "$NEWREV" = "0000000000000000000000000000000000000000" ]; then
21 | # Ignore deletion
22 | return
23 | fi
24 |
25 | case "$REFNAME" in
26 | # Triggers only on branches and tags
27 | refs/heads/*|refs/tags/*) ;;
28 | # Bail out on other references
29 | *) return ;;
30 | esac
31 |
32 | BRANCH=$(git rev-parse --symbolic --abbrev-ref "$REFNAME")
33 | COMMITTER=$(git log -1 "$NEWREV" --pretty=format:%ce)
34 | MESSAGE=$(git log -1 "$NEWREV" --pretty=format:%s)
35 |
36 | echo "Sending webhook"
37 | curl \
38 | --data-urlencode branch="$BRANCH" \
39 | --data-urlencode commit="$NEWREV" \
40 | --data-urlencode committer="$COMMITTER" \
41 | --data-urlencode message="$MESSAGE" \
42 | "$PHPCI_URL/webhook/git/$PROJECT_ID"
43 | }
44 |
45 | if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
46 | PAGER= trigger_hook $1 $2 $3
47 | else
48 | while read oldrev newrev refname; do
49 | trigger_hook $oldrev $newrev $refname
50 | done
51 | fi
52 | ```
53 |
54 | 2. Change the file to be executable: `chmod a+x post-receive`
55 | 3. Push changes to the repository
--------------------------------------------------------------------------------
/docs/source/autobuilding-from-github.md:
--------------------------------------------------------------------------------
1 | # Github Webhooks
2 |
3 | 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:
4 |
5 | 1. Log into PHPCI.
6 | 2. Click on your GitHub project.
7 | 3. Copy the web hook link specified on the right of the page.
8 | 4. Log into GitHub and go to your repository.
9 | 5. Click the settings icon on the lower right sidebar.
10 | 6. Click on "Webhooks & Services".
11 | 7. Add your web hook link you copied above, and specify when you would like it to run.
12 | 8. Add the public key for the project in PHPCI to the deploy keys for the repository on GitHub.
13 | 9. Verify that the initial test delivery was successful. If not, make sure that your PHPCI machine is reachable from the internet.
--------------------------------------------------------------------------------
/docs/source/autobuilding-from-gitlab.md:
--------------------------------------------------------------------------------
1 | # Gitlab Webhooks
2 |
3 | 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:
4 |
5 | 1. Log into PHPCI.
6 | 2. Click on your Gitlab project.
7 | 3. Copy the web hook link specified on the right.
8 | 4. Log into Gitlab and go to your repo.
9 | 5. Click the "settings" tab in the top right corner of the page.
10 | 6. Click on "Web Hooks".
11 | 7. Paste the link you copied from PHPCI into the "URL" textbox.
12 | 8. Select the events which you want to trigger a PHPCI build. The default and recommended setup is to only enable "push events."
13 | 9. Click "Add Web Hook," and verify that the test was successful.
--------------------------------------------------------------------------------
/docs/source/behat-plugin.md:
--------------------------------------------------------------------------------
1 | A very simple plugin for running [Behat](http://behat.org/) BDD tests.
2 |
3 | ## Configuration
4 | ### Options
5 | - **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).
6 | - **features** [string, optional] - Provide a list of Behat features to run.
7 |
8 | ### Example
9 | ```yml
10 | test:
11 | behat:
12 | executable: "path to behat binary"
13 | features: "command line arguments"
14 | ```
15 |
--------------------------------------------------------------------------------
/docs/source/branch-specific-stages.md:
--------------------------------------------------------------------------------
1 | PHPCI allows you configure plugins depending on the branch you configure in the project settings in the UI. You can replace a complete stage for a branch, or add extra plugins to a stage that run before or after the default plugins.
2 |
3 | # Example config
4 | test: # Test stage config for all branches
5 | php_unit:
6 | allow_failures: 10
7 | success: # Success stage config for all branches
8 | shell: ./notify
9 | branch-release: # Test config for release branch
10 | run-option: replace # This can be set to either before, after or replace
11 | test:
12 | php_unit:
13 | allow_failures: 0
14 | branch-master: # Test config for release branch
15 | run-option: after # This can be set to either before, after or replace
16 | success:
17 | shell:
18 | - "rsync ..."
19 |
20 | # How it works
21 | When you have configured a branch eg "stable" in the project settings in the UI. Add a new config named "branch-BRANCH NAME", in this case "branch-stable" to the phpci.yml. In this config, specify all stages and plugins you wish to run.
22 |
23 | Also add a new config value "run-option", that can heve 3 values:
24 | * before: will cause the branch specific plugins to run before the default ones
25 | * after: will cause the branch specific plugins to run after the default ones
26 | * replace: will cause the branch specific plugins to run and the default ones not
27 |
28 | # References
29 | * https://github.com/Block8/PHPCI/issues/1045
30 | * https://github.com/Block8/PHPCI/issues/1209
31 | * https://github.com/Block8/PHPCI/blob/master/PHPCI/Plugin/Util/Executor.php
--------------------------------------------------------------------------------
/docs/source/campfire-plugin.md:
--------------------------------------------------------------------------------
1 | This plugin joins a [Campfire](https://campfirenow.com/) room and sends a user-defined message, for example a "Build Succeeded" message.
2 |
3 | ## Configuration
4 | ### Options
5 | - **authToken** [string, required] - Your Campfire user authentication token.
6 | - **message** [string, required] - The message to send to the room.
7 | - **roomId** [string, required] - Your Campfire room ID number.
8 | - **url** [string, required] - Your Campfire chat room URL.
9 |
10 | ### Example
11 | ```yml
12 | build_settings:
13 | campfire:
14 | authToken: "campfire auth token"
15 | roomId: "campfire room ID"
16 | url: "campfire URL"
17 | success:
18 | campfire:
19 | message: "Build succeeded!"
20 | ```
21 |
--------------------------------------------------------------------------------
/docs/source/clean-build-plugin.md:
--------------------------------------------------------------------------------
1 | Works through a list of files to remove from your build. Useful when used in combination with Copy Build or Package Build.
2 |
3 | ### Configuration Options:
4 |
5 | * **remove** - Required - An array of files and / or directories to remove.
6 |
7 | ### Example Configuration:
8 |
9 | ```yml
10 | complete:
11 | clean_build:
12 | remove:
13 | - composer.json
14 | - composer.phar
15 | - config.dev.php
16 | ```
--------------------------------------------------------------------------------
/docs/source/codeception-plugin.md:
--------------------------------------------------------------------------------
1 | A simple plugin that allows you to run [Codeception](http://codeception.com/) tests.
2 |
3 | ### Configuration Options:
4 |
5 | * **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.
6 |
7 | * **args** - Optional - The string of arguments to be passed to the run command. **Important**, due to the assumption made on line [132](https://github.com/Block8/PHPCI/blob/master/PHPCI/Plugin/Codeception.php#L132) regarding the value of `--xml` being the next argument which will not be correct if the user provides arguments using this config param, you must specify `report.xml` before any user input arguments to satisfy the report processing on line [146](https://github.com/Block8/PHPCI/blob/master/PHPCI/Plugin/Codeception.php#L146)
8 |
9 | * **path** - Optional - The path from the root of your project to the root of the codeception _output directory
10 |
11 | ##### Default values
12 |
13 | - config
14 | - `codeception.yml` if it exists in the root of the project
15 | - `codeception.dist.yml` if it exists in the root of the project
16 | - null if no option provided and the above two fail, this will cause an Exception to be thrown on execution
17 |
18 | - args
19 | - Empty string
20 |
21 | - path
22 | - `tests/_output/`
23 |
24 | ##### Example on running codeception with default settings (when tests are in tests/ directory):
25 |
26 | ```
27 | codeception:
28 | config: "codeception.yml"
29 | path: "tests/"
30 | ```
31 |
32 | ##### Example usage against the Yii2 framework
33 |
34 | ```
35 | codeception:
36 | allow_failures: false
37 | config: "tests/codeception.yml"
38 | path: "tests/codeception/_output/"
39 | args: "report.xml --no-ansi --coverage-html"
40 | ```
41 |
42 | The path value will need to be changed if you have your tests directory somewhere other than in the root of the project.
--------------------------------------------------------------------------------
/docs/source/composer-plugin.md:
--------------------------------------------------------------------------------
1 | Allows you to run Composer within your build, to install dependencies prior to testing. Best run as a "setup" stage plugin.
2 |
3 | ## Configuration
4 | ### Options
5 | * **directory** [optional, string] - Directory within which you want Composer to run (default: build root)
6 | * **action** [optional, string, update|install] - Action you wish Composer to run (default: 'install')
7 | * **prefer_dist** [optional, bool, true|false] - whether Composer should run with the `--prefer-dist` flag (default: false)
8 |
9 | ### Example
10 | ```yml
11 | setup:
12 | composer:
13 | directory: "my/composer/dir"
14 | action: "update"
15 | prefer_dist: true
16 | ```
17 |
18 | ## Warning
19 |
20 | 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.
21 |
22 | For more info, please check the Composer documentation.
23 |
24 | https://getcomposer.org/doc/04-schema.md#config
--------------------------------------------------------------------------------
/docs/source/configuring-phpci.md:
--------------------------------------------------------------------------------
1 | # Configuring PHPCI
2 |
3 | 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.
4 |
5 | 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
6 |
7 | phpci:
8 | authentication_settings:
9 | state: 1
10 | user_id: 1
11 |
12 | where you can get the user_id by logging into the mysql database and selecting your user ID from the `users` table in the `phpci` database.
--------------------------------------------------------------------------------
/docs/source/contributing-to-phpci.md:
--------------------------------------------------------------------------------
1 | Please find the updated contributing guidelines here: https://github.com/Block8/PHPCI/blob/master/.github/CONTRIBUTING.md
--------------------------------------------------------------------------------
/docs/source/copy-build-plugin.md:
--------------------------------------------------------------------------------
1 | Copies all files from your build, with the exception of those in the "ignore" build settings property, to a directory of your choosing.
2 |
3 | ### Configuration Options:
4 |
5 | * **directory** - Required - The directory to which you want to copy the build.
6 | * **respect_ignore** - Optional - Whether to respect the global "ignore" setting when copying files. Default is false.
7 | * **wipe** - Optional - Set true if you want destination directory to be cleared before copying. Default is false.
--------------------------------------------------------------------------------
/docs/source/custom-plugins-setup.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | Installing 3rd party plugins is straight forward and handled through composer. In the root folder of your phpci instance update the ```composer.json``` file to include the new plugins you require:
4 |
5 | ```yaml
6 | "require": {
7 | \\...
8 | "meadsteve/example-phpci-plugin" : "dev-master",
9 | \\...
10 | }
11 | ```
12 | running ```composer update plugin-provider/plugin-package ``` will then download the plugin.
13 |
14 | # Usage
15 |
16 | Once a new plugin has been installed to phpci any project can make use of this plugin. The plugin is referenced in the ```phpci.yml``` as a full class name including namespaces:
17 |
18 | ```yml
19 | setup:
20 | test:
21 | php_mess_detector:
22 | allowed_warnings: 0
23 | \meadsteve\PhpciPlugins\ExamplePlugin:
24 | option_one: 2
25 | ```
26 |
27 | # Extra dependency configuration
28 | //TODO: document ```pluginconfig.php``` in project root.
--------------------------------------------------------------------------------
/docs/source/deployer.md:
--------------------------------------------------------------------------------
1 | Triggers a deployment of the project to run via [Deployer](http://phpdeployment.org)
2 |
3 | **Configuration Options:**
4 | ### Options
5 | * **webhook_url** [required, string] - The URL to your Deployer WebHook
6 | * **reason** [optional, string] - Your deployment message. Default - PHPCI Build #%BUILD% - %COMMIT_MESSAGE%
7 | * **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
8 |
9 | ### Example
10 | ```yaml
11 | success:
12 | deployer:
13 | webhook_url: "https://deployer.example.com/deploy/QZaF1bMIUqbMFTmKDmgytUuykRN0cjCgW9SooTnwkIGETAYhDTTYoR8C431t"
14 | reason: "PHPCI Build #%BUILD% - %COMMIT_MESSAGE%"
15 | update_only: true
16 | ```
--------------------------------------------------------------------------------
/docs/source/email-plugin.md:
--------------------------------------------------------------------------------
1 | Sends a build status email.
2 |
3 | ### Configuration Options:
4 |
5 | * **committer** - Whether or not to send the email to the committer that prompted this build.
6 | * **addresses** - A list of addresses to send to.
7 | * **default_mailto_address** - A default address to send to.
8 | * **cc** - A list of addresses that will receive a copy of every emails sent.
9 | * **template** - The template to use, options are short and long. Default is short on success and long otherwise.
10 |
11 |
12 | **Note:** _This plugin will only work if you configured email settings during installation or configured them later in Admin Options > Settings > Email Settings_
13 |
14 | ### Configuration Example
15 | 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.
16 |
17 | Send an email to the committer as well as one@exameple.com if a build fails:
18 | ```yml
19 | failure:
20 | email:
21 | committer: true
22 | default_mailto_address: one@example.com
23 | ```
24 |
25 | Send an email to one@example.com every time a build is run:
26 | ```yml
27 | complete:
28 | email:
29 | default_mailto_address: one@example.com
30 | ```
--------------------------------------------------------------------------------
/docs/source/env-plugin.md:
--------------------------------------------------------------------------------
1 | Sets environment variables on the PHPCI server for the build.
2 |
3 | ### Sample Configuration:
4 |
5 | ```yml
6 | setup:
7 | env:
8 | APPLICATION_ENV: "development"
9 | ```
--------------------------------------------------------------------------------
/docs/source/example-phpci.yml.md:
--------------------------------------------------------------------------------
1 | These are just some example yaml config files
2 |
3 | ```
4 | build_settings:
5 | verbose: false
6 | prefer_symlink: false
7 |
8 | setup:
9 |
10 | test:
11 | php_unit:
12 | directory: "test/phpunit/"
13 | args: "--bootstrap 'test/phpunit/bootstrap.php' --configuration 'test/phpunit/phpunit.xml'"
14 |
15 | complete:
16 | ```
--------------------------------------------------------------------------------
/docs/source/grunt-plugin.md:
--------------------------------------------------------------------------------
1 | This plugin runs [Grunt](http://gruntjs.com/) tasks.
2 |
3 | ## Configuration
4 | ### Options
5 | - **directory** [string, optional] - The directory in which to run Grunt (defaults to build root.)
6 | - **grunt** [string, optional] - Allows you to provide a path to Grunt (defaults to PHPCI root, vendor/bin, or a system-provided Grunt).
7 | - **gruntfile** [string, optional] - Gruntfile to run (defaults to `Gruntfile.js`).
8 | - **task** [string, optional] - The Grunt task to run.
9 |
10 | ### Example
11 | ```yml
12 | test:
13 | grunt:
14 | directory: "path to run grunt in"
15 | grunt: "path to grunt executable"
16 | gruntfile: "gruntfile.js"
17 | task: "css"
18 | ```
19 |
--------------------------------------------------------------------------------
/docs/source/hipchat-notify-plugin.md:
--------------------------------------------------------------------------------
1 | This plugin joins a [HipChat](https://www.hipchat.com/) room and sends a user-defined message, for example a "Build Succeeded" message.
2 |
3 | **Configuration Options:**
4 |
5 | | Field | Required? | Description |
6 | |-------|-----------|-------------|
7 | | `authToken` | Yes | Your HipChat API authentication token (v1) |
8 | | `room` | Yes | Your Hipchat room name or ID number. This can also be an array of room names or numbers, and the message will be sent to all rooms. |
9 | | `message` | No | The message to send to the room. Default - `%PROJECT_TITLE% built at %BUILD_URI%` |
10 | | `color` | No | Message color. Valid values: yellow, green, red, purple, gray, random. Default - `yellow`|
11 | | `notify` | No | Whether or not this message should trigger a notification for people in the room (change the tab color, play a sound, etc). Default - `false`. |
12 |
13 | Message can be formatted via HTML. Example:
14 | ```html
15 | %PROJECT_TITLE% - build %BUILD% failed!
16 | ```
17 |
18 | Configuration example:
19 | ```yaml
20 | hipchat_notify:
21 | authToken: 123
22 | room: 456
23 | message: %PROJECT_TITLE% - build %BUILD% failed!
24 | color: red
25 | notify: true
26 | ```
27 |
--------------------------------------------------------------------------------
/docs/source/installing-phpci.md:
--------------------------------------------------------------------------------
1 | # Installing PHPCI
2 |
3 | ## What you'll need
4 |
5 | * PHP 5.3.6 or above
6 | * A web server (we recommend [nginx](http://nginx.org))
7 | * [Composer](https://getcomposer.org/download/)
8 | * [Git](http://git-scm.com/downloads)
9 | * A MySQL server to connect to. This doesn't have to be on the same server as PHPCI.
10 | * The following functions need to be enabled: `exec()`, `shell_exec()` and `proc_open()`
11 | * PHP must have OpenSSL support enabled.
12 |
13 | ## Installing PHPCI from Composer
14 |
15 | * Go to the directory in which you want to install PHPCI, for example: `/var/www`
16 | * Download Composer if you haven't already: `curl -sS https://getcomposer.org/installer | php`
17 | * Download PHPCI: `./composer.phar create-project block8/phpci phpci --keep-vcs --no-dev`
18 | * Go to the newly created PHPCI directory, and install Composer dependencies: `cd phpci && ../composer.phar install`
19 | * Run the PHPCI installer: `php ./console phpci:install`
20 | * [Add a virtual host to your web server](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.
21 | * [Set up the PHPCI Worker](Run-Builds-Using-a-Worker), or you can run builds using the [PHPCI daemon](Run-Builds-Using-a-Daemon) or [a cron-job](Run-Builds-Using-Cron) to run PHPCI builds.
22 |
23 | ## Installing PHPCI Manually
24 |
25 | * Go to the directory in which you want to install PHPCI, for example: `/var/www`
26 | * [Download PHPCI](https://github.com/Block8/PHPCI/releases/latest) and unzip it.
27 | * Go to the PHPCI directory: `cd /var/www/phpci`
28 | * Install dependencies using Composer: `composer install`
29 | * Install PHPCI itself: `php ./console phpci:install`
30 | * [Add a virtual host to your web server](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.
31 | * [Set up the PHPCI Worker](Run-Builds-Using-a-Worker), or you can run builds using the [PHPCI daemon](Run-Builds-Using-a-Daemon) or [a cron-job](Run-Builds-Using-Cron) to run PHPCI builds.
32 |
33 | ### Extended Guides
34 | - [Installing PHPCI on Mac OSX Mavericks](Vanilla-Mac-Mavericks-Server-Installation-Guide)
35 | - [Installing PHPCI on Mac OSX Yosemite](Vanilla-Installation-on-OS-X-10.10-Yosemite-with-OS-X-Server-4)
--------------------------------------------------------------------------------
/docs/source/interpolation.md:
--------------------------------------------------------------------------------
1 | # Variable Interpolation
2 |
3 | Most strings used in the build configuration can have variables related to the build inserted into them with the following syntax:
4 |
5 | "My important message is about %SOMETHING%"
6 |
7 | Where something can be one of the following:
8 |
9 |
10 | * **COMMIT** - The commit hash
11 | * **SHORT_COMMIT** - The shortened version of the commit hash
12 | * **COMMIT_EMAIL** - The email address of the committer
13 | * **COMMIT_MESSAGE** - The message written by the committer
14 | * **COMMIT_URI** - The URL to the commit
15 | * **BRANCH** - The name of the branch
16 | * **BRANCH_URI** - The URL to the branch
17 | * **PROJECT** - The ID of the project
18 | * **BUILD** - The build number
19 | * **PROJECT_TITLE** - The name of the project
20 | * **BUILD_PATH** - The path to the build
21 | * **BUILD_URI** - The URL to the build in PHPCI
--------------------------------------------------------------------------------
/docs/source/irc-plugin.md:
--------------------------------------------------------------------------------
1 | Connects to an IRC server and sends a defined message.
2 |
3 | ### Configuration Options:
4 |
5 | * **message** - Required - The message to send.
6 |
7 | ### Build Settings
8 |
9 | * **irc** - All child properties are required
10 | * **server** - IRC server to connect to.
11 | * **port** - IRC server port, defaults to 6667.
12 | * **room** - The room you wish to send your message to (must start with a #)
13 | * **nick** - The nickname you want the bot to use.
--------------------------------------------------------------------------------
/docs/source/lint-plugin.md:
--------------------------------------------------------------------------------
1 | This plugin runs PHP's built in Lint (syntax / error check) functionality.
2 |
3 | ## Configuration
4 | ### Options
5 | - **directory** [string, optional] - A single path in which you wish to lint files.
6 | - **directories** [array, optional] - An array of paths in which you wish to lint files. This overrides `directory`.
7 | - **recursive** [bool, optional] - Whether or not you want to recursively check sub-directories of the above (defaults to true).
8 |
9 | ### Example
10 | ```yml
11 | test:
12 | lint:
13 | directory: "single path to lint files"
14 | directories:
15 | - "directory to lint files"
16 | - "directory to lint files"
17 | - "directory to lint files"
18 | recursive: false
19 | ```
20 |
--------------------------------------------------------------------------------
/docs/source/logging.md:
--------------------------------------------------------------------------------
1 | # Basics
2 | 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.
3 |
4 | # How to Setup Logging (For people running a PHPCI instance)
5 | The only step required to activate logging is to create a file in the root directory called loggerconfig.php with content like the following:
6 |
7 | ```php
8 | function () {
12 | return array(
13 | new \Monolog\Handler\StreamHandler('path/to/log', \Monolog\Logger::ERROR),
14 | );
15 | }
16 | );
17 | ```
18 | This file should return an array of key value pairs. Each key tells phpci which command to attach the logger to (the underscore is a special value which matches all commands). For each command an array of [Monolog](https://github.com/Seldaek/monolog) handlers should be returned. In the example above we've used one that simply writes to the file system but in practise this could be any handler written for monolog.
19 |
20 | Once this file is created all plugins and core phpci functionality should start writing to the configured handlers.
21 |
22 | # How to write to the Log (For people creating a new plugin)
23 |
24 | ## Using the plugin constructor to get a logger directly
25 | 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:
26 | ```php
27 | class ExampleLoggingPlugin implements \PHPCI\Plugin
28 | {
29 | protected $log;
30 |
31 | public function __construct(Psr\Log\LoggerInterface $log)
32 | {
33 | $this->log = $log;
34 | }
35 |
36 | public function execute()
37 | {
38 | $this->log->notice("You'll notice this in the log");
39 | }
40 | }
41 | ```
42 |
43 | ## Using convenience methods provided by the Builder
44 | Your plugin can also call a couple of messages on the Builder object:
45 |
46 | logSuccess()
47 | logFailure()
48 | log()
49 |
50 | All calls will get piped through to the appropriate logger.
51 |
52 |
--------------------------------------------------------------------------------
/docs/source/mysql-plugin.md:
--------------------------------------------------------------------------------
1 | Connects to a given MySQL server and runs a selection of queries.
2 |
3 | ### Example Configuration:
4 |
5 | ```yaml
6 | build_settings:
7 | mysql:
8 | host: 'localhost'
9 | user: 'testuser'
10 | pass: '12345678'
11 |
12 | setup:
13 | mysql:
14 | - "CREATE DATABASE my_app_test;"
15 |
16 | complete:
17 | mysql:
18 | - "DROP DATABASE my_app_test;"
19 | ```
20 |
21 | Import SQL from file:
22 | ```yaml
23 | setup:
24 | mysql:
25 | import-from-file: # This key name doesn´t matter
26 | import:
27 | database: "foo" # Database name
28 | file: "/path/dump.sql" # Relative path in build folder
29 | ```
--------------------------------------------------------------------------------
/docs/source/package-build-plugin.md:
--------------------------------------------------------------------------------
1 | Builds a tar or zip archive of your build and places it in a directory of your choosing.
2 |
3 | ### Configuration Options:
4 |
5 | * **directory** - Required - Directory in which to put the package file.
6 | * **filename** - Required - File name for the package.
7 | * **format** - Required - `tar` or `zip`
8 |
9 | You can use following variables in filename:
10 |
11 | * %build.commit%
12 | * %build.id%
13 | * %build.branch%
14 | * %project.title%
15 | * %date%
16 | * %time%
--------------------------------------------------------------------------------
/docs/source/pdepend-plugin.md:
--------------------------------------------------------------------------------
1 | Runs [PDepend](http://pdepend.org/) software metrics.
2 |
3 | ### Configuration Options:
4 |
5 | * **directory** - Required - Directory in which to run PDepend.
--------------------------------------------------------------------------------
/docs/source/phar-plugin.md:
--------------------------------------------------------------------------------
1 | Allows you to create a [Phar](http://php.net/manual/en/book.phar.php) archive from your project.
2 |
3 | ### Example
4 |
5 | ```
6 | phar:
7 | directory: /path/to/directory
8 | filename: foobar.phar
9 | regexp: /\.(php|phtml)$/
10 | stub: filestub.php
11 | ```
12 |
13 | ### Configuration Options
14 |
15 | * **directory**: `phar` output directory. Default: `%buildpath%`;
16 | * **filename**: `phar` filename inside output directory. Default: `build.phar`;
17 | * **regexp**: regular expression for Phar iterator. Default: `/\.php$/`; and
18 | * **stub**: stub content filename. No default value.
--------------------------------------------------------------------------------
/docs/source/phing-plugin.md:
--------------------------------------------------------------------------------
1 | This plugin allows you to use the Phing build system to build your project.
2 |
3 | ### Configuration options:
4 | * **directory** - Relative path to the directory in which you want to run phing.
5 | * **build_file** - Your phing build.xml file.
6 | * **targets** - Which build targets you want to run.
7 | * **properties** - Any custom properties you wish to pass to phing.
8 | * **property_file** - A file containing properties you wish to pass to phing.
9 |
10 | ### Sample config:
11 | ```yml
12 | phing:
13 | build_file: 'build.xml'
14 | targets:
15 | - "build:test"
16 | properties:
17 | config_file: "PHPCI"
18 | ```
--------------------------------------------------------------------------------
/docs/source/php-code-sniffer-plugin.md:
--------------------------------------------------------------------------------
1 | Runs PHP Code Sniffer against your build.
2 |
3 | ## Configuration
4 | ### Options
5 | * **allowed_warnings** [int, optional] - The warning limit for a successful build.
6 | * **allowed_errors** [int, optional] - The error limit for a successful build.
7 | * **suffixes** [array, optional] - An array of file extensions to check.
8 | * **standard** [string, optional] - The standard against which your files should be checked (defaults to PSR2.)
9 | * **tab_width** [int, optional] - Your chosen tab width.
10 | * **encoding** [string, optional] - The file encoding you wish to check for.
11 | * **path** [string, optional] - Path in which to run PHP Code Sniffer.
12 | * **ignore** [array, optional] - A list of files / paths to ignore, defaults to the build_settings ignore list.
13 |
14 | ### Example
15 | Simple example where PHPCS will run on app directory, but ignore the views folder, and use PSR-1 and PSR-2 rules for validation:
16 | ```yml
17 | test:
18 | php_code_sniffer:
19 | path: "app"
20 | ignore:
21 | - "app/views"
22 | standard: "PSR1,PSR2"
23 | ```
24 |
25 | For use with an existing project:
26 | ```yml
27 | test:
28 | php_code_sniffer:
29 | standard: "/phpcs.xml" # The leading slash is needed to trigger an external ruleset.
30 | # Without it, PHPCI looks for a rule named "phpcs.xml"
31 | allowed_errors: -1 # Even a single error will cause the build to fail. -1 = unlimited
32 | allowed_warnings: -1
33 | ```
--------------------------------------------------------------------------------
/docs/source/php-coding-standards-fixer-plugin.md:
--------------------------------------------------------------------------------
1 | Runs PHP Coding Standards Fixer against your build.
2 |
3 | ## Configuration
4 | ### Options
5 | * **verbose** [bool, optional] - Whether to run in verbose mode (default: false)
6 | * **diff** [bool, optional] - Whether to run with the `--diff` flag enabled (default: false)
7 | * **level** [string, optional] - `psr0`, `psr1`, `psr2`, or `symphony` (default: all)
8 | * **workingdir** [string, optional] - The directory in which PHP CS Fixer should work (default: build root)
9 |
10 | ### Example
11 | ```yml
12 | test:
13 | php_cs_fixer:
14 | verbose: true
15 | diff: true
16 | level: "psr2"
17 | workingdir: "my/dir/path"
18 | ```
19 |
20 | ## Warning
21 | 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.
--------------------------------------------------------------------------------
/docs/source/php-copy-paste-detector-plugin.md:
--------------------------------------------------------------------------------
1 | Runs PHP Copy / Paste Detector against your build.
2 |
3 | ## Configuration
4 | ### Options
5 | * **path** - Optional - Path in which to run PHP Copy/Paste Detector (default: build root).
6 | * **ignore** - Optional - A list of files / paths to ignore (default: build_settings > ignore).
7 | * **standard** [string, optional] - which PSR standard to follow (default: 'PSR1').
8 |
9 | ### Example
10 |
11 | ```yml
12 | test:
13 | php_cpd:
14 | standard: "PSR2"
15 | path: "app"
16 | ignore:
17 | - "app/my/path"
18 | ```
19 |
--------------------------------------------------------------------------------
/docs/source/php-docblock-checker.md:
--------------------------------------------------------------------------------
1 | Runs the PHP Docblock Checker against your build. This tool verifies that all classes and methods have docblocks.
2 |
3 | ### Configuration Options:
4 |
5 | * **allowed_warnings** - Optional - The warning limit for a successful build.
6 | * **path** - Optional - Directory in which PHP Docblock Checker should run.
7 | * **skip_methods** - Optional - Tells the checker to ignore methods that don't have a docblock.
8 | * **skip_classes** - Optional - Tells the checker to ignore classes that don't have a docblock.
9 |
10 | ### Example config:
11 |
12 | ```yml
13 | php_docblock_checker:
14 | allowed_warnings: 10
15 | skip_classes: true
16 | ```
--------------------------------------------------------------------------------
/docs/source/php-loc-plugin.md:
--------------------------------------------------------------------------------
1 | Runs [PHPLoc](https://github.com/sebastianbergmann/phploc) against your project and records some key metrics.
2 |
3 | ## Configuration
4 | ### Options
5 | * **directory** - Optional - The directory in which phploc should run.
6 |
7 | ### Example
8 | 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.
9 |
10 | ```yml
11 | test:
12 | php_loc:
13 | directory: "app"
14 | ```
15 |
--------------------------------------------------------------------------------
/docs/source/php-mess-detector-plugin.md:
--------------------------------------------------------------------------------
1 | Runs PHP Mess Detector against your build. Records some key metrics, and also reports errors and warnings.
2 |
3 | ## Configuration
4 | ### Options
5 | - **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.
6 | - **suffixes** [array, optional] - An array of file extensions to check (default: 'php')
7 | - **ignore** [array, optional] - An array of files/paths to ignore (default: build_settings > ignore)
8 | - **path** [string, optional] - Directory in which PHPMD should run (default: build root)
9 | - **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']).
10 | - **zero_config** [bool, optional] - Suppresses build failure on errors and warnings if set to true. (default: false).
11 |
12 |
13 | ### Example
14 | ```yml
15 | test:
16 | php_mess_detector:
17 | path: 'app'
18 | ignore:
19 | - 'vendor'
20 | allowed_warnings: -1
21 | rules:
22 | - "cleancode"
23 | - "controversial"
24 | - "codesize"
25 | - "design"
26 | - "naming"
27 | - "unusedcode"
28 | - "somedir/customruleset.xml"
29 | zero_config: true
30 | ```
--------------------------------------------------------------------------------
/docs/source/php-parallel-lint-plugin.md:
--------------------------------------------------------------------------------
1 | Similar to the [standard PHP Lint plugin](Lint-plugin), except that it uses the [PHP Parallel Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint) project to run.
2 |
3 | ## Configuration
4 | ### Options
5 | * **directory** [string, optional] - directory to inspect (default: build root)
6 | * **ignore** [array, optional] - directory to ignore (default: inherits ignores specified in setup)
7 | * **extensions** [string, optional] - comma separated list of file extensions of files containing PHP to be checked (default: php)
8 |
9 | ### Example
10 | ```yml
11 | test:
12 | php_parallel_lint:
13 | directory: "app"
14 | ignore:
15 | - "vendor"
16 | - "test"
17 | extensions: php, html
18 | ```
19 |
--------------------------------------------------------------------------------
/docs/source/php-spec-plugin.md:
--------------------------------------------------------------------------------
1 | Runs [PHP Spec](http://www.phpspec.net/) tests against your build.
2 |
3 | ### Configuration Options:
4 |
5 | * **bootstrap** - Optional - Path to a PHPSpec bootstrap file.
6 |
7 | ### Example
8 |
9 | ```
10 | build_settings:
11 | [...]
12 |
13 | setup:
14 | [...]
15 |
16 | test:
17 | php_spec:
18 |
19 | complete:
20 | [...]
21 |
22 | success:
23 | [...]
24 | ```
--------------------------------------------------------------------------------
/docs/source/phpci-config.md:
--------------------------------------------------------------------------------
1 | **From email address:**
2 |
3 | If you want to change the from email address, where the application send emails from, than you are able to change the configuration in /phpci/PHPCI/config.yml like this:
4 |
5 | b8:
6 | database: { servers: { read: localhost, write: localhost }, name: example, username: example, password: example }
7 | phpci:
8 | url: 'http://phpci.example.com'
9 | email_settings:
10 | from_address: 'phpci@example.com'
--------------------------------------------------------------------------------
/docs/source/phpunit-plugin.md:
--------------------------------------------------------------------------------
1 | Runs PHPUnit tests against your build.
2 | ## Configuration
3 | ### Options
4 | Has two modes:
5 |
6 | #### phpunit.xml Configuration File
7 | Its activated if you have phpunit.xml file in your build path, `tests/` subfolder, or you specify it as a parameter:
8 | * **config** - Optional - Path to a PHP Unit XML configuration file.
9 | * **run_from** - Optional - When running PHPUnit with an XML config, the command is run from this directory
10 | * **coverage** - Optional - Value for the `--coverage-html` command line flag.
11 | * **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.
12 |
13 | #### Running Tests By Specifying Directory
14 | * **directory** - Optional - The directory (or array of dirs) to run PHPUnit on
15 |
16 | Both modes accept:
17 | * **args** - Optional - Command line args (in string format) to pass to PHP Unit
18 |
19 | ### Examples
20 | Specify config file and test directory:
21 | ```yml
22 | test:
23 | php_unit:
24 | config:
25 | - "path/to/phpunit.xml"
26 | path: "app/tests/"
27 | ```
28 |
29 | ## Troubleshooting
30 | 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
31 | * Run `composer update` in phpunit plugin directory of PHPCI to get all of its dependencies
32 | * If phpunit is inside of the project's composer.json, it might interfere with PHPCI's phpunit installation
33 | * Make sure you have XDebug installed.`The Xdebug extension is not loaded. No code coverage will be generated.`
34 | Otherwise test report parsing in `TapParser` will fail, wanting coverage report as well `Invalid TAP string, number of tests does not match specified test count.`
--------------------------------------------------------------------------------
/docs/source/postgresql-plugin.md:
--------------------------------------------------------------------------------
1 | Connects to a given PostgreSQL server and runs a list of queries.
2 |
3 | ### Example Configuration:
4 |
5 | ```yaml
6 | build_settings:
7 | pgsql:
8 | host: 'localhost'
9 | user: 'testuser'
10 | pass: '12345678'
11 |
12 | setup:
13 | pgsql:
14 | - "CREATE DATABASE my_app_test;"
15 |
16 | complete:
17 | pgsql:
18 | - "DROP DATABASE my_app_test;"
19 | ```
--------------------------------------------------------------------------------
/docs/source/project-status-images-and-page.md:
--------------------------------------------------------------------------------
1 | ### Status Image
2 | 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.
3 |
4 | You can find the status image at the following location: `http://{PHPCI URL}/build-status/image/{PROJECT ID}`
5 |
6 | So for example, our instance of PHPCI is at `phpci.block8.net`, and our PHPCI project ID is `2`, so the image URL is: `http://phpci.block8.net/build-status/image/2`.
7 |
8 | Example:
9 |
10 | 
11 |
12 | ### Status Page
13 | PHPCI also provides a public project status page, that is accessible for everyone.
14 |
15 | You can find the status page at the following location: `http://{PHPCI URL}/build-status/view/{PROJECT ID}`
16 |
17 | Example:
18 | http://phpci.block8.net/build-status/view/2
19 |
20 | #### Where do I find my project ID?
21 | 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.
22 |
23 | Example:
24 | http://phpci.block8.net/project/view/2 ~> PROJECT ID: `2`
25 |
26 | #### Enable/disable status image and page
27 | You can enable or disable access to the public status image and page in your project's settings.
--------------------------------------------------------------------------------
/docs/source/run-builds-using-a-daemon.md:
--------------------------------------------------------------------------------
1 | # Run Builds Using a Daemon
2 |
3 | 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.
4 |
5 | The daemon is also useful if you want to run multiple PHPCI workers in a virtualised environment (i.e. Docker)
6 |
7 | If you want to run PHPCI builds on a regular schedule instead, you should [set up a cron-job](Run-Builds-Using-Cron).
8 |
9 | ## Starting the Daemon
10 |
11 | On a Linux/Unix server, the following command will start the daemon and keep it running even when you log out of the server:
12 |
13 | ```sh
14 | nohup php ./daemonise phpci:daemonise >/dev/null 2>&1 &
15 | ```
16 |
17 | If you need to debug what's going on with your builds, you can also run the daemon directly using the following command, which will output the daemon's log directly to your terminal:
18 |
19 | ```sh
20 | php daemonise phpci:daemonise
21 | ```
--------------------------------------------------------------------------------
/docs/source/run-builds-using-cron.md:
--------------------------------------------------------------------------------
1 | # Run Builds Using Cron
2 |
3 | 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.
4 |
5 | If you want a little more control over how PHPCI runs, you may want to [set up the PHPCI daemon](Run-Builds-Using-a-Daemon) instead.
6 |
7 | ## Setting up the Cron Job
8 |
9 | You'll want to set up PHPCI to run as a regular cronjob, so run `crontab -e` and enter the following:
10 |
11 | ```sh
12 | * * * * * /usr/bin/php /path/to/phpci/console phpci:run-builds
13 | ```
14 |
15 | **Note:** Make sure you change the `/path/to/phpci` to the directory in which you installed PHPCI, and update the PHP path if necessary.
--------------------------------------------------------------------------------
/docs/source/shell-plugin.md:
--------------------------------------------------------------------------------
1 | Runs a given Shell command.
2 |
3 | **Note: ** Because this plugin could potentially be abused, it requires extra steps to enable it:
4 |
5 | 1. In the root of your PHPCI system, in the same directory where you'll find composer.json and vars.php, look for a file local_vars.php. If it does not exist, create it.
6 | 2. In local_vars.php add this code:
7 |
8 | ```php
9 | - <%BUILD_URI%|Build #%BUILD%> has finished for commit <%COMMIT_URI%|%SHORT_COMMIT% (%COMMIT_EMAIL%)> on branch <%BRANCH_URI%|%BRANCH%>` |
12 | | `show_status` | No | Whether or not to append the build status as an attachment in slack. Default - true
13 |
14 | Send a message if the build fails:
15 | ```yaml
16 | failure:
17 | slack_notify:
18 | webhook_url: "https://hooks.slack.com/services/R212T827A/G983UY31U/aIp0yuW9u0iTqwAMOEwTg"
19 | room: "#phpci"
20 | username: "PHPCI"
21 | icon: ":ghost:"
22 | message: "%PROJECT_TITLE% - build %BUILD% failed! :angry:"
23 | show_status: false
24 | ```
25 |
26 | Send a message if the build is successful:
27 | ```yaml
28 |
29 | success:
30 | slack_notify:
31 | webhook_url: "https://hooks.slack.com/services/R212T827A/G983UY31U/aIp0yuW9u0iTqwAMOEwTg"
32 | room: "#phpci"
33 | username: "PHPCI"
34 | icon: ":ghost:"
35 | message: "%PROJECT_TITLE% - build %BUILD% succeeded! :smiley:"
36 | show_status: false
37 | ```
38 |
39 | Send a message every time the build runs:
40 |
41 | ```yaml
42 | complete:
43 | slack_notify:
44 | webhook_url: "https://hooks.slack.com/services/R212T827A/G983UY31U/aIp0yuW9u0iTqwAMOEwTg"
45 | room: "#phpci"
46 | username: "PHPCI"
47 | icon: ":ghost:"
48 | message: "%PROJECT_TITLE% - build %BUILD% completed"
49 | show_status: true
50 | ```
--------------------------------------------------------------------------------
/docs/source/technical-debt-plugin.md:
--------------------------------------------------------------------------------
1 | Checks all files in your project for TODOs and other technical debt.
2 |
3 | ## Configuration Options:
4 |
5 | * **searches** - Optional - Case-insensitive array of terms to search for. Defaults to TODO, TO DO, FIXME and FIX ME.
--------------------------------------------------------------------------------
/docs/source/updating-phpci.md:
--------------------------------------------------------------------------------
1 | # Updating PHPCI
2 |
3 | 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.
4 |
5 | 1. Go to your PHPCI root folder in a Terminal.
6 | 2. Pull the latest code. On Linux and Mac this would look like this: `git pull`
7 | 3. Update the composer and its packages: `composer self-update && composer install`
8 | 4. Update the PHPCI database: `./console phpci:update`
9 | 5. Return to the PHPCI admin screens and check your desired plugins are still installed correctly.
10 | 7. Run a build to make sure everything is working as expected.
--------------------------------------------------------------------------------
/docs/source/xmpp-notifications-plugin.md:
--------------------------------------------------------------------------------
1 | ## Requirements
2 | - sendxmpp package
3 |
4 | ## Installation
5 | 1. On debian system (for example) use aptitude command to install sendxmpp
6 | 2. Add XMPP plugin in "complete" section of your phpci.yml
7 |
8 | ## Configuration options
9 | - username : Username of your XMPP sender account. (example : login@server.com)
10 | - password : Password of your XMPP sender account.
11 | - recipients : List of your XMPP recipents account.
12 | - server : If your server is not the same that your login server (optional, example : gtalk.google.com)
13 | - tls : Set 1 to enable TLS connection or 0 to disable it. (optional, default is 0)
14 | - alias : Alias of your sender account. (optional)
15 | - date_format : strftime mask date format display in notification message. (optional, default is %c of strftime function)
16 |
17 | ## Configuration example
18 |
19 | ```
20 | complete:
21 | xmpp:
22 | username: "login@gmail.com"
23 | password: "AZERTY123"
24 | recipients:
25 | - "recipient1@jabber.org"
26 | - "recipient2@jabber.org"
27 | server: "gtalk.google.com"
28 | tls: 1
29 | alias: "PHPCi Notification"
30 | date_format: "%d/%m/%Y"
31 | ```
--------------------------------------------------------------------------------
/loggerconfig.php.example:
--------------------------------------------------------------------------------
1 | function() {
14 | return array(
15 | new \Monolog\Handler\StreamHandler(__DIR__ . DIRECTORY_SEPARATOR . 'errors.log', \Monolog\Logger::ERROR),
16 | );
17 | },
18 | /** Loggers for the RunCommand */
19 | 'RunCommand' => function() {
20 | return array(
21 | new \Monolog\Handler\RotatingFileHandler(__DIR__ . DIRECTORY_SEPARATOR . 'everything',3, \Monolog\Logger::DEBUG),
22 | );
23 | },
24 | );
25 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "dependencies": {
4 | "admin-lte": "^2.4.8",
5 | "moment": "^2.22.2",
6 | "sprintf-js": "^1.1.1",
7 | "jquery-ui": "^1.12.1"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/phinx.php:
--------------------------------------------------------------------------------
1 | get('b8.database.servers.write');
14 |
15 | if (!is_array($writeServers)) {
16 | $writeServers = array($writeServers);
17 | }
18 |
19 | $conf = array(
20 | 'paths' => array(
21 | 'migrations' => 'PHPCI/Migrations',
22 | ),
23 |
24 | 'environments' => array(
25 | 'default_migration_table' => 'migration',
26 | 'default_database' => 'phpci',
27 | 'phpci' => array(
28 | 'adapter' => 'mysql',
29 | 'host' => end($writeServers),
30 | 'name' => $config->get('b8.database.name'),
31 | 'user' => $config->get('b8.database.username'),
32 | 'pass' => $config->get('b8.database.password'),
33 | ),
34 | ),
35 | );
36 |
37 | return $conf;
38 |
--------------------------------------------------------------------------------
/phpcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Codestyle ruleset for PHPCI
5 |
6 |
7 |
8 | PHPCI
9 |
10 |
11 |
12 |
13 | PHPCI/Migrations/*
14 | PHPCI/Model/Base/*
15 | PHPCI/Languages/*
16 | Tests/*
17 | vendor/*
18 |
19 |
20 |
--------------------------------------------------------------------------------
/phpmd.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 | PHPCI rule set
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 | ./Tests/PHPCI/Command
16 |
17 |
18 | ./Tests/PHPCI/Helper
19 |
20 |
21 | ./Tests/PHPCI/Logging
22 |
23 |
24 | ./Tests/PHPCI/Plugin
25 |
26 |
27 | ./Tests/PHPCI/Model
28 |
29 |
30 | ./Tests/PHPCI/Service
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/pluginconfig.php.example:
--------------------------------------------------------------------------------
1 | registerResource(
4 | // This function will be called when the resource is needed.
5 | function() {
6 | return array(
7 | 'Foo' => "Stuff",
8 | 'Bar' => "More Stuff"
9 | );
10 | },
11 |
12 | // In addition to the function for building the resource the system
13 | // also needs to be told when to load the resource. Either or both
14 | // of the following arguments can be used (null to ignore)
15 |
16 | // This resource will only be given when the argument name is:
17 | "ResourceArray",
18 |
19 | // The resource will only be given when the type hint is:
20 | PHPCI\Plugin\Util\Factory::TYPE_ARRAY
21 | );
22 | };
23 |
--------------------------------------------------------------------------------
/public/.htaccess.dist:
--------------------------------------------------------------------------------
1 |
2 | RewriteEngine On
3 | RewriteBase /
4 | RewriteCond %{REQUEST_FILENAME} !-f
5 | RewriteCond %{REQUEST_FILENAME} !-d
6 | RewriteRule . /index.php [L]
7 |
8 |
--------------------------------------------------------------------------------
/public/assets/css/AdminLTE-custom.css:
--------------------------------------------------------------------------------
1 | .phpci .main-header .logo, .phpci .main-header .logo:hover {
2 | background-image: url('/assets/img/logo-large.png');
3 | background-repeat: no-repeat;
4 | background-size: 40%;
5 | background-position: 65px;
6 | text-indent: -5000px;
7 | }
8 |
9 | .build-info-panel {
10 |
11 | }
12 |
13 | .build-info-panel .box-header h1.box-title {
14 | border: 0;
15 | font-size: 1.5em;
16 | font-weight: bold;
17 | margin-left: 110px;
18 | }
19 |
20 | .build-info-panel h1.box-title span {
21 | font-weight: normal;
22 | }
23 |
24 | .build-info-panel img {
25 | border: 2px solid #fff;
26 | border-radius: 50%;
27 | margin-top: -40px;
28 | }
29 |
30 | .build-info-panel #build-info {
31 | margin-left: 110px;
32 | min-height: 50px;
33 | }
34 |
35 | .build-info-panel .commit-message {
36 | margin-bottom: 20px;
37 | }
38 |
39 | .small-box h3 a, .small-box h4 a {
40 | color: #fff;
41 | }
42 |
43 | .pagination>li>span {
44 | font-weight: bold;
45 | background: #337ab7;
46 | color: #fff;
47 | }
48 |
49 | #plugins table td {
50 | max-width: 300px;
51 | overflow: hidden;
52 | text-overflow: ellipsis;
53 | }
54 |
55 | .small-box > .inner {
56 | border-bottom: 1px solid rgba(0, 0, 0, 0.15);
57 | }
58 |
59 | .small-box > .small-box-footer-project {
60 | width: 60%;
61 | float: left;
62 | }
63 | .small-box > .small-box-footer-build {
64 | width: 8%;
65 | float: left;
66 | }
67 | .small-box-minimal > .inner {
68 | width: 71%;
69 | float: left;
70 | }
71 | .small-box-minimal > .small-box-footer-build {
72 | width: 5%;
73 | border: 1px solid rgba(0, 0, 0, 0.15);
74 | margin-left: 1px;
75 | margin-top: 19px;
76 | font-size: 11px;
77 | }
78 |
79 | #phpunit-data th div { margin: 0 0.5em; }
80 | #phpunit-data .success td { background: none; color: #00a65a; }
81 | #phpunit-data .fail td { background: none; color: #f56954; }
82 | #phpunit-data .error td { background: none; color: #f56954; }
83 | #phpunit-data .skipped td { background: none; color: #e08e0b; }
84 | #phpunit-data .todo td { background: none; color: #00c0ef; }
85 |
86 | .ml20px {
87 | margin-left: 20px
88 | }
89 |
--------------------------------------------------------------------------------
/public/assets/css/ansi-colors.css:
--------------------------------------------------------------------------------
1 | .ansi_color_bg_black { background-color: #FFF }
2 | .ansi_color_bg_red { background-color: #900 }
3 | .ansi_color_bg_green { background-color: #090 }
4 | .ansi_color_bg_yellow { background-color: #990 }
5 | .ansi_color_bg_blue { background-color: #009 }
6 | .ansi_color_bg_magenta { background-color: #909 }
7 | .ansi_color_bg_cyan { background-color: #099 }
8 | .ansi_color_bg_white { background-color: #000 }
9 | .ansi_color_bg_brblack { background-color: #FFF }
10 | .ansi_color_bg_brred { background-color: #F00 }
11 | .ansi_color_bg_brgreen { background-color: #0F0 }
12 | .ansi_color_bg_bryellow { background-color: #FF0 }
13 | .ansi_color_bg_brblue { background-color: #00F }
14 | .ansi_color_bg_brmagenta { background-color: #F0F }
15 | .ansi_color_bg_brcyan { background-color: #0FF }
16 | .ansi_color_bg_brwhite { background-color: #000 }
17 |
18 | .ansi_color_fg_black { color: #FFF }
19 | .ansi_color_fg_red { color: #900 }
20 | .ansi_color_fg_green { color: #090 }
21 | .ansi_color_fg_yellow { color: #990 }
22 | .ansi_color_fg_blue { color: #009 }
23 | .ansi_color_fg_magenta { color: #909 }
24 | .ansi_color_fg_cyan { color: #099 }
25 | .ansi_color_fg_white { color: #000 }
26 | .ansi_color_fg_brblack { color: #FFF }
27 | .ansi_color_fg_brred { color: #F00 }
28 | .ansi_color_fg_brgreen { color: #0F0 }
29 | .ansi_color_fg_bryellow { color: #FF0 }
30 | .ansi_color_fg_brblue { color: #00F }
31 | .ansi_color_fg_brmagenta { color: #F0F }
32 | .ansi_color_fg_brcyan { color: #0FF }
33 | .ansi_color_fg_brwhite { color: #000 }
34 |
--------------------------------------------------------------------------------
/public/assets/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/public/assets/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/public/assets/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/public/assets/img/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/ajax-loader.gif
--------------------------------------------------------------------------------
/public/assets/img/ajax-loader1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/ajax-loader1.gif
--------------------------------------------------------------------------------
/public/assets/img/blur-background04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/blur-background04.jpg
--------------------------------------------------------------------------------
/public/assets/img/blur-background08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/blur-background08.jpg
--------------------------------------------------------------------------------
/public/assets/img/blur-background09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/blur-background09.jpg
--------------------------------------------------------------------------------
/public/assets/img/bootstrap-colorpicker/alpha-horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/bootstrap-colorpicker/alpha-horizontal.png
--------------------------------------------------------------------------------
/public/assets/img/bootstrap-colorpicker/alpha.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/bootstrap-colorpicker/alpha.png
--------------------------------------------------------------------------------
/public/assets/img/bootstrap-colorpicker/hue-horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/bootstrap-colorpicker/hue-horizontal.png
--------------------------------------------------------------------------------
/public/assets/img/bootstrap-colorpicker/hue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/bootstrap-colorpicker/hue.png
--------------------------------------------------------------------------------
/public/assets/img/bootstrap-colorpicker/saturation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/bootstrap-colorpicker/saturation.png
--------------------------------------------------------------------------------
/public/assets/img/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/favicon.png
--------------------------------------------------------------------------------
/public/assets/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/public/assets/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/public/assets/img/icon-build-failed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/icon-build-failed.png
--------------------------------------------------------------------------------
/public/assets/img/icon-build-ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/icon-build-ok.png
--------------------------------------------------------------------------------
/public/assets/img/icon-build-pending.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/icon-build-pending.png
--------------------------------------------------------------------------------
/public/assets/img/icon-build-running.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/icon-build-running.png
--------------------------------------------------------------------------------
/public/assets/img/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/icons.png
--------------------------------------------------------------------------------
/public/assets/img/logo-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/logo-icon.png
--------------------------------------------------------------------------------
/public/assets/img/logo-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/assets/img/logo-large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/logo-large.png
--------------------------------------------------------------------------------
/public/assets/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/logo.png
--------------------------------------------------------------------------------
/public/assets/img/sprite-skin-flat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/sprite-skin-flat.png
--------------------------------------------------------------------------------
/public/assets/img/sprite-skin-nice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/sprite-skin-nice.png
--------------------------------------------------------------------------------
/public/assets/img/user-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/user-bg.png
--------------------------------------------------------------------------------
/public/assets/img/user.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/user.jpg
--------------------------------------------------------------------------------
/public/assets/img/user2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dancryer/PHPCI/71ab3875ac822c8f138e4dddd045cc992229811e/public/assets/img/user2.jpg
--------------------------------------------------------------------------------
/public/assets/js/build-plugins/phpspec.js:
--------------------------------------------------------------------------------
1 | var phpspecPlugin = ActiveBuild.UiPlugin.extend({
2 | id: 'build-phpspec-errors',
3 | css: 'col-lg-12 col-md-12 col-sm-12 col-xs-12',
4 | title: Lang.get('phpspec'),
5 | lastData: null,
6 | displayOnUpdate: false,
7 | box: true,
8 | rendered: false,
9 |
10 | register: function() {
11 | var self = this;
12 | var query = ActiveBuild.registerQuery('phpspec', -1, {key: 'phpspec'})
13 |
14 | $(window).on('phpspec', function(data) {
15 | self.onUpdate(data);
16 | });
17 |
18 | $(window).on('build-updated', function() {
19 | if (!self.rendered) {
20 | self.displayOnUpdate = true;
21 | query();
22 | }
23 | });
24 | },
25 |
26 | render: function() {
27 |
28 | return $('
' +
29 | '' +
30 | '
' +
31 | '
'+Lang.get('suite')+'
' +
32 | '
'+Lang.get('test')+'
' +
33 | '
'+Lang.get('result')+'
' +
34 | '
' +
35 | '
');
36 | },
37 |
38 | onUpdate: function(e) {
39 | if (!e.queryData) {
40 | $('#build-phpspec-errors').hide();
41 | return;
42 | }
43 |
44 | this.rendered = true;
45 | this.lastData = e.queryData;
46 |
47 | var tests = this.lastData[0].meta_value;
48 | var tbody = $('#phpspec-data tbody');
49 | tbody.empty();
50 |
51 | for (var i in tests.suites) {
52 | var test_suite = tests.suites[i];
53 |
54 | for(var k in test_suite.cases){
55 | var test_case = test_suite.cases[k];
56 |
57 | var row = $(
58 | '