Magento and Continuous Integration - Damian Luszczymak

37
MAGENTO AND CONTINUOUS INTEGRATION

description

Magento and Continuous Integration, what you can do ! How you can use CI Systems with Magento and how to start. I show you one possible way to introduce this in small company's or even for your private project without much money.

Transcript of Magento and Continuous Integration - Damian Luszczymak

Page 1: Magento and Continuous Integration - Damian Luszczymak

MAGENTO AND CONTINUOUS INTEGRATION

Page 2: Magento and Continuous Integration - Damian Luszczymak

Damian Luszczymak● Freelancer● Magento since 2008● Father of Magento Hackathon● Firegento Member● Search, Import / Export

Page 3: Magento and Continuous Integration - Damian Luszczymak
Page 4: Magento and Continuous Integration - Damian Luszczymak
Page 5: Magento and Continuous Integration - Damian Luszczymak
Page 6: Magento and Continuous Integration - Damian Luszczymak
Page 7: Magento and Continuous Integration - Damian Luszczymak
Page 8: Magento and Continuous Integration - Damian Luszczymak
Page 9: Magento and Continuous Integration - Damian Luszczymak

Battle Plan

Page 10: Magento and Continuous Integration - Damian Luszczymak
Page 11: Magento and Continuous Integration - Damian Luszczymak
Page 12: Magento and Continuous Integration - Damian Luszczymak
Page 13: Magento and Continuous Integration - Damian Luszczymak
Page 14: Magento and Continuous Integration - Damian Luszczymak
Page 15: Magento and Continuous Integration - Damian Luszczymak
Page 16: Magento and Continuous Integration - Damian Luszczymak
Page 17: Magento and Continuous Integration - Damian Luszczymak

Coding Guidelines

Programming style is a set of rules or guidelines used when writing the source code for a computer program. It is often claimed that following a particular programming style will help programmers to read and understand source code conforming to the style, and help to avoid introducing errors.

Page 18: Magento and Continuous Integration - Damian Luszczymak

! phpcs !

● PEAR● PSR-1● PSR-2● Zend● …..

https://github.com/madedotcom/phpcs-magento-rules

Page 19: Magento and Continuous Integration - Damian Luszczymak
Page 20: Magento and Continuous Integration - Damian Luszczymak
Page 21: Magento and Continuous Integration - Damian Luszczymak
Page 22: Magento and Continuous Integration - Damian Luszczymak
Page 23: Magento and Continuous Integration - Damian Luszczymak

Git HookCheck if php syntax is correct

.git/hooks/pre-commit

#!/usr/bin/php

<?php

// Grab all added, copied or modified files into $output array

exec('git diff --cached --name-status --diff-filter=ACM', $output);

foreach ($output as $file) {

$fileName = trim(substr($file, 1));

// We only want to check PHP files

if (pathinfo($fileName,PATHINFO_EXTENSION) == "php") {

$lint_output = array();

// Check syntax with PHP lint

exec("php -l " . escapeshellarg($fileName), $lint_output, $return);

if ($return == 0) {

continue;

} else {

echo implode("\n", $lint_output), "\n";

exit(1);

}

}

}

exit(0);

Page 24: Magento and Continuous Integration - Damian Luszczymak

Know your IDE

Page 25: Magento and Continuous Integration - Damian Luszczymak

http://magicento.com

Page 26: Magento and Continuous Integration - Damian Luszczymak

PHPUnit → EcomDev● EcomDev/EcomDev_PHPUnit/

This extension was created especially for resolving this problem and promoting test driven development practices in Magento developers community. It doesn't change core files or brake your Magento instalment database, because all the system objects are replaced during the run-time with the test ones and a separate database connection is used for tests.

Page 27: Magento and Continuous Integration - Damian Luszczymak

CI

● Jenkins / Hudson● Codeship.io● Drone.io● Cloudbees.com● Circelci.com

Page 28: Magento and Continuous Integration - Damian Luszczymak
Page 29: Magento and Continuous Integration - Damian Luszczymak
Page 30: Magento and Continuous Integration - Damian Luszczymak
Page 31: Magento and Continuous Integration - Damian Luszczymak
Page 32: Magento and Continuous Integration - Damian Luszczymak
Page 33: Magento and Continuous Integration - Damian Luszczymak

Your journey just started

● Continues Deployment● Build Notifications● Github vs. Bitbucket vs. Private server● Modman● Composer (no git submodules available :-( )

Page 34: Magento and Continuous Integration - Damian Luszczymak
Page 35: Magento and Continuous Integration - Damian Luszczymak
Page 36: Magento and Continuous Integration - Damian Luszczymak

Twitter / IRC => @daim2k5

[email protected]

Page 37: Magento and Continuous Integration - Damian Luszczymak

Join Firegento ;-)