From b6b7cf2c3d42f08b5200068dc6f73ff5d822cec4 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 29 May 2019 19:02:15 +0530 Subject: [PATCH] skip functional tests for doc change in some cases, we don't need to do functional testing, like doc change of the yml files related to Travis or mergify.This PR skip functional testing for this kind of changes Signed-off-by: Madhu Rajanna --- .travis.yml | 1 + scripts/skip-doc-change.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 scripts/skip-doc-change.sh diff --git a/.travis.yml b/.travis.yml index cc5950446..1cfe0bc0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,7 @@ jobs: - name: cephcsi script: + - scripts/skip-doc-change.sh || travis_terminate 0; - make cephcsi || travis_terminate 1; - sudo scripts/minikube.sh up || travis_terminate 1; # pull docker images to speed up e2e diff --git a/scripts/skip-doc-change.sh b/scripts/skip-doc-change.sh new file mode 100755 index 000000000..cc133dedc --- /dev/null +++ b/scripts/skip-doc-change.sh @@ -0,0 +1,31 @@ +#!/bin/bash -e +CHANGED_FILES=$(git diff --name-only "$TRAVIS_COMMIT_RANGE") + +[[ -z $CHANGED_FILES ]] && exit 1 + +skip=0 +#files to be skipped +declare -a FILES=(^docs/ .md$ ^scripts/ LICENSE .travis.yml .mergify.yml .github .gitignore) + +function check_file_present() { + local file=$1 + for FILE in "${FILES[@]}"; do + if [[ $file =~ $FILE ]]; then + if [[ $file =~ minikube.sh ]]; then + continue + fi + return 0 + fi + done + return 1 +} + +for CHANGED_FILE in $CHANGED_FILES; do + if ! check_file_present "$CHANGED_FILE"; then + skip=1 + fi +done +if [ $skip -eq 0 ]; then + echo "Skipping functional tests" + exit 1 +fi