0

I've installed PHPCI and have added a project named 'myproject' in PHPCI for testing. It is asked that I should include a 'phpci.yml' file in the root directory of the project. Here is how this 'phpci.tml' file should look like:

Click here to see the file pattern. Which part of this file should I edit to include it in my project as myproject's description as given below?

  1. Project root direcotry: myproject
  2. database name: mydb
  3. database user: root
  4. database pass: secret
  5. host: localhost

Can some one please help me in this regard?

Waqar Alamgir
  • 9,828
  • 4
  • 30
  • 36
Khuram
  • 1,820
  • 1
  • 26
  • 33

1 Answers1

1

First you need to create phpci.yml file in your project's root directory, in your case it will be myproject/phpci.yml . This file contains configuration and usage of plugins. You might also need those plugins in your project for PHP-CI to test build. Use composer to to include those plugins in your project. To do that add another file in your project's root directory myproject/composer.json.

This happens when PHP-CI cannot find a plugin from its own directory, then it uses project's vendor directory to execute those plugins.

Example File/Config Format:

Suppose you have directory structure like this:

  • ./myproject/
  • ./myproject/protected/
  • ./myproject/assets/
  • ./myproject/protected/runtime/

and you want to run PHP-CI on ./myproject/protected/ while looking to skip ./myproject/assets/ & ./myproject/protected/runtime/ directories then your phpci.yml will look like this:

phpci.yml

build_settings:
    ignore:
        - "assets"
        - "protected/runtime/"
setup:
    composer:
        action: "install"
test:
    php_parallel_lint:
        directory: "protected"
        ignore:
            - "assets"
            - "protected/runtime"
    php_code_sniffer:
        path: "protected"
        ignore:
            - "assets"
            - "protected/runtime"
        standard: "code-sniffer-settings.xml"
        allowed_errors: 10
        allowed_warnings: 10
    php_unit:
        config:
            - "protected/tests/phpunit.xml"
        args: "--stderr"
        path: "protected/tests/unit"
    php_cpd:
        allow_failures: true
        path: "protected"
        ignore:
            - "assets"
            - "protected/runtime"
    php_docblock_checker:
        allowed_warnings: -1
        path: "protected"
        ignore:
            - "assets"
            - "protected/runtime"
    php_loc:
        directory: "protected"
    pdepend:
        directory: "protected"

composer.json

{
    "require-dev": {
        "squizlabs/php_codesniffer": "2.*",
        "sebastian/phpdcd": "*",
        "phpmd/phpmd" : "@stable",
        "phpunit/phpunit": "4.0.*",
        "sebastian/phpcpd": "*",
        "jakub-onderka/php-parallel-lint": "0.*",
        "phpunit/php-code-coverage": "2.0.0",
        "pdepend/pdepend": "2.2.2"
    }
}

As to answer your question:

Which part of this file should I edit to include it in my project

Change test: section in phpci.yml and remove extra plugins that you don't want to be executed by PHP-CI, while leave composer section as it is, PHP-CI will run composer automatically on its own when testing a build.

Waqar Alamgir
  • 9,828
  • 4
  • 30
  • 36
  • Thanks Waqar for your such informative answer. I've got it. Thanks for this help. Now one more thing is that: 1. What if I want that my commits should get deployed automatically from my bit bucket repo to my staging server with PHP CI whenever I commit from my local repo? 2. and the build must get started automatically instead of I manually build each time? Can you plz guide me in this regard or suggest some helpful docs or podcasts on this? – Khuram Dec 05 '15 at 04:06
  • 1
    and what If I only want to deploy (not test the code) my commits automatically to from my bit bucket repo to my staging server? – Khuram Dec 05 '15 at 04:11
  • As far as I'm aware, PHP-CI doesn't provide deployment functionality. It can run/test build if you commit anything in your git but it won't deploy. Check here https://github.com/Block8/PHPCI/wiki/Autobuilding-From-GitHub More details to understand automatic deployment through git to any server look here https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps You can also use Capistrano for build deployment http://capistranorb.com/ – Waqar Alamgir Dec 05 '15 at 11:54