Reorganized travis building.
1. travis/build-prereqs.sh will build all the from-source dependencies; i.e. dune, superLU and ert. 2. travis/clone-opm.sh will clone all opm modules, except the module given as commandline argument; it is assumed that travis has already fetched and merged the correct ref of this repo. 3. travis/build-and-test.sh will build all upstream modules and then build and test the module given as commandline argument including all downstream modules: travis/build-and-test.sh opm-output With this the .travis.yml file can be nearly identical for each module, e.g. for opm-output the before_script and script sections will be: before_script: - export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8" - cd .. - opm-common/travis/build-prereqs.sh - opm-common/travis/clone-opm.sh opm-output script: opm-common/travis/build-and-test.sh opm-output
This commit is contained in:
parent
82b638b429
commit
422a11c6c7
11
.travis.yml
11
.travis.yml
@ -13,9 +13,18 @@ addons:
|
|||||||
- gcc-4.8
|
- gcc-4.8
|
||||||
- g++-4.8
|
- g++-4.8
|
||||||
- gfortran-4.8
|
- gfortran-4.8
|
||||||
|
- liblapack-dev
|
||||||
|
- libgmp3-dev
|
||||||
|
- libsuitesparse-dev
|
||||||
|
- libeigen3-dev
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8"
|
- export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8"
|
||||||
- cd ..
|
- cd ..
|
||||||
|
- opm-common/travis/build-prereqs.sh
|
||||||
|
- opm-common/travis/clone-opm.sh opm-common
|
||||||
|
|
||||||
|
|
||||||
|
script: opm-common/travis/build-and-test.sh opm-common
|
||||||
|
|
||||||
|
|
||||||
script: opm-common/travis/build-and-test-opm-common.sh
|
|
||||||
|
86
travis/build-and-test.sh
Executable file
86
travis/build-and-test.sh
Executable file
@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
build_order=(opm-common opm-parser opm-material opm-core opm-output opm-grid opm-simulators opm-upscaling)
|
||||||
|
|
||||||
|
# This shell script should be started with the name of a module as
|
||||||
|
# only only command line argument. It will start by building all
|
||||||
|
# upstream modules, then it will build and test the module of interest
|
||||||
|
# and all downstream modules.
|
||||||
|
#
|
||||||
|
# Before invoking this script all the modules should have been cloned
|
||||||
|
# in sibling directories, so that this script will see this directory
|
||||||
|
# structure:
|
||||||
|
#
|
||||||
|
# opm-common/
|
||||||
|
# opm-parser/
|
||||||
|
# opm-material/
|
||||||
|
# opm-output/
|
||||||
|
# opm-core/
|
||||||
|
# opm-grid/
|
||||||
|
# opm-simulators/
|
||||||
|
# opm-upscaling/
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# This can typically be achived by using the 'clone-opm.sh' script.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function upstream_build {
|
||||||
|
project=${1}
|
||||||
|
echo "Building: ${project}"
|
||||||
|
mkdir -p ${project}/build
|
||||||
|
pushd ${project}/build > /dev/null
|
||||||
|
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=OFF -DSILENCE_EXTERNAL_WARNINGS=True
|
||||||
|
make
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function downstream_build_and_test {
|
||||||
|
project=${1}
|
||||||
|
echo "Building and testing: ${project}"
|
||||||
|
mkdir -p ${project}/build
|
||||||
|
pushd ${project}/build > /dev/null
|
||||||
|
# The build commands cmake, make and ctest must be given as
|
||||||
|
# separate commands and not chained with &&. If chaining with &&
|
||||||
|
# is used the 'set -e' does not exit on first error.
|
||||||
|
cmake ../ -DENABLE_PYTHON=ON -DBUILD_TESTING=ON -DSILENCE_EXTERNAL_WARNINGS=True
|
||||||
|
make
|
||||||
|
ctest --output-on-failure
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for i in "${!build_order[@]}"; do
|
||||||
|
if [[ "${build_order[$i]}" = "$1" ]]; then
|
||||||
|
project_index=$i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z ${project_index} ]]; then
|
||||||
|
echo "${0}: Project: ${1} not recognized."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build_index=0
|
||||||
|
|
||||||
|
|
||||||
|
while [ $build_index -lt ${project_index} ];
|
||||||
|
do
|
||||||
|
project=${build_order[$build_index]}
|
||||||
|
upstream_build ${project}
|
||||||
|
build_index=$((build_index + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while [ $build_index -lt ${#build_order[@]} ]
|
||||||
|
do
|
||||||
|
project=${build_order[$build_index]}
|
||||||
|
downstream_build_and_test ${project}
|
||||||
|
build_index=$((build_index + 1))
|
||||||
|
done
|
||||||
|
|
71
travis/build-prereqs.sh
Executable file
71
travis/build-prereqs.sh
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# This script should build all the OPM dependencies which are installed from source.
|
||||||
|
|
||||||
|
|
||||||
|
# The build_dune function should take the module name as the first
|
||||||
|
# argument. By default the script will clone the source from:
|
||||||
|
#
|
||||||
|
# https://github.com/dune-project/${project}.git
|
||||||
|
#
|
||||||
|
# But you can optionally supply a git url as second argument, i.e.
|
||||||
|
#
|
||||||
|
# build_dune dune-alugrid https://gitlab.dune-project.org/extensions/dune-alugrid.git
|
||||||
|
#
|
||||||
|
# to build the dune-alugrid module which is not found at github.
|
||||||
|
|
||||||
|
function build_dune {
|
||||||
|
project=$1
|
||||||
|
if [[ $# -eq 1 ]]; then
|
||||||
|
url=https://github.com/dune-project/${project}.git
|
||||||
|
else
|
||||||
|
url=$2
|
||||||
|
fi
|
||||||
|
pushd . > /dev/null
|
||||||
|
git clone ${url}
|
||||||
|
cd ${project}
|
||||||
|
git checkout tags/v2.3.1
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ../
|
||||||
|
make
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function build_superlu {
|
||||||
|
pushd . > /dev/null
|
||||||
|
git clone https://github.com/starseeker/SuperLU.git
|
||||||
|
cd SuperLU
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -D CMAKE_INSTALL_PREFIX=.. -D SUPERLU_BUILD_EXAMPLES=OFF -D SUPERLU_ENABLE_TESTING=OFF ../
|
||||||
|
make install
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function build_ert {
|
||||||
|
git clone https://github.com/Ensembles/ert.git
|
||||||
|
mkdir -p ert/build
|
||||||
|
pushd ert/build > /dev/null
|
||||||
|
cmake ../devel && make
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
build_superlu
|
||||||
|
build_ert
|
||||||
|
|
||||||
|
build_dune dune-common
|
||||||
|
build_dune dune-istl
|
||||||
|
build_dune dune-geometry
|
||||||
|
build_dune dune-grid
|
||||||
|
|
||||||
|
|
||||||
|
|
22
travis/clone-opm.sh
Executable file
22
travis/clone-opm.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
project_list=(opm-data opm-common opm-parser opm-material opm-core opm-output opm-grid opm-simulators opm-upscaling ewoms)
|
||||||
|
|
||||||
|
# Will clone all the projects *except* the one project given as commandline argument; that
|
||||||
|
# has typically been checked out by travis already.
|
||||||
|
|
||||||
|
function clone_project {
|
||||||
|
url=https://github.com/OPM/${1}.git
|
||||||
|
git clone $url
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for project in "${project_list[@]}"; do
|
||||||
|
if [ "$project" != $1 ]; then
|
||||||
|
clone_project $project
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user