Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions jenkins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# opm-flowdiagnostics jenkins build scripts:

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

**build.sh**:
This script will build dependencies, then build opm-flowdiagnostics
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-flowdiagnostics and execute its tests.
It inspects the $ghbPrBuildComment environmental variable to obtain a pull request
to use for for opm-common (defaults to master) and then builds $sha1 of opm-flowdiagnostics.

It is intended for pre-merge builds of pull requests.

You specify a given pull request to use for opm-common through the trigger.
The trigger line needs to contain opm-common=<pull request number>.
29 changes: 29 additions & 0 deletions jenkins/build-opm-flowdiagnostics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

function build_opm_flowdiagnostics {
# 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
popd

# Build opm-flowdiagnostics
pushd .
mkdir serial/build-opm-flowdiagnostics
cd serial/build-opm-flowdiagnostics
build_module "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 1 $WORKSPACE
test $? -eq 0 || exit 1
popd
}
65 changes: 65 additions & 0 deletions jenkins/build-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

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

# Upstream revisions
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

echo "Building with opm-common=$OPM_COMMON_REVISION opm-flowdiagnostics=$sha1"

build_opm_flowdiagnostics
test $? -eq 0 || exit 1

# If no downstream builds we are done
if ! grep -q "with downstreams" <<< $ghprbCommentBody
then
cp serial/build-opm-flowdiagnostics/testoutput.xml .
exit 0
fi

# Downstream revisions
declare -a downstreams
downstreams=(opm-parser
opm-material
opm-core
opm-flowdiagnostics-applications)

declare -A downstreamRev
downstreamRev[opm-parser]=master
downstreamRev[opm-material]=master
downstreamRev[opm-core]=master
downstreamRev[opm-flowdiagnostics-applications]=master

# Build ERT
ERT_REVISION=master
if grep -q "ert=" <<< $ghprbCommentBody
then
ERT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*ert=([0-9]+).*/\1/g'`/merge
fi

pushd .
mkdir -p $WORKSPACE/deps/ert
cd $WORKSPACE/deps/ert
git init .
git remote add origin https://github.com/Ensembles/ert
git fetch --depth 1 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
test $? -eq 0 || exit 1
popd

build_downstreams opm-flowdiagnostics

test $? -eq 0 || exit 1
10 changes: 10 additions & 0 deletions jenkins/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

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

OPM_COMMON_REVISION=master

build_opm_flowdiagnostics
test $? -eq 0 || exit 1

cp serial/build-opm-flowdiagnostics/testoutput.xml .