add multiconfiguration support to jenkins build script

also unifies build.sh and build-pr.sh and gets rid of
build-opm-upscaling.sh
This commit is contained in:
Arne Morten Kvarving 2016-08-23 14:30:13 +02:00
parent f523008a0b
commit 2cbce2e274
4 changed files with 36 additions and 98 deletions

View File

@ -1,25 +1,14 @@
# opm-upscaling jenkins build scripts:
**build-opm-upscaling.sh**:
This is a helper script which contains functions for building,
testing and cloning opm-upscaling and its dependencies.
**build.sh**:
This script will build dependencies, then build opm-upscaling 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-upscaling 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, opm-output
and opm-grid (defaults to master) and then builds $sha1 of opm-upscaling.
It also inspects the $ghbPrBuildComment environmental variable and builds
downstreams if requested. It inspects the $ghbPrBuildComment
environmental variable to obtain a pull request to use for the modules.
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 opm-grid 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 opm-output=<pull request number>
and/or opm-grid=<pull request number>.
To specify a given pull request to use for upstreams and downstreams,
trigger line needs to contain <module-name>=<pull request number>.
To build with downstreams the trigger line needs to contain 'with downstreams'.

View File

@ -1,33 +0,0 @@
#!/bin/bash
function build_opm_upscaling {
# 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 --depth 1 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 -p serial/build-opm-common
cd serial/build-opm-common
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 0 $WORKSPACE/deps/opm-common
test $? -eq 0 || exit 1
popd
build_upstreams
# Build opm-upscaling
pushd .
mkdir serial/build-opm-upscaling
cd serial/build-opm-upscaling
build_module "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DINSTALL_BENCHMARKS=1" 1 $WORKSPACE
test $? -eq 0 || exit 1
popd
}

View File

@ -1,41 +0,0 @@
#!/bin/bash
source `dirname $0`/build-opm-upscaling.sh
declare -a upstreams
upstreams=(ert
opm-parser
opm-output
opm-material
opm-core
opm-grid)
declare -A upstreamRev
upstreamRev[ert]=master
upstreamRev[opm-parser]=master
upstreamRev[opm-material]=master
upstreamRev[opm-core]=master
upstreamRev[opm-grid]=master
upstreamRev[opm-output]=master
OPM_COMMON_REVISION=master
if grep -q "opm-common=" <<< $ghprbCommentBody
then
OPM_COMMON_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
fi
for upstream in ${upstreams[*]}
do
if grep -q "$upstream=" <<< $ghprbCommentBody
then
upstreamRev[$upstream]=pull/`echo $ghprbCommentBody | sed -r "s/.*$upstream=([0-9]+).*/\1/g"`/merge
fi
done
echo "Building with opm-common=$OPM_COMMON_REVISION ert=${upstreamRev[ert]} opm-parser=${upstreamRev[opm-parser]} opm-material=${upstreamRev[opm-material]} opm-core=${upstreamRev[opm-core]} opm-grid=${upstreamRev[opm-grid]} opm-output=${upstreamRev[opm-output]} opm-upscaling=$sha1"
build_opm_upscaling
test $? -eq 0 || exit 1
cp serial/build-opm-upscaling/testoutput.xml .

View File

@ -1,9 +1,8 @@
#!/bin/bash
source `dirname $0`/build-opm-upscaling.sh
declare -a upstreams
upstreams=(ert
upstreams=(opm-common
ert
opm-parser
opm-output
opm-material
@ -11,6 +10,7 @@ upstreams=(ert
opm-grid)
declare -A upstreamRev
upstreamRev[opm-common]=master
upstreamRev[ert]=master
upstreamRev[opm-parser]=master
upstreamRev[opm-material]=master
@ -18,9 +18,32 @@ upstreamRev[opm-core]=master
upstreamRev[opm-grid]=master
upstreamRev[opm-output]=master
OPM_COMMON_REVISION=master
if grep -q "opm-common=" <<< $ghprbCommentBody
then
upstreamRev[opm-common]=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
fi
build_opm_upscaling
# Currently no downstreams
declare -a downstreams
declare -A downstreamRev
# Clone 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 --depth 1 origin ${upstreamRev[opm-common]}:branch_to_build
test $? -eq 0 || exit 1
git checkout branch_to_build
popd
cp serial/build-opm-upscaling/testoutput.xml .
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
parseRevisions
printHeader opm-upscaling
# Setup opm-data
source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh
build_module_full opm-upscaling