Continuous integration is referred to as CI, continuous integration is frequent, continuous integration in the work of multiple team members, and give feedback. A typical continuous integration cycle consists of the following steps:
1. The Continuous Integration server constantly checks the code status from the version control server to see if the code is updated.
2. If you find that the code has the latest commit, download the latest code from the version control server.
3. After the code is completely updated, call the automated compilation script to compile the code.
4. Run all the automated tests.
5. Perform code analysis.
6. Produce executable software that can be provided to testers for testing.
Continuous integration server, such as CruiseControl or VSTS
CruiseControl, Anthill, Bamboo, TeamCity, Continuum,hudson
An open source, continuous inheritance environment: Jenkins
Here's a look at the installation of this software, Ubuntu 11.10 Environment for example
First, install Jenkins
To the official website to download, install, very simple, he himself integrated a Java environment and server, a package to solve the problem
Installing the Integration tools
1. Installation: ANT
sudo apt-get install ant
2. Installation: Pear
sudo apt-get install Php-pear
3. Installation: Xdebug
4. Installation: PHPUnit
sudo pear channel-discover pear.phpunit.de
sudo pear install Phpunit/phpunit
5. Installation: Php_codesniffer
sudo pear install Php_codesniffer
Iv. Creation of tasks
- Download Template configuration:
CD $JENKINS _home/jobsgit clone Git://github.com/sebastianbergmann/php-jenkins-template.git php-templatechown-r Jenkins:nogroup php-template/
- Restart the Jenkins CLI:
Java-jar jenkins-cli.jar-s http://localhost:8080 reload-configuration
- Creates a new task.
- Enter a task name.
- Select Copy from an existing task
- Cancels the "Disable Build" option.
- Fill in the relevant information.
- Fill in the relevant SVN information.
- Save
Here is the project Build.xml file (currently we use the configuration)
==========build.xml============
<?xml version= "2.0″encoding=" utf-8″?>
<project name= "Name-of-project" default= "Build" >
<target name= "Build"
depends= "PREPARE,LINT,PHPLOC,PHPCS-CI,PHPUNIT,PHPCB"/>
<target name= "Build-parallel"
depends= "PREPARE,LINT,TOOLS-PARALLEL,PHPUNIT,PHPCB"/>
<target name= "Tools-parallel"
Description= "Run tools in parallel" >
<parallel threadcount= "2″>
<antcall target= "Phpcs-ci"/>
<antcall target= "Phploc"/>
</parallel>
</target>
<target name= "clean" description= "Cleanup build Artifacts" >
<delete dir= "${basedir}/build/api"/>
<delete dir= "${basedir}/build/code-browser"/>
<delete dir= "${basedir}/build/coverage"/>
<delete dir= "${basedir}/build/logs"/>
</target>
<target name= "Prepare" depends= "clean"
description= "Prepare for Build" >
<mkdir dir= "${basedir}/build/api"/>
<mkdir dir= "${basedir}/build/code-browser"/>
<mkdir dir= "${basedir}/build/coverage"/>
<mkdir dir= "${basedir}/build/logs"/>
</target>
<target name= "Lint" >
<apply executable= "PHP" failonerror= "true" >
<arg value= "-L"/>
<fileset dir= "${basedir}" >
<include name= "**/*.php"/>
<modified/>
</fileset>
<fileset dir= "${basedir}/_test" >
<include name= "**/*.php"/>
<modified/>
</fileset>
</apply>
</target>
<target name= "Phploc" description= "Measure Project size using Phploc" >
<exec executable= "Phploc" >
<arg value= "–log-csv"/>
<arg value= "${basedir}/build/logs/phploc.csv"/>
<arg path= "${basedir}"/>
</exec>
</target>
<target name= "Phpcs-ci"
description= "Find coding standard violations using Php_codesniffer creating a log file for the continuous integration serv ER ">
<exec executable= "Phpcs" output= "/dev/null" >
<arg value= "–report=checkstyle"/>
<arg value= "–report-file=${basedir}/build/logs/checkstyle.xml"/>
<arg value= "–standard=mystandard"/>
<arg value= "–ignore=${basedir}/wind,${basedir}/_test,${basedir}/configs,${basedir}/www,${basedir}/data,${ Basedir}/library/utility/safehtml,${basedir}/library/utility/soap "/>
<arg path= "${basedir}"/>
</exec>
</target>
============end===============
Configuration of the PHPUnit
============phpunit.xml=============
<?xml version= "1.0″encoding=" utf-8″?>
<phpunit bootstrap= "_test/bootstrap.php" backupglobals= "false" backupstaticattributes= "false" strict= "true" Verbose= "true" >
<testsuites>
<testsuite name= "BankAccount" >
<directory suffix= "test.php" >_test/market</directory>
</testsuite>
</testsuites>
<logging>
<log type= "Coverage-clover" target= "Build/logs/clover.xml"/>
<log type= "coverage-html" target= "Build/coverage" title= "BankAccount"/>
<log type= "JUnit" target= "Build/logs/junit.xml" logincompleteskipped= "false"/>
</logging>
</phpunit>
============end=================
Enter Jenkins's task directory, typically in:/var/lib/jenkins/jobs/
Enter the specified Job/workspace directory
Replace the Build.xml and Phpunit.xml files in the directory
Restart Jenkins
Reference: Http://avnpc.com/pages/php-open-source-project-plus-travis-ci
Http://blog.windcache.com/archives/5
http://blog.csdn.net/wanghantong/article/details/40985653
Continuous integration (continuous integration)