Hudson and Cruise Control are very popular among Java/.Net developers but when it comes to Python, …
Hudson also seems to work on python!. Open source tools for Python continuous integration:
However, I just want a simple way to check out the code and run the tests. A Bash script and the Cron daemon is a good solution so far (last script update on Wed 25 Feb 2008):
cd /root/siga/src
export DJANGO_SETTINGS_MODULE="settings"
export PYTHONPATH=":/root/siga/src"
mailTo="developer1@sample.com, developer2@whatever.com"
analize_tests_output ()
{
grep "FAIL:" $1 > failResults
if [[ $? == 0 ]]
then
echo "There are tests failing!:" > tmp
cat failResults >> tmp
mail -s "Continuous integration report" $mailTo < tmp
fi
grep "ERROR:" $1 > errorResults
if [[ $? == 0 ]]
then
echo "There are tests with errors!:" > tmp
cat failResults >> tmp
mail -s "Continuous integration report" $mailTo < tmp
return
fi
rm -rf $1
}
are_there_changes()
{
svn up > tmpsvnup
grep "^U" tmpsvnup 2> /dev/null > /dev/null
if [[ $? == 0 ]]
then
return 1
fi
grep "^A" tmpsvnup 2> /dev/null > /dev/null
if [[ $? == 0 ]]
then
return 1
fi
grep "^D" tmpsvnup 2> /dev/null > /dev/null
if [[ $? == 0 ]]
then
return 1
fi
grep "^G" tmpsvnup 2> /dev/null > /dev/null
if [[ $? == 0 ]]
then
return 1
fi
return 0
}
are_there_changes
changes=$?
if [[ $changes == 1 ]] # there are svn changes
then
/etc/init.d/wservices stop
sleep 2
/etc/init.d/wservices start
# running unittests tests and mocker tests
python tests/runTests.py >> tmptest1 2>> tmptest1
analize_tests_output tmptest1
# runnin django tests
python manage.py test core 2>> tmptest2 >> tmptest2
analize_tests_output tmptest2
fi
The cron file:
# m h dom mon dow command
49 * * * * root /root/siga/src/integrator.sh