From 371b523d1a265388816e45878a02866484a71e68 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 18 Dec 2025 08:53:47 +0100 Subject: [PATCH] add static analysis --- jenkins/README.md | 13 +++++-------- jenkins/build.sh | 19 +++++++++++-------- jenkins/static_analysis.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 16 deletions(-) create mode 100755 jenkins/static_analysis.sh diff --git a/jenkins/README.md b/jenkins/README.md index 86a7bf1595..1fd55abffe 100644 --- a/jenkins/README.md +++ b/jenkins/README.md @@ -13,20 +13,17 @@ trigger line needs to contain <module-name>=<pull request number>. To build with downstreams the trigger line needs to contain 'with downstreams'. +**static_analysis.sh**: +Run static analysis for opm-simulators + **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 a build. -The binary used used is from the build identified by the configuration +The binary 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 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 a build. -The binary used used is from the build identified by the configuration +The binary used is from the build identified by the configuration environment variable. diff --git a/jenkins/build.sh b/jenkins/build.sh index cfa051ad5a..b87a1fd260 100755 --- a/jenkins/build.sh +++ b/jenkins/build.sh @@ -21,14 +21,17 @@ declare -a downstreams declare -A downstreamRev # Clone opm-common -mkdir -p $WORKSPACE/deps/opm-common -pushd $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 +if ! test -d $WORKSPACE/deps/opm-common +then + mkdir -p $WORKSPACE/deps/opm-common + pushd $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 +fi source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh diff --git a/jenkins/static_analysis.sh b/jenkins/static_analysis.sh new file mode 100755 index 0000000000..de29b63efa --- /dev/null +++ b/jenkins/static_analysis.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +declare -a upstreams +upstreams=(opm-common + opm-grid) + +declare -A upstreamRev +upstreamRev[opm-common]=master +upstreamRev[opm-grid]=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 + +# Clone opm-common +mkdir -p $WORKSPACE/deps/opm-common +pushd $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 ${TOOLCHAIN_DIR}/build-configurations-sca.sh +source $WORKSPACE/deps/opm-common/jenkins/build-opm-module.sh + +$WORKSPACE/jenkins/build.sh + +run_static_analysis opm-simulators