PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1

CHAPTER 20 ■ CONTINUOUS INTEGRATION


failonerror="on"
output="${basedir}/build/builderror/index.txt">







In fact install-package is currently empty. That’s because it depends on another new target, make-
package, which must be run first. There I use an Ant task called exec to invoke the command pear
package. This looks for a file called package.xml in the ${basedir}/source/src directory. How do I know
that this will be there? That's thanks to the checkout target in the same file that calls Subversion and
updates userthing under ${basedir}/source.
I send any error messages to a file in a directory at build/builderror using the output attribute.
Other tasks use the build directory so it's already in place, but builderror is new, so I need to create it
from the command line.
Once I restart CruiseControl I should see no difference. Once again, I’ll only see the benefit when
things change. So, it’s time to create an error. Here I poison my package.xml file:


A sample package that demo's aspects of CI

Consisting of tests, code coverage, Subversion, etc

Once I’ve committed this, the pear package command will choke that wrong element there. It should
refuse to build the package. Because the exec element has a failonerror attribute set, the build will fail,
and CruiseControl should then alert the team.
Figure 20–10 shows the failed build in the CruiseControl Web interface.


Figure 20–10. The build fails

Free download pdf