From 74610660e7c6bd2962f5a238b100a0faa8e7f594 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 31 Jan 2018 12:32:51 +0100 Subject: [PATCH] Check package dependencies to decide if it should be tested by travis or not. --- .travis.yml | 8 +++++-- .travis/build_package.sh | 19 ++++++++++++----- .travis/template.txt | 1 - .travis/test_package.sh | 21 +++++++++++++++++++ .../cgal_check_dependencies.sh | 1 + 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 .travis/test_package.sh diff --git a/.travis.yml b/.travis.yml index 0274556bd2c..f03b95dfc96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,9 +113,8 @@ before_script: - sudo make install &>/dev/null - cd .. - sudo bash ./.travis/install_openmesh.sh -script: +script: - cd ./.travis -- doxygen --version - bash -x -e ./build_package.sh $PACKAGE addons: apt: @@ -144,8 +143,13 @@ addons: - qt55svg - qt55tools - qt55graphicaleffects +<<<<<<< HEAD + - libopencv-dev +======= - libopencv-dev + - bibtex2html +>>>>>>> ac52f483a8... finishing integration of dependencies check - mesa-common-dev - libglu1-mesa-dev # Not allowed (yet) diff --git a/.travis/build_package.sh b/.travis/build_package.sh index d2553dc3bb5..36cde0f206d 100755 --- a/.travis/build_package.sh +++ b/.travis/build_package.sh @@ -55,11 +55,11 @@ for ARG in $(echo "$@") do if [ "$ARG" = "CHECK" ] then + zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD #test dependencies cd $ROOT bash Scripts/developer_scripts/cgal_check_dependencies.sh /usr/bin/doxygen cd .travis - zsh $ROOT/Scripts/developer_scripts/test_merge_of_branch HEAD #parse current matrix and check that no package has been forgotten old_IFS=$IFS IFS=$'\n' @@ -115,10 +115,19 @@ do cd .. exit 0 fi - - EXAMPLES="$ARG/examples/$ARG" - TEST="$ARG/test/$ARG" - DEMOS=$ROOT/$ARG/demo/* + + if [ -n "$TRAVIS_PULL_REQUEST" ]; then + DO_IGNORE=FALSE + . test_package.sh "$ROOT" "$ARG" + echo "DO_IGNORE is $DO_IGNORE" + if [ "$DO_IGNOE" = "TRUE" ]; then + exit 0 + fi + fi + + EXAMPLES="$ARG/examples/$ARG" + TEST="$ARG/test/$ARG" + DEMOS=$ROOT/$ARG/demo/* if [ "$ARG" = AABB_tree ] || [ "$ARG" = Alpha_shapes_3 ] ||\ [ "$ARG" = Circular_kernel_3 ] || [ "$ARG" = Linear_cell_complex ] ||\ [ "$ARG" = Periodic_3_triangulation_3 ] || [ "$ARG" = Principal_component_analysis ] ||\ diff --git a/.travis/template.txt b/.travis/template.txt index d0142cfe57b..513e6b9a37a 100644 --- a/.travis/template.txt +++ b/.travis/template.txt @@ -20,7 +20,6 @@ before_script: - sudo bash ./.travis/install_openmesh.sh script: - cd ./.travis -- doxygen --version - bash -x -e ./build_package.sh $PACKAGE addons: apt: diff --git a/.travis/test_package.sh b/.travis/test_package.sh new file mode 100644 index 00000000000..b053df3773a --- /dev/null +++ b/.travis/test_package.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +#Will cd $1 and test packge named $2 +#to find out if it or one of its dependencies has changed in the current branch + +DO_IGNORE=FALSE +cd $1 +old_IFS=$IFS +IFS=$'\n' + +LIST_OF_FILES=$(git diff --name-only origin/master |cut -d/ -f1 |uniq |sort) +LIST_OF_DEPS=$(cat "$2/dependencies") +echo "$LIST_OF_DEPS" +for flie in $LIST_OF_DEPS +do + [[ $LIST_OF_FILES =~ (^|[[:space:]])$flie($|[[:space:]]) ]] && return +done +echo "Package ignored because none of its dependencies has been modified." +DO_IGNORE=TRUE +IFS=$old_IFS + diff --git a/Scripts/developer_scripts/cgal_check_dependencies.sh b/Scripts/developer_scripts/cgal_check_dependencies.sh index cf5e48d3d86..ba8b94191d2 100644 --- a/Scripts/developer_scripts/cgal_check_dependencies.sh +++ b/Scripts/developer_scripts/cgal_check_dependencies.sh @@ -1,5 +1,6 @@ #This script must be called from the CGAL root. set -e +set -x while test $# -gt 0 do case "$1" in