diff --git a/jenkins/README.md b/jenkins/README.md index a79e17ac..cfcca023 100644 --- a/jenkins/README.md +++ b/jenkins/README.md @@ -1,21 +1,14 @@ # opm-core jenkins build scripts: -**build-opm-core.sh**: -This is a helper script which contains a function for building, -testing and cloning opm-core and its dependencies. - **build.sh**: This script will build dependencies, then build opm-core and execute its tests. -It is intended for post-merge builds of the master branch. +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. -**build-pr.sh**: -This script will build dependencies, then build opm-core and execute its tests. -It inspects the $ghbPrBuildComment environmental variable to obtain a pull request -to use for ert, opm-common, opm-parser and opm-material (defaults to master) -and then builds $sha1 of opm-core. It is intended for pre-merge builds of pull requests. +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 and opm-material 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>. +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'. diff --git a/jenkins/build-opm-core.sh b/jenkins/build-opm-core.sh deleted file mode 100755 index 137bbfd5..00000000 --- a/jenkins/build-opm-core.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -function build_opm_core { - # 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_upstreams - - # Build opm-core - pushd . - mkdir serial/build-opm-core - cd serial/build-opm-core - build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/serial/install -DCMAKE_PREFIX_PATH=$WORKSPACE/serial/install" 1 $WORKSPACE - test $? -eq 0 || exit 1 - popd -} diff --git a/jenkins/build-pr.sh b/jenkins/build-pr.sh deleted file mode 100755 index f1ae77b9..00000000 --- a/jenkins/build-pr.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -source `dirname $0`/build-opm-core.sh - -# Upstream revisions -declare -a upstreams -upstreams=(ert - opm-parser - opm-material - opm-output) - -declare -A upstreamRev -upstreamRev[ert]=master -upstreamRev[opm-parser]=master -upstreamRev[opm-material]=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-output=${upstreamRev[opm-output]} opm-core=$sha1" - -build_opm_core -test $? -eq 0 || exit 1 - -# If no downstream builds we are done -if ! grep -q "with downstreams" <<< $ghprbCommentBody -then - cp serial/build-opm-core/testoutput.xml . - exit 0 -fi - -source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh -source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh - -# Downstream revisions -declare -a downstreams -downstreams=(opm-grid - opm-simulators - opm-upscaling - ewoms) - -declare -A downstreamRev -downstreamRev[opm-grid]=master -downstreamRev[opm-simulators]=master -downstreamRev[opm-upscaling]=master -downstreamRev[ewoms]=master - -build_downstreams opm-core - -test $? -eq 0 || exit 1 diff --git a/jenkins/build.sh b/jenkins/build.sh index d0e91032..c8d92737 100755 --- a/jenkins/build.sh +++ b/jenkins/build.sh @@ -1,23 +1,57 @@ #!/bin/bash -source `dirname $0`/build-opm-core.sh - -# Upstream revisions declare -a upstreams -upstreams=(ert +upstreams=(opm-common + ert opm-parser opm-material opm-output) declare -A upstreamRev +upstreamRev[opm-common]=master upstreamRev[ert]=master upstreamRev[opm-parser]=master upstreamRev[opm-material]=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_core +# Downstream revisions +declare -a downstreams +downstreams=(opm-grid + opm-simulators + opm-upscaling + ewoms) + +declare -A downstreamRev +downstreamRev[opm-grid]=master +downstreamRev[opm-simulators]=master +downstreamRev[opm-upscaling]=master +downstreamRev[ewoms]=master + +# 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-core/testoutput.xml . +source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh + +parseRevisions +printHeader opm-core + +# Setup opm-data +if grep -q "with downstreams" <<< $ghprbCommentBody +then + source $WORKSPACE/deps/opm-common/jenkins/setup-opm-data.sh +fi + +build_module_full opm-core