#!/bin/bash # # This will run unit test coverage tests on all Java packages with unit tests. # export PATH=${NDK}:${JAVA_HOME}/bin:/usr/local/bin:/usr/bin:/bin # enable this via Jenkins but also need libeye/etc. to do similar MVN_REPO="" MVN_REPO=-Dmaven.repo.local=$WORKSPACE/.m2 export MVN_REPO # so that Makefiles will use MVN_PROJECTS_1="dtcore dtcs dtdb dtservlet javacore javaweb sgsl-dataflow sli robot configuration sleds-core-api" # If the OUTPUT_PATH variable is not already set, # presumably because this this job is being invoked by a human rather than by another job, # set it now. #if [ "${OUTPUT_PATH}_" == "_" ]; then # OUTPUT_PATH="${BRANCH_NAME}/${BUILD_TIMESTAMP}" #fi #DISKSTATION_MOUNT_POINT=${JENKINS_HOME}/diskstation_builds #OUTPUT_FOLDER=${DISKSTATION_MOUNT_POINT}/${OUTPUT_PATH} #mkdir -p ${OUTPUT_FOLDER} #chmod a+rw ${OUTPUT_FOLDER} # comment this out to debug this script set +x # this or /dev/null #REDIR=" > /dev/null" REDIR="" # Build and deploy the first set of projects... echo ============================================================================================== ${REDIR} echo ================================= RUNNING COVERAGE ANALYSIS ================================== ${REDIR} echo ============================================================================================== ${REDIR} for project in ${MVN_PROJECTS_1} do echo ============================================================================================== ${REDIR} echo ====================================== ANALYZING $project ==================================== ${REDIR} echo ============================================================================================== ${REDIR} cd ${WORKSPACE}/${project} mvn ${MVN_REPO} -DskipTests compile mvn ${MVN_REPO} org.pitest:pitest-maven:mutationCoverage -DwithHistory site cd target/site/pit-reports; jar -cvf ../../pit-reports.jar * done cd ${WORKSPACE} if [ "${DEPLOY_DOCS}_" != "_" ]; then HTML_FOLDER="/var/www/html/development/pit-reports" ssh jenkins@docserv.sl.int "mkdir -p ${HTML_FOLDER}" echo ============================================================================================== ${REDIR} echo =================================== DEPLOYING DOCUMENTATION ================================== ${REDIR} echo ============================================================================================== ${REDIR} # Deploy documentation to docserv... for project in ${MVN_PROJECTS_1} do echo ============================================================================================== ${REDIR} echo ========================== Deploying documentation for $project ============================== ${REDIR} echo ============================================================================================== ${REDIR} cd ${WORKSPACE}/${project} ssh jenkins@docserv.sl.int "mkdir -p ${HTML_FOLDER}/${project}" scp target/pit-reports.jar jenkins@docserv.sl.int:${HTML_FOLDER}/${project} ssh jenkins@docserv.sl.int "cd ${HTML_FOLDER}/${project}/; jar -xvf *.jar" done # Build the "master" index file... cd ${WORKSPACE}/masterbuild scp updateCodeCoverageMasterIndex.pl jenkins@docserv.sl.int:/var/www/html/development/ ssh jenkins@docserv.sl.int "perl /var/www/html/development/updateCodeCoverageMasterIndex.pl /var/www/html/development/pit-reports" fi echo ============================================================================================== ${REDIR} echo ========================================= DONE! ============================================== ${REDIR} echo ============================================================================================== ${REDIR}