Skip to content
Snippets Groups Projects
buildscript 3.26 KiB
Newer Older
#!/bin/bash -ex
###############################################################################
# LINUX/MAC SCRIPT TO DRIVE THE JENKINS BUILDS OF MANTID.
# WORKSPACE, JOB_NAME & NODE_LABEL are environment variables that are set by
# Jenkins. The last one corresponds to any labels set on a slave.
# BUILD_THREADS & PARAVIEW_DIR should be set in the configuration of each slave.
###############################################################################

###############################################################################
# OS X setup steps
###############################################################################
if [[ $(uname) == 'Darwin' ]]; then
  cd $WORKSPACE/Code
  ./fetch_Third_Party.sh
  # Setup environment variables
  source /opt/intel/bin/iccvars.sh intel64
  export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$WORKSPACE/Code/Third_Party/lib/mac64:/Library/Frameworks
  # Make sure we pick up the Intel compiler
  export CC=icc
  export CXX=icpc
fi
###############################################################################
# Check whether this is a clean build (must have 'clean' in the job name)
###############################################################################
if [[ ${JOB_NAME} == *clean* ]]; then
  CLEANBUILD=true
  # Removing the build directory entirely guarantees a completely clean build
  rm -rf $WORKSPACE/build
fi

###############################################################################
# RHEL6 setup steps - nodes must have a "rhel6" label set (in lowercase)
###############################################################################
if [[ ${NODE_LABELS} == *rhel6* ]]; then
  SCL_ON_RHEL6="scl enable mantidlibs"
else
  SCL_ON_RHEL6="eval"
fi

###############################################################################
# Create the build directory if it doesn't exist
###############################################################################
[ -d $WORKSPACE/build ] || mkdir $WORKSPACE/build
cd $WORKSPACE/build

###############################################################################
# CMake configuration
###############################################################################
$SCL_ON_RHEL6 "cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPACK=ON -DMAKE_VATES=ON -DParaView_DIR=${PARAVIEW_DIR} ../Code/Mantid"

###############################################################################
# Build step
###############################################################################
make -j$BUILD_THREADS
make -j$BUILD_THREADS AllTests

###############################################################################
# Run the tests
###############################################################################
# Remove any Mantid.user.properties file
rm -f ~/.mantid/Mantid.user.properties
ctest -j$BUILD_THREADS --schedule-random --output-on-failure -E MantidPlot
ctest --output-on-failure -R MantidPlot
###############################################################################
# Create the install kit if this is a clean build
###############################################################################
if [[ "$CLEANBUILD" == true ]]; then
  if [[ $(uname) != 'Darwin' ]]; then
    make -j$BUILD_THREADS qtassistant
  fi

  rm -f *.dmg *.rpm *.deb *.tar.gz
  cpack
fi