From 4d5e74007a598d2710fed0f1469dac2596122c19 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 27 Aug 2019 11:31:15 +0200 Subject: [PATCH] Only run integration tests when PHP was modified Signed-off-by: Joas Schilling --- .drone.yml | 33 ++++++++++++++++++++++++++++ tests/drone-run-integration-tests.sh | 15 +++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 tests/drone-run-integration-tests.sh diff --git a/.drone.yml b/.drone.yml index 9cc36d301c..8738985c06 100644 --- a/.drone.yml +++ b/.drone.yml @@ -755,6 +755,7 @@ steps: - name: integration-capabilities_features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh capabilities_features/capabilities.feature @@ -779,6 +780,7 @@ steps: - name: integration-federation_features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin - cd build/integration - ./run.sh federation_features/federated.feature @@ -803,6 +805,7 @@ steps: - name: integration-auth image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/auth.feature @@ -827,6 +830,7 @@ steps: - name: integration-maintenance-mode image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/maintenance-mode.feature @@ -851,6 +855,7 @@ steps: - name: integration-ratelimiting image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - ./occ config:system:set redis host --value=cache - ./occ config:system:set redis port --value=6379 --type=integer @@ -885,6 +890,7 @@ steps: - name: integration-carddav image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/carddav.feature @@ -909,6 +915,7 @@ steps: - name: integration-dav-v2 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/dav-v2.feature @@ -933,6 +940,7 @@ steps: - name: integration-ocs-v1 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/ocs-v1.feature @@ -957,6 +965,7 @@ steps: - name: integration-sharing-v1 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/sharing-v1.feature @@ -981,6 +990,7 @@ steps: - name: integration-sharing-v1-part2 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/sharing-v1-part2.feature @@ -1005,6 +1015,7 @@ steps: - name: integration-sharing-v1-part3 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/sharing-v1-part3.feature @@ -1029,6 +1040,7 @@ steps: - name: integration-checksums-v1 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/checksums.feature @@ -1053,6 +1065,7 @@ steps: - name: integration-external-storage image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/external-storage.feature @@ -1077,6 +1090,7 @@ steps: - name: integration-provisioning-v1 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/provisioning-v1.feature @@ -1101,6 +1115,7 @@ steps: - name: integration-tags image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/tags.feature @@ -1125,6 +1140,7 @@ steps: - name: integration-caldav image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/caldav.feature @@ -1149,6 +1165,7 @@ steps: - name: integration-comments image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/comments.feature @@ -1173,6 +1190,7 @@ steps: - name: integration-comments-search image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/comments-search.feature @@ -1197,6 +1215,7 @@ steps: - name: integration-favorites image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/favorites.feature @@ -1221,6 +1240,7 @@ steps: - name: integration-provisioning-v2 image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/provisioning-v2.feature @@ -1245,6 +1265,7 @@ steps: - name: integration-webdav-related image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/webdav-related.feature @@ -1269,6 +1290,7 @@ steps: - name: integration-sharees-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh sharees_features/sharees.feature @@ -1293,6 +1315,7 @@ steps: - name: integration-sharees-v2-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh sharees_features/sharees_provisioningapiv2.feature @@ -1317,6 +1340,7 @@ steps: - name: integration-setup-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - cd build/integration - ./run.sh setup_features/setup.feature @@ -1340,6 +1364,7 @@ steps: - name: integration-filesdrop-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh filesdrop_features/filesdrop.feature @@ -1364,6 +1389,7 @@ steps: - name: integration-transfer-ownership-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/transfer-ownership.feature @@ -1388,6 +1414,7 @@ steps: - name: integration-ldap-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh ldap_features/ldap-ocs.feature @@ -1412,6 +1439,7 @@ steps: - name: integration-ldap-openldap-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - ./occ config:system:set redis host --value=cache - ./occ config:system:set redis port --value=6379 --type=integer @@ -1452,6 +1480,7 @@ steps: - name: integration-ldap-openldap-uid-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - ./occ config:system:set redis host --value=cache - ./occ config:system:set redis port --value=6379 --type=integer @@ -1492,6 +1521,7 @@ steps: - name: integration-ldap-openldap-numerical-id-features image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - ./occ config:system:set redis host --value=cache - ./occ config:system:set redis port --value=6379 --type=integer @@ -1532,6 +1562,7 @@ steps: - name: integration-trashbin image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh features/trashbin.feature @@ -1556,6 +1587,7 @@ steps: - name: integration-remote-api image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh remoteapi_features/remote.feature @@ -1580,6 +1612,7 @@ steps: - name: integration-download image: nextcloudci/integration-php7.1:1 commands: + - bash tests/drone-run-integration-tests.sh || exit 0 - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - cd build/integration - ./run.sh --tags ~@large features/download.feature diff --git a/tests/drone-run-integration-tests.sh b/tests/drone-run-integration-tests.sh new file mode 100755 index 0000000000..9da224ccba --- /dev/null +++ b/tests/drone-run-integration-tests.sh @@ -0,0 +1,15 @@ +#!/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 ".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 + +exit 1