From 89dd37efb4731707d15884c6154f34e40e90024a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 10 May 2013 13:58:52 +0100 Subject: improve jenkinks ci script to cope with coverage and install without test --- citools/jenkins-build.sh | 106 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 28 deletions(-) (limited to 'citools') diff --git a/citools/jenkins-build.sh b/citools/jenkins-build.sh index 6d45fe0..73bfd03 100755 --- a/citools/jenkins-build.sh +++ b/citools/jenkins-build.sh @@ -8,10 +8,10 @@ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # * The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -23,44 +23,94 @@ # NetSurf continuius integration build script for jenkins # # This script may be executed by jenkins jobs that use the core buildsystem +# +# Usage: jenkins-build.sh [install|test-install|coverage] +# -# The target for built artifacts - This does mean the artifacts of a -# target must all be built on the same slave instance -ARTIFACT_HOME=${JENKINS_HOME}/artifacts-${TARGET} +# TARGET must be in the environment and set correctly +if [ "x${TARGET}" = "x" ];then + echo "TARGET unset" + exit 1 +fi -# Ensure the artifact target directory exists -mkdir -p ${ARTIFACT_HOME} -# Configure all build paths relative to prefix -export PREFIX=${ARTIFACT_HOME} -export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig -export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PREFIX}/lib -export PATH=${PATH}:${PREFIX}/bin +# The target for built artifacts +# +# This does mean the artifacts of a target must all be built on the +# same jenkins slave instance +ARTIFACT_HOME=${JENKINS_HOME}/artifacts-${TARGET} # Obtain the native target -#NATIVE_TARGET=$(uname -s) -# Currently most tests do not work on targets except for Linux -NATIVE_TARGET="Linux" +NATIVE_TARGET=$(uname -s) + +# target defaults +TARGET_TEST= +TARGET_INSTALL= +TARGET_COVERAGE= +TARGET_BUILD=release + +# change defaults based on build parameter +case $1 in + "install") + TARGET_INSTALL=${TARGET} + ;; + + "coverage") + TARGET_COVERAGE=${TARGET} + TARGET_BUILD=debug + # need to disable ccache on coverage builds + export CCACHE= + ;; + + "test-install"|*) + # Currently most tests do not work on targets except for Linux + # TARGET_TEST=${NATIVE_TARGET} + TARGET_TEST="Linux" + TARGET_INSTALL=${TARGET} + ;; +esac # currently core buildsystem doesnt use triplets so we need to adjust for that +# here is also where we can adjust other setting based on target case ${TARGET} in "m68k-atari-mint") - make clean TARGET=atari - make install TARGET=atari + TARGET=atari ;; "m5475-atari-mint") - make clean TARGET=m5475_atari - make install TARGET=m5475_atari + TARGET=m5475_atari ;; - *) - make clean - make - # run the tests on native platforms - if [ "${TARGET}" = "${NATIVE_TARGET}" ]; then - make test - fi - make install - ;; esac + +# Ensure the artifact target directory exists +mkdir -p ${ARTIFACT_HOME} + +# Configure all build paths relative to prefix +export PREFIX=${ARTIFACT_HOME} +export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PREFIX}/lib +export PATH=${PATH}:${PREFIX}/bin + +# execute the build steps + +# clean target is always first +make clean TARGET=${TARGET} BUILD=${TARGET_BUILD} + +# either a coverage build or a normal one +if [ "x${TARGET}" = "x${TARGET_COVERAGE}" ]; then + make TARGET=${TARGET} BUILD=${TARGET_BUILD} coverage + gcovr -x -r .. -o coverage.xml +else + make TARGET=${TARGET} BUILD=${TARGET_BUILD} +fi + +# test if appropriate +if [ "x${TARGET}" = "x${TARGET_TEST}" ]; then + make TARGET=${TARGET} BUILD=${TARGET_BUILD} test +fi + +# install +if [ "x${TARGET}" = "x${TARGET_INSTALL}" ]; then + make TARGET=${TARGET} BUILD=${TARGET_BUILD} install +fi -- cgit v1.2.3