Skip to content

Commit

Permalink
add multiconfiguration support to jenkins build script
Browse files Browse the repository at this point in the history
also unifies build.sh and build-pr.sh and gets rid of
build-opm-simulators.sh
  • Loading branch information
akva2 committed Aug 23, 2016
1 parent cd822bc commit 4f779b7
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 122 deletions.
41 changes: 16 additions & 25 deletions jenkins/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
# opm-simulators jenkins build scripts:

**build-opm-simulators.sh**:
This is a helper script which contains functions for building,
testing and cloning opm-simulators and its dependencies.

**build.sh**:
This script will build dependencies, then build opm-simulators 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-simulators 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
opm-grid (defaults to master) and then builds $sha1 of opm-simulators.
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-grid=<pull request number>
and/or opm-output=<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'.

**run-spe.sh**:
This script will execute the SPE1, SPE3 and SPE9 cases, then compare against
OPM and Eclipse reference results. It is meant to be executed after either
of the two build scripts above.
OPM and Eclipse reference results. It is meant to be executed after a build.
The binary used used is from the build identified by the configuration
environment variable.

**run-norne.sh**:
This script will execute the Norne case, and generate a document with
plots of the results. It is meant to be executed after either
of the two build scripts above.
plots of the results. It is meant to be executed after a build.
The binary used used is from the build identified by the configuration
environment variable.

**run-polymer.sh**:
This script will execute the simple2D polymer case, then compare against
Eclipse reference results. It is meant to be executed after either
of the two build scripts above.
Eclipse reference results. It is meant to be executed after a build.
The binary used used is from the build identified by the configuration
environment variable.
37 changes: 0 additions & 37 deletions jenkins/build-opm-simulators.sh

This file was deleted.

41 changes: 0 additions & 41 deletions jenkins/build-pr.sh

This file was deleted.

35 changes: 29 additions & 6 deletions jenkins/build.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
#!/bin/bash

source `dirname $0`/build-opm-simulators.sh

declare -a upstreams
upstreams=(ert
upstreams=(opm-common
ert
opm-parser
opm-output
opm-material
opm-core
opm-grid)

declare -A upstreamRev
upstreamRev[opm-common]=master
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
upstreamRev[opm-common]=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
fi

# No downstreams currently
declare -a downstreams
declare -A downstreamRev

build_opm_simulators
# 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

source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh

parseRevisions
printHeader opm-simulators

# Setup opm-data
source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh

cp serial/build-opm-simulators/testoutput.xml .
build_module_full opm-simulators
4 changes: 2 additions & 2 deletions jenkins/run-norne.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cd deps/opm-data

# Run the norne case
cd norne
$WORKSPACE/serial/build-opm-simulators/bin/flow deck_filename=NORNE_ATW2013.DATA output_dir=OPM
$WORKSPACE/$configuration/build-opm-simulators/bin/flow deck_filename=NORNE_ATW2013.DATA output_dir=OPM
test $? -eq 0 || exit 1
PATH=$WORKSPACE/serial/install/bin:$PATH ./plotwells.sh
PATH=$WORKSPACE/$configuration/install/bin:$PATH ./plotwells.sh

popd
4 changes: 2 additions & 2 deletions jenkins/run-polymer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ cd deps/opm-data

# Run the simple2D polymer case
cd polymer_test_suite/simple2D
$WORKSPACE/serial/build-opm-simulators/bin/flow_polymer run.param
$WORKSPACE/$configuration/build-opm-simulators/bin/flow_polymer run.param
test $? -eq 0 || exit 1
cd ../..

# Compare OPM with eclipse reference
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py polymer_test_suite/simple2D/eclipse-simulation/ polymer_test_suite/simple2D/opm-simulation/ 2D_THREEPHASE_POLY_HETER 0.0006 0.004
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py polymer_test_suite/simple2D/eclipse-simulation/ polymer_test_suite/simple2D/opm-simulation/ 2D_THREEPHASE_POLY_HETER 0.0006 0.004
test $? -eq 0 || exit 1

popd
18 changes: 9 additions & 9 deletions jenkins/run-spe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ cd deps/opm-data

# Run the SPE1/3/9 cases
cd spe1
$WORKSPACE/serial/build-opm-simulators/bin/flow deck_filename=SPE1CASE2.DATA
$WORKSPACE/$configuration/build-opm-simulators/bin/flow deck_filename=SPE1CASE2.DATA
test $? -eq 0 || exit 1
cd ..
cd spe3
$WORKSPACE/serial/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE3CASE1.DATA
$WORKSPACE/$configuration/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE3CASE1.DATA
test $? -eq 0 || exit 1
cd ..
cd spe9
$WORKSPACE/serial/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE9_CP.DATA
$WORKSPACE/$configuration/build-opm-simulators/bin/flow max_iter=50 deck_filename=SPE9_CP.DATA
test $? -eq 0 || exit 1
cd ..

# Compare OPM with eclipse reference
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/eclipse-simulation/ spe1/ SPE1CASE2 0.01 0.01
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/eclipse-simulation/ spe1/ SPE1CASE2 0.01 0.01
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/eclipse-simulation/ spe3/ SPE3CASE1 0.02 0.02
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/eclipse-simulation/ spe3/ SPE3CASE1 0.02 0.02
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/eclipse-simulation/ spe9/ SPE9_CP 0.002 0.001
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/eclipse-simulation/ spe9/ SPE9_CP 0.002 0.001
test $? -eq 0 || exit 1

# Compare OPM with OPM reference
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/opm-simulation-reference/ spe1/ SPE1CASE2 0.001 0.001
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe1/opm-simulation-reference/ spe1/ SPE1CASE2 0.001 0.001
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/opm-simulation-reference/ spe3/ SPE3CASE1 0.001 0.001
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe3/opm-simulation-reference/ spe3/ SPE3CASE1 0.001 0.001
test $? -eq 0 || exit 1
PYTHONPATH=$WORKSPACE/serial/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/opm-simulation-reference/ spe9/ SPE9_CP 0.002 0.007
PYTHONPATH=$WORKSPACE/$configuration/install/lib/python2.7/dist-packages/ python output_comparator/src/compare_eclipse.py spe9/opm-simulation-reference/ spe9/ SPE9_CP 0.002 0.007
test $? -eq 0 || exit 1

popd

0 comments on commit 4f779b7

Please sign in to comment.