Test your applications against the nightly builds of Grails

One of the cool things the team at Sky used to do was to test the codebase against the latest nightly build of Grails.

This allowed us to quickly catch regressions or incompatibilities as soon as they were checked into Grails. 

Here is a bash script that you can add to Jenkins to do so for Grails 2.3.x 

#download grails nightly
export GRAILS_NIGHTLY="grails-2.3.2.BUILD-SNAPSHOT"
rm -rf $GRAILS_NIGHTLY.zip $GRAILS_NIGHTLY 
curl -O http://hudson.grails.org/job/grails_core_2.3.x/lastSuccessfulBuild/artifact/build/distributions/${GRAILS_NIGHTLY}.zip
unzip $GRAILS_NIGHTLY.zip

#install jar files into local maven repository
cd $GRAILS_NIGHTLY/dist
for f in *BUILD-SNAPSHOT.pom; 
do 
   mvn install:install-file -Dfile=${f/.pom/.jar} -DpomFile=$f 
done
cd ../../

#set environment variables
export GRAILS_HOME="$PWD/$GRAILS_NIGHTLY"
export PATH="$PATH:$GRAILS_HOME/bin"

#test grails app
grails upgrade --non-interactive
grails test-app --non-interactive

Set it to run once and day and you can guarantee that your code is compatible with changes that are happening within Grails.

Caution: Your project needs to be compatible with at least Grails 2.3.0 for this script to work as the versioning for the Tomcat and Hibernate plugins have changed from previous versions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s