Lightweight continuous integration
10Nov2009
For my diploma thesis, I use a simple continuous integration system. It doesn't keep logs except mailing me, but it works fine for the simple one-person setup I have. :-)
![]() |
| Wer baggert da so spät noch am Baggerloch? |
Advantages:
- Makes sure my project can be checked out from SVN and then "just works" using Ant.
- ...so everything is checked into SVN.
- ...it builds using Ant (I usually use Eclipse)
- ...there are no rogue dependencies from production code to test.1
- ...and it's harder for me to forget how to setup the project, of course. :-)
How to do it:
- Create a new SVN checkout (Git clone, Perforce Client, ...) into a directory named
continuous_buildor similar. - In this directory, create a shell script like the one shown below.
- To your (user) crontab, add the line
00,15,30,45 * * * * cd /home/guenther/continuous_build/ && sh continuous_integration.sh(Note that crontab automatically sends the script's output to the user via email.)
![]() |
| Web-based build status indicator |
Update: I just couldn't resist to hack this together as well: Have a look at the new build status indicator on my diploma thesis homepage. [edit 2013: The indicator is dysfunctional now, but it worked like a charm; you have to take my word for it :)]
Here's the source code for continuous_integration.sh:
#!/bin/sh
# Run from same directory!
# JSR 308
export JSR308=`pwd`/jsr308
echo "================================="
echo " Configuration"
echo "================================="
echo "JSR308 : $JSR308"
echo "JAVA_HOME: $JAVA_HOME"
echo "PATH : $PATH"
echo "================================="
echo " SVN Update"
echo "================================="
svn up
cd jsr308/checkers
echo "================================="
echo " Clean"
echo "================================="
ant clean
echo "================================="
echo " Build"
echo "================================="
if ant all-tests; then
echo "WIN"
DISPLAY=":0.0" xsetroot -solid black
else
echo "FAIL"
DISPLAY=":0.0" xsetroot -solid red
killall rhythmbox
mplayer -really-quiet /usr/share/sounds/ubuntu/stereo/dialog-error.ogg > /dev/null 2> /dev/null
fi
Insert whatever it needs to draw your attention in the "fail" block. :-)
Footnotes
1. I regularly fall for this one. Eclipse doesn't check it, and sometimes I just forget to hit Ctrl-Shift-O after cleaning up.

