diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-30 09:46:53 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-10-30 09:46:53 +0100 |
commit | 0de48617ec0913ea508854fb4bee3c99074e1ea9 (patch) | |
tree | cf4e52b52171b2fa8b6928e97509b9956f984631 /tests/drone-run-php-tests.sh | |
parent | 3076eb4e9bb4006a5670aa08a2b35d2cfa42cd6c (diff) | |
download | nextcloud-server-0de48617ec0913ea508854fb4bee3c99074e1ea9.tar.gz nextcloud-server-0de48617ec0913ea508854fb4bee3c99074e1ea9.zip |
Only run phpunit when php, xml or test files are modified
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/drone-run-php-tests.sh')
-rwxr-xr-x | tests/drone-run-php-tests.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/drone-run-php-tests.sh b/tests/drone-run-php-tests.sh new file mode 100755 index 00000000000..9552141adcb --- /dev/null +++ b/tests/drone-run-php-tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "=========================" +echo "= List of changed files =" +echo "=========================" +git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA +echo "=========================" + +[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | wc -l) -eq 0 ]] && echo "No files are modified => merge commit" && exit 0 + +[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".xml") -gt 0 ]] && echo "info.xml files are modified" && exit 0 + +[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".php$") -gt 0 ]] && echo "PHP files are modified" && exit 0 + +[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "^tests/") -gt 0 ]] && echo "PHP test files are modified" && exit 0 + +[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "/tests/") -gt 0 ]] && echo "PHP test files of an app are modified" && exit 0 + +exit 1 |