Skip to content

Commit 116770d

Browse files
committed
add jenkins build scripts
1 parent f836add commit 116770d

File tree

4 files changed

+124
-0
lines changed

4 files changed

+124
-0
lines changed

jenkins/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# opm-flowdiagnostics jenkins build scripts:
2+
3+
**build-opm-flowdiagnostics.sh**:
4+
This is a helper script which contains a function for building,
5+
testing and cloning opm-flowdiagnostics and its dependencies.
6+
7+
**build.sh**:
8+
This script will build dependencies, then build opm-flowdiagnostics
9+
and execute its tests.
10+
It is intended for post-merge builds of the master branch.
11+
12+
**build-pr.sh**:
13+
This script will build dependencies, then build opm-flowdiagnostics and execute its tests.
14+
It inspects the $ghbPrBuildComment environmental variable to obtain a pull request
15+
to use for for opm-common (defaults to master) and then builds $sha1 of opm-flowdiagnostics.
16+
17+
It is intended for pre-merge builds of pull requests.
18+
19+
You specify a given pull request to use for opm-common through the trigger.
20+
The trigger line needs to contain opm-common=<pull request number>.

jenkins/build-opm-flowdiagnostics.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
function build_opm_flowdiagnostics {
4+
# Build opm-common
5+
pushd .
6+
mkdir -p $WORKSPACE/deps/opm-common
7+
cd $WORKSPACE/deps/opm-common
8+
git init .
9+
git remote add origin https://github.com/OPM/opm-common
10+
git fetch --depth 1 origin $OPM_COMMON_REVISION:branch_to_build
11+
test $? -eq 0 || exit 1
12+
git checkout branch_to_build
13+
popd
14+
source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh
15+
16+
pushd .
17+
mkdir -p serial/build-opm-common
18+
cd serial/build-opm-common
19+
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 0 $WORKSPACE/deps/opm-common
20+
popd
21+
22+
# Build opm-flowdiagnostics
23+
pushd .
24+
mkdir serial/build-opm-flowdiagnostics
25+
cd serial/build-opm-flowdiagnostics
26+
build_module "-DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install" 1 $WORKSPACE
27+
test $? -eq 0 || exit 1
28+
popd
29+
}

jenkins/build-pr.sh

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
source `dirname $0`/build-opm-flowdiagnostics.sh
4+
5+
# Upstream revisions
6+
OPM_COMMON_REVISION=master
7+
8+
if grep -q "opm-common=" <<< $ghprbCommentBody
9+
then
10+
OPM_COMMON_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-common=([0-9]+).*/\1/g'`/merge
11+
fi
12+
13+
echo "Building with opm-common=$OPM_COMMON_REVISION opm-flowdiagnostics=$sha1"
14+
15+
build_opm_flowdiagnostics
16+
test $? -eq 0 || exit 1
17+
18+
# If no downstream builds we are done
19+
if ! grep -q "with downstreams" <<< $ghprbCommentBody
20+
then
21+
cp serial/build-opm-flowdiagnostics/testoutput.xml .
22+
exit 0
23+
fi
24+
25+
# Downstream revisions
26+
declare -a downstreams
27+
downstreams=(opm-parser
28+
opm-material
29+
opm-core
30+
opm-flowdiagnostics-applications)
31+
32+
declare -A downstreamRev
33+
downstreamRev[opm-parser]=master
34+
downstreamRev[opm-material]=master
35+
downstreamRev[opm-core]=master
36+
downstreamRev[opm-flowdiagnostics-applications]=master
37+
38+
# Build ERT
39+
ERT_REVISION=master
40+
if grep -q "ert=" <<< $ghprbCommentBody
41+
then
42+
ERT_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*ert=([0-9]+).*/\1/g'`/merge
43+
fi
44+
45+
pushd .
46+
mkdir -p $WORKSPACE/deps/ert
47+
cd $WORKSPACE/deps/ert
48+
git init .
49+
git remote add origin https://github.com/Ensembles/ert
50+
git fetch --depth 1 origin $ERT_REVISION:branch_to_build
51+
test $? -eq 0 || exit 1
52+
git checkout branch_to_build
53+
popd
54+
55+
pushd .
56+
mkdir -p serial/build-ert
57+
cd serial/build-ert
58+
cmake $WORKSPACE/deps/ert/devel -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install
59+
cmake --build . --target install
60+
test $? -eq 0 || exit 1
61+
popd
62+
63+
build_downstreams opm-flowdiagnostics
64+
65+
test $? -eq 0 || exit 1

jenkins/build.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
source `dirname $0`/build-opm-flowdiagnostics.sh
4+
5+
OPM_COMMON_REVISION=master
6+
7+
build_opm_flowdiagnostics
8+
test $? -eq 0 || exit 1
9+
10+
cp serial/build-opm-flowdiagnostics/testoutput.xml .

0 commit comments

Comments
 (0)