aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-10-30 09:46:53 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-10-30 12:12:35 +0000
commitfe285d4d96a130c6e8ca8e72ee2da234e7d31c69 (patch)
tree1e4b259111b3925a021ae274176b7d421cd4b497 /tests
parent48fbddc9f310d4282647e331a05ebf007e190eea (diff)
downloadnextcloud-server-fe285d4d96a130c6e8ca8e72ee2da234e7d31c69.tar.gz
nextcloud-server-fe285d4d96a130c6e8ca8e72ee2da234e7d31c69.zip
Only run phpunit when php, xml or test files are modified
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/drone-run-integration-tests.sh2
-rwxr-xr-xtests/drone-run-php-tests.sh19
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/drone-run-integration-tests.sh b/tests/drone-run-integration-tests.sh
index 9da224ccbad..605e1eb356b 100755
--- a/tests/drone-run-integration-tests.sh
+++ b/tests/drone-run-integration-tests.sh
@@ -8,6 +8,8 @@ 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 "^build/integration/") -gt 0 ]] && echo "Integration test files are modified" && exit 0
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