Skip to content

Instantly share code, notes, and snippets.

@kwmsmith
Forked from srossross/gist:1188971
Created September 20, 2011 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwmsmith/1229277 to your computer and use it in GitHub Desktop.
Save kwmsmith/1229277 to your computer and use it in GitHub Desktop.
Template to build a stable jenkins build
#Clean everything like a brand new checkout
#Don't remove "jenkins-upstream" directory
if test -t 1 ; then
echo "stdout is a tty. Are you sure you want to continue? This operation will clean any uncommitted files."
read -p "CTRL-C to exit. Enter to continue:"
fi
git clean -dxf -e "jenkins-upstream"
#Unlink any current development d
# echo `python setup.py develop -u`
#if EPD_INSTALL path is given then use it first
if [ -n "${EPD_INSTALL}" ]; then
export PATH=${EPD_INSTALL}/bin:$PATH
fi
#if WORKSPACE is not given then set it to '.'
if [ -z "${WORKSPACE}" ]; then
export WORKSPACE=`pwd`
fi
#We must set the PYTHONPATH env variable for a local install
export PYTHONPATH="${WORKSPACE}/install/lib/python2.7/site-packages":"$PYTHONPATH"
#If dependant projects have been built then intall the eggs into a local prefix
if [ -d "${WORKSPACE}/jenkins-upstream/" ]; then
egginst --prefix="${WORKSPACE}/install" "${WORKSPACE}/jenkins-upstream/"/*.egg
fi
###################################################################
##Choose one of the following #####################################
#Build this project in-place for the tests to run
python setup.py build_ext --inplace
# OR ##############################################################
#build the python egg for this project
#python setup.py bdist_egg
#Install project to a local install
#egginst --prefix="${WORKSPACE}/install" "${WORKSPACE}/dist/"/*.egg
#Change to a clean testing directory
#We done want to import from the local python package.
#cd "tests"
###################################################################
###################################################################
#Run the tests with coverage and unittest outputs
nosetests tests --with-xunit --xunit-file="${WORKSPACE}/nosetests.xml" --with-coverage
#Convert the coverage to xml format
coverage xml -o "${WORKSPACE}/coverage.xml"
#build the python egg for this project
python setup.py bdist_egg
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment