MAGENTO AND CONTINUOUS INTEGRATION
Damian Luszczymak● Freelancer● Magento since 2008● Father of Magento Hackathon● Firegento Member● Search, Import / Export
Battle Plan
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.
! phpcs !
● PEAR● PSR-1● PSR-2● Zend● …..
https://github.com/madedotcom/phpcs-magento-rules
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);
Know your IDE
http://magicento.com
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.
CI
● Jenkins / Hudson● Codeship.io● Drone.io● Cloudbees.com● Circelci.com
Your journey just started
● Continues Deployment● Build Notifications● Github vs. Bitbucket vs. Private server● Modman● Composer (no git submodules available :-( )
Join Firegento ;-)