Skip to content

Commit

Permalink
[ADAM-1008] Modify jenkins-test script to support Java 8 build.
Browse files Browse the repository at this point in the history
Resolves #1008. As per discussion with @shaneknapp, it is preferable to support
builds across Java versions by manually setting JAVA_HOME in a shell script run
inside of Jenkins. This is due to certain configuration limitations inside of
Jenkins. Currently, we are doing this via a script tracked inside of Jenkins.
I would rather roll all of that config into the ./scripts/jenkins-test script
so that we have revision control, etc.
  • Loading branch information
fnothaft committed Apr 28, 2016
1 parent 6b28217 commit a9cc8f3
Showing 1 changed file with 85 additions and 59 deletions.
144 changes: 85 additions & 59 deletions scripts/jenkins-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,107 @@

set -e -x

export JAVA_HOME=/usr/java/jdk1.8.0_60
export PATH=${JAVA_HOME}/bin/:${PATH}

if [ ${SCALAVER} == 2.11 ];
then
echo "Rewriting POM.xml files for Scala 2.10."
./scripts/move_to_scala_2.11.sh
fi

which mvn

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$DIR/.."

VERSION="$(grep "<version>" "$PROJECT_ROOT/pom.xml" | head -2 | tail -1 | sed 's/ *<version>//g' | sed 's/<\/version>//g')"
echo "Testing ADAM version ${VERSION} on Spark ${SPARK_VERSION} and Hadoop ${HADOOP_VERSION}"

export MAVEN_OPTS="-Xmx1536m -XX:MaxPermSize=1g"
mvn test -P distribution -Dnetworkconnected -Dhadoop.version="${HADOOP_VERSION}" -Dspark.version="${SPARK_VERSION}"

ADAM_TMP_DIR="$(mktemp -d -t "adamTestXXXXXXX")"
# Just to be paranoid.. use a directory internal to the ADAM_TMP_DIR
ADAM_TMP_DIR="$ADAM_TMP_DIR/deleteMePleaseThisIsNoLongerNeeded"
mkdir "$ADAM_TMP_DIR"
# first, build the sources and run the unit tests
mvn clean package \
-Dhadoop.version=${HADOOP_VERSION} \
-Dspark.version=${SPARK_VERSION}

# if those pass, build the distribution package and the integration tests
mvn test \
-P distribution \
-Dnetworkconnected \
-Dhadoop.version="${HADOOP_VERSION}" \
-Dspark.version="${SPARK_VERSION}"

if [ ${SCALAVER} == 2.10 ];
then

pushd "$PROJECT_ROOT"
# Copy the jar into our temp space for testing
cp -r . "$ADAM_TMP_DIR"
popd
ADAM_TMP_DIR="$(mktemp -d -t "adamTestXXXXXXX")"
# Just to be paranoid.. use a directory internal to the ADAM_TMP_DIR
ADAM_TMP_DIR="$ADAM_TMP_DIR/deleteMePleaseThisIsNoLongerNeeded"
mkdir "$ADAM_TMP_DIR"

export SPARK_DRIVER_MEMORY=8g
pushd "$PROJECT_ROOT"
# Copy the jar into our temp space for testing
cp -r . "$ADAM_TMP_DIR"
popd

pushd "$ADAM_TMP_DIR"
export SPARK_DRIVER_MEMORY=8g

pushd "$ADAM_TMP_DIR"

if [[ $HADOOP_VERSION =~ ^1\.0 ]]; then
HADOOP=hadoop1
elif [[ $HADOOP_VERSION =~ ^2\.6 ]]; then
HADOOP=hadoop2.6
elif [[ $HADOOP_VERSION =~ ^2\.3 ]]; then
HADOOP=hadoop2.3
else
echo "Unknown Hadoop version."
exit 1
fi

SPARK="spark-${SPARK_VERSION}"

wget -q http://d3kbcqa49mib13.cloudfront.net/${SPARK}-bin-${HADOOP}.tgz
tar xzvf ${SPARK}-bin-${HADOOP}.tgz
export SPARK_HOME="${ADAM_TMP_DIR}/${SPARK}-bin-${HADOOP}"

ADAM="./bin/adam-submit"

echo "Fetching BAM file"
BAM=mouse_chrM.bam
READS="$BAM".reads.adam
SORTED_READS="$BAM".reads.sorted.adam
FRAGMENTS="$BAM".fragments.adam
rm -rf "$BAM"
wget -q https://s3.amazonaws.com/bdgenomics-test/"$BAM"
echo "Converting BAM to ADAM read format"
rm -rf "$READS"
"$ADAM" transform "$BAM" "$READS"
echo "Converting BAM to ADAM read format with sorting"
rm -rf "$SORTED_READS"
"$ADAM" transform -sort_reads "$READS" "$SORTED_READS"
echo "Converting read file to fragments"
rm -rf "$FRAGMENTS"
"$ADAM" reads2fragments "$READS" "$FRAGMENTS"
echo "Printing reads and fragments"
"$ADAM" print "$READS" 1>/dev/null 2>/dev/null
"$ADAM" print "$FRAGMENTS" 1>/dev/null 2>/dev/null
echo "Printing read statistics"
"$ADAM" flagstat -print_metrics "$READS"
rm -rf "$ADAM_TMP_DIR"
popd

pushd "$PROJECT_ROOT"
./scripts/format-source
if test -n "$(git status --porcelain)"
then
if [[ $HADOOP_VERSION =~ ^1\.0 ]]; then
HADOOP=hadoop1
elif [[ $HADOOP_VERSION =~ ^2\.6 ]]; then
HADOOP=hadoop2.6
elif [[ $HADOOP_VERSION =~ ^2\.3 ]]; then
HADOOP=hadoop2.3
else
echo "Unknown Hadoop version."
exit 1
fi

SPARK="spark-${SPARK_VERSION}"

wget -q http://d3kbcqa49mib13.cloudfront.net/${SPARK}-bin-${HADOOP}.tgz
tar xzvf ${SPARK}-bin-${HADOOP}.tgz
export SPARK_HOME="${ADAM_TMP_DIR}/${SPARK}-bin-${HADOOP}"

ADAM="./bin/adam-submit"

echo "Fetching BAM file"
BAM=mouse_chrM.bam
READS="$BAM".reads.adam
SORTED_READS="$BAM".reads.sorted.adam
FRAGMENTS="$BAM".fragments.adam
rm -rf "$BAM"
wget -q https://s3.amazonaws.com/bdgenomics-test/"$BAM"
echo "Converting BAM to ADAM read format"
rm -rf "$READS"
"$ADAM" transform "$BAM" "$READS"
echo "Converting BAM to ADAM read format with sorting"
rm -rf "$SORTED_READS"
"$ADAM" transform -sort_reads "$READS" "$SORTED_READS"
echo "Converting read file to fragments"
rm -rf "$FRAGMENTS"
"$ADAM" reads2fragments "$READS" "$FRAGMENTS"
echo "Printing reads and fragments"
"$ADAM" print "$READS" 1>/dev/null 2>/dev/null
"$ADAM" print "$FRAGMENTS" 1>/dev/null 2>/dev/null
echo "Printing read statistics"
"$ADAM" flagstat -print_metrics "$READS"
rm -rf "$ADAM_TMP_DIR"
popd

pushd "$PROJECT_ROOT"
./scripts/format-source
if test -n "$(git status --porcelain)"
then
echo "Please run './scripts/format-source'"
exit 1
fi
popd

fi
popd

echo
echo "All the tests passed"
Expand Down

0 comments on commit a9cc8f3

Please sign in to comment.