Merge pull request #23794 from nextcloud/backport/23788/stable20

[stable20] Only run phpunit when "php" changed
This commit is contained in:
Roeland Jago Douma 2020-10-31 08:49:39 +01:00 committed by GitHub
commit d156a7c121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 0 deletions

View File

@ -249,14 +249,17 @@ steps:
- name: nodb-php7.2
image: nextcloudci/php7.2:latest
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
- name: nodb-php7.3
image: nextcloudci/php7.3:latest
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
- name: nodb-php7.4
image: nextcloudci/php7.4:latest
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
services:
@ -283,14 +286,17 @@ steps:
- name: sqlite-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
- name: sqlite-php7.3
image: nextcloudci/php7.3:php7.3-4
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
- name: sqlite-php7.4
image: nextcloudci/php7.4:2
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
services:
@ -317,6 +323,7 @@ steps:
- name: mariadb10.1-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
services:
@ -352,6 +359,7 @@ steps:
- name: mariadb10.2-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
services:
@ -386,6 +394,7 @@ steps:
- name: mariadb10.3-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
services:
@ -420,6 +429,7 @@ steps:
- name: mariadb10.4-php7.3
image: nextcloudci/php7.3:php7.3-4
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
services:
@ -455,6 +465,7 @@ steps:
- name: mysql-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
services:
@ -491,6 +502,7 @@ steps:
- name: mysql-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
services:
@ -523,6 +535,7 @@ steps:
- name: mysql-php7.3
image: nextcloudci/php7.3:php7.3-4
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
services:
@ -555,6 +568,7 @@ steps:
- name: mysql5.6-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
services:
@ -589,6 +603,7 @@ steps:
- name: postgres-php7.3
image: nextcloudci/php7.3:php7.3-4
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- sleep 10 # gives the database enough time to initialize
- POSTGRES=9 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
@ -624,6 +639,7 @@ steps:
- name: postgres-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- sleep 10 # gives the database enough time to initialize
- POSTGRES=10 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
@ -658,6 +674,7 @@ steps:
- name: postgres-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- sleep 10 # gives the database enough time to initialize
- POSTGRES=11 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
@ -693,6 +710,7 @@ steps:
- name: mysqlmb4-php7.2
image: nextcloudci/php7.2:php7.2-13
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysqlmb4
services:
@ -728,6 +746,7 @@ steps:
- name: mysqlmb4-php7.3
image: nextcloudci/php7.3:php7.3-4
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysqlmb4
services:

View File

@ -8,6 +8,14 @@ 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 ".json" | grep -v "package.json" | grep -c -v "package-lock.json") -gt 0 ]] && echo "JSON files are modified" && exit 0
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".sh") -gt 0 ]] && echo "bash files are modified" && exit 0
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".yml") -gt 0 ]] && echo "YML files are modified" && 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

25
tests/drone-run-php-tests.sh Executable file
View File

@ -0,0 +1,25 @@
#!/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 ".json" | grep -v "package.json" | grep -c -v "package-lock.json") -gt 0 ]] && echo "JSON files are modified" && exit 0
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".sh") -gt 0 ]] && echo "bash files are modified" && exit 0
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".yml") -gt 0 ]] && echo "YML files are modified" && 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