Slide 1

Slide 1 text

Prerequisites ● LAMP ● Web Server (Preferably running on virtual instance) ● Composer (In your $PATH) ● Git ● PHP shell_exec and exec must be enabled. Can be done from php.ini ● Must have mcrypt library ● A project with tests

Slide 2

Slide 2 text

Installation composer create-project block8/phpci testphpci --keep-vcs --no-dev

Slide 3

Slide 3 text

Expected Outcome ● A new folder called testphpci ● Contents of the folder

Slide 4

Slide 4 text

Folder Contents ● bootstrap.php ● composer.json ● composer.lock ● console ● daemon ● daemonise ● Dockerfile ● LICENSE.md ● listing.txt ● loggerconfig.php.example ● phinx.php ● PHPCI ● phpci.yml ● phpunit.xml ● pluginconfig.php.example ● public ● README.md ● Tests ● vars.php ● vendor ●

Slide 5

Slide 5 text

Add PHPCI To Localhost ● Edit hosts file ● Sudo vim /etc/hosts

Slide 6

Slide 6 text

Add PHP CI To Localhost ● Add the line ● ● 127.0.0.1 phpci.local

Slide 7

Slide 7 text

Add Conf file to Apache ● ● DocumentRoot /var/www/ci/testphpci/public ● ServerName phpci.local ● ● Allow From All ● RewriteEngine on ● RewriteCond %{REQUEST_FILENAME} !-f ● RewriteCond %{REQUEST_FILENAME} !-d ● RewriteRule ^(.*) index.php?url=$1 [L,QSA] ● ● ● # Other directives here ●

Slide 8

Slide 8 text

Restart Server ● Restart Apache to make sure that this works ● sudo service apache2 restart ● Make sure http://phpci.local/ works

Slide 9

Slide 9 text

Setup phpci ● Run ● ./console phpci:install

Slide 10

Slide 10 text

Still having issues? ● https://github.com/Block8/PHPCI/wiki/Installing- PHPCI

Slide 11

Slide 11 text

Composer permissions ● PHPCI uses composer to update plugins ● sudo chgrp www-data composer.json ● sudo chmod g+w composer.json ● sudo chgrp -R www-data PHPCI/ ● sudo chmod -R g+w PHPCI/ ● sudo chgrp -R www-data vendor/ ● sudo chmod -R g+w vendor/

Slide 12

Slide 12 text

Sample Project ● Clone the project ● https://github.com/PHPUG/Validation.git ● Add deploy keys to your account ● This get automatically generated

Slide 13

Slide 13 text

Project Configuration ● build_settings:: Project wide settings. Define infrastructure ● setup: Do any pre test work (Install dependencies?) ● test:Run the actual tests ● complete:Run post test work. (Remove Dependencies?) ● success: Send email? ● failure. Reject pull?

Slide 14

Slide 14 text

Sample ● build_settings: ● verbose: false ● prefer_symlink: false ● ● setup: ● ● test: ● php_unit: ● directory: "test/phpunit/" ● args: "--bootstrap 'test/phpunit/bootstrap.php' --configuration 'test/phpunit/phpunit.xml'" ● php_mess_detector: ● allow_failures: true ● ● complete:

Slide 15

Slide 15 text

Run Build ● Save the project and select to build now ● Run ./console phpci:run-builds from root of your phpci project ● You can also setup build to run as daemon or using crontab

Slide 16

Slide 16 text

Cron Method ● * * * * * /usr/bin/php /path/to/phpci/console phpci:run-builds

Slide 17

Slide 17 text

Daemon Method ● nohup php daemonise phpci:daemonise > daemon.log &