Lightweight continuous integration

2009 November 10

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. :-)

Bodo baggert

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_build or 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 indicatorUpdate: 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. (Click, if you’re in the university subnet.)

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.

Grr is now part of the GNUstep Application Project

2009 October 16
by guenthernoack
Grr RSS Reader

I’m happy to announce that the Grr RSS Reader application is now part of the GNUstep Application Project (GAP).

Grr running on the Letux 400 netbook. -- Image shamelessly copied from Riccardo Mottola's weblog :-)

Grr running on the Letux 400 netbook. -- Image shamelessly copied from Riccardo Mottola's weblog :-) (Click!)

Riccardo Mottola’s announcement: http://multixden.blogspot.com/2009/10/grr-rss-to-go-on-gnustep.html

Garbage Collectors

2009 October 8
by guenthernoack

Garbage. I need to illustrate more. :-)
A great introduction to garbage collectors: “Storage Management, cont’d” (Paul Hilfinger). It was fun to figure out how to implement this. Just a short link, I didn’t want this to get lost in my twitter stream. :-)

More links:

Lessons learned: My first C program with a void***. Should have used more unions. Just about 200 lines of C, a working stop-and-copy garbage collector. :-) A fun hack, but hard to test. It’s probably buggy. ;-)

Subversion-aware bash prompts

2009 October 6
by guenthernoack

This is a handy trick to see whether you’re in a directory managed by version control or not.
shell

To enable this prompt, I use the following code snippet (in my .bashrc file):

pimpmyprompt() {
  if test -d `pwd`/.svn ; then
    pwd | sed -e "s#^$HOME/*# #" -e "s#/.*\$##"
  fi
}

export PS1="\u\e[0;32m\$(pimpmyprompt)\e[m:\w$ "

Note: This will always print the name of the first path component after $HOME, which is not necessarily a SVN working copy.

Update: Also have a look at Frank’s hint in the comments, which looks quite useful for when the customizations start to grow. :-)

Authentification tricks with htaccess

2009 September 26
by guenthernoack

Here’s a neat trick with htaccess files: The page on my diploma thesis should be available to everyone within my university subnet, and to selected people from outside, who may authenticate using usernames and passwords.

This .htaccess file seems to work for it:

AuthUserFile "/home/guenther/htpasswd"
AuthName "Only visible from the TU Kaiserslautern subnet or with username (ask me for it)"
AuthType Basic

Satisfy any

order deny,allow
deny from all
allow from 131.246.

Require valid-user

From the outside, you’re asked for a password, from inside the subnet, you can see it without password. Works. :-)