add jenkins build scripts

This commit is contained in:
Arne Morten Kvarving 2016-04-04 17:35:23 +02:00
parent 8c9b17b943
commit edd54ea4f4
4 changed files with 157 additions and 0 deletions

26
jenkins/README.md Normal file
View File

@ -0,0 +1,26 @@
# opm-autodiff jenkins build scripts:
**build-opm-autodiff.sh**:
This is a helper script which contains functions for building,
testing and cloning opm-autodiff and its dependencies.
**build.sh**:
This script will build dependencies, then build opm-autodiff and execute its tests.
It is intended for post-merge builds of the master branch.
**build-pr.sh**:
This script will build dependencies, then build opm-autodiff and execute its tests.
It inspects the $ghbPrBuildComment environmental variable to obtain a pull request
to use for ert, opm-common, opm-parser, opm-material, opm-core and
dune-cornerpoint (defaults to master) and then builds $sha1 of opm-autodiff.
It is intended for pre-merge builds of pull requests.
You can optionally specify a given pull request to use for ert, opm-common,
opm-parser, opm-material, opm-core and dune-cornerpoint through the trigger.
The trigger line needs to contain ert=<pull request number> and/or
opm-common=<pull request number> and/or opm-parser=<pull request number>
and/or opm-material=<pull request number>
and/or opm-core=<pull request number>
and/or dune-cornerpoint=<pull request number>
and/or opm-output=<pull request number>.

61
jenkins/build-opm-autodiff.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
function build_opm_autodiff {
# Build ERT
pushd .
mkdir -p $WORKSPACE/deps/ert
cd $WORKSPACE/deps/ert
git init .
git remote add origin https://github.com/Ensembles/ert
git fetch origin $ERT_REVISION:branch_to_build
test $? -eq 0 || exit 1
git checkout branch_to_build
popd
pushd .
mkdir -p serial/build-ert
cd serial/build-ert
cmake $WORKSPACE/deps/ert/devel -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install
cmake --build . --target install
popd
# Build opm-common
pushd .
mkdir -p $WORKSPACE/deps/opm-common
cd $WORKSPACE/deps/opm-common
git init .
git remote add origin https://github.com/OPM/opm-common
git fetch origin $OPM_COMMON_REVISION:branch_to_build
test $? -eq 0 || exit 1
git checkout branch_to_build
popd
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
pushd .
mkdir serial/build-opm-common
cd serial/build-opm-common
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 0 $WORKSPACE/deps/opm-common
popd
# Build opm-parser
clone_and_build_module opm-parser "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" $OPM_PARSER_REVISION $WORKSPACE/serial
# Build opm-material
clone_and_build_module opm-material "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" $OPM_MATERIAL_REVISION $WORKSPACE/serial
# Build opm-core
clone_and_build_module opm-core "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" $OPM_CORE_REVISION $WORKSPACE/serial
# Build dune-cornerpoint
clone_and_build_module dune-cornerpoint "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" $DUNE_CORNERPOINT_REVISION $WORKSPACE/serial
# Build opm-output
clone_and_build_module opm-output "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" $OPM_OUTPUT_REVISION $WORKSPACE/serial
# Build opm-autodiff
pushd .
mkdir serial/build-opm-autodiff
cd serial/build-opm-autodiff
build_module "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install" 1 $WORKSPACE
popd
}

54
jenkins/build-pr.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
source `dirname $0`/build-opm-autodiff.sh
ERT_REVISION=master
OPM_COMMON_REVISION=master
OPM_PARSER_REVISION=master
OPM_MATERIAL_REVISION=master
OPM_CORE_REVISION=master
DUNE_CORNERPOINT_REVISION=master
OPM_OUTPUT_REVISION=master
OPM_AUTODIFF_REVISION=$sha1
if grep -q "ert=" <<< $ghprbCommentBody
then
ERT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*ert=([0-9]+).*/\1/g'`/merge
fi
if grep -q "opm-common=" <<< $ghprbCommentBody
then
OPM_COMMON_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
fi
if grep -q "opm-parser=" <<< $ghprbCommentBody
then
OPM_PARSER_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-parser=([0-9]+).*/\1/g'`/merge
fi
if grep -q "opm-material=" <<< $ghprbCommentBody
then
OPM_MATERIAL_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-material=([0-9]+).*/\1/g'`/merge
fi
if grep -q "opm-core=" <<< $ghprbCommentBody
then
OPM_CORE_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-core=([0-9]+).*/\1/g'`/merge
fi
if grep -q "dune-cornerpoint=" <<< $ghprbCommentBody
then
DUNE_CORNERPOINT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*dune-cornerpoint=([0-9]+).*/\1/g'`/merge
fi
if grep -q "opm-output=" <<< $ghprbCommentBody
then
OPM_OUTPUT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-output=([0-9]+).*/\1/g'`/merge
fi
echo "Building with ert=$ERT_REVISION opm-common=$OPM_COMMON_REVISION opm-parser=$OPM_PARSER_REVISION opm-material=$OPM_MATERIAL_REVISION opm-core=$OPM_CORE_REVISION dune-cornerpoint=$DUNE_CORNERPOINT_REVISION opm-output=$OPM_OUTPUT_REVISION opm-autodiff=$OPM_AUTODIFF_REVISION"
build_opm_autodiff
test $? -eq 0 || exit 1
cp serial/build-opm-autodiff/testoutput.xml .

16
jenkins/build.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
source `dirname $0`/build-opm-autodiff.sh
ERT_REVISION=master
OPM_COMMON_REVISION=master
OPM_PARSER_REVISION=master
OPM_MATERIAL_REVISION=master
OPM_CORE_REVISION=master
DUNE_CORNERPOINT_REVISION=master
OPM_OUTPUT_REVISION=master
build_opm_autodiff
test $? -eq 0 || exit 1
cp serial/build-opm-autodiff/testoutput.xml .