Skip to content

Commit 6b84da0

Browse files
authored
Merge pull request #23795 from nextcloud/backport/23788/stable19
[stable19] Only run phpunit when "php" changed
2 parents 815fe50 + 14a47a1 commit 6b84da0

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.drone.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,17 @@ steps:
272272
- name: nodb-php7.2
273273
image: nextcloudci/php7.2:php7.2-13
274274
commands:
275+
- bash tests/drone-run-php-tests.sh || exit 0
275276
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
276277
- name: nodb-php7.3
277278
image: nextcloudci/php7.3:php7.3-4
278279
commands:
280+
- bash tests/drone-run-php-tests.sh || exit 0
279281
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
280282
- name: nodb-php7.4
281283
image: nextcloudci/php7.4:2
282284
commands:
285+
- bash tests/drone-run-php-tests.sh || exit 0
283286
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
284287

285288
services:
@@ -306,14 +309,17 @@ steps:
306309
- name: sqlite-php7.2
307310
image: nextcloudci/php7.2:php7.2-13
308311
commands:
312+
- bash tests/drone-run-php-tests.sh || exit 0
309313
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
310314
- name: sqlite-php7.3
311315
image: nextcloudci/php7.3:php7.3-4
312316
commands:
317+
- bash tests/drone-run-php-tests.sh || exit 0
313318
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
314319
- name: sqlite-php7.4
315320
image: nextcloudci/php7.4:2
316321
commands:
322+
- bash tests/drone-run-php-tests.sh || exit 0
317323
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
318324

319325
services:
@@ -340,6 +346,7 @@ steps:
340346
- name: mariadb10.1-php7.2
341347
image: nextcloudci/php7.2:php7.2-13
342348
commands:
349+
- bash tests/drone-run-php-tests.sh || exit 0
343350
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
344351

345352
services:
@@ -375,6 +382,7 @@ steps:
375382
- name: mariadb10.2-php7.2
376383
image: nextcloudci/php7.2:php7.2-13
377384
commands:
385+
- bash tests/drone-run-php-tests.sh || exit 0
378386
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
379387

380388
services:
@@ -409,6 +417,7 @@ steps:
409417
- name: mariadb10.3-php7.2
410418
image: nextcloudci/php7.2:php7.2-13
411419
commands:
420+
- bash tests/drone-run-php-tests.sh || exit 0
412421
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
413422

414423
services:
@@ -443,6 +452,7 @@ steps:
443452
- name: mariadb10.4-php7.3
444453
image: nextcloudci/php7.3:php7.3-4
445454
commands:
455+
- bash tests/drone-run-php-tests.sh || exit 0
446456
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
447457

448458
services:
@@ -478,6 +488,7 @@ steps:
478488
- name: mysql-php7.2
479489
image: nextcloudci/php7.2:php7.2-13
480490
commands:
491+
- bash tests/drone-run-php-tests.sh || exit 0
481492
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
482493

483494
services:
@@ -514,6 +525,7 @@ steps:
514525
- name: mysql-php7.2
515526
image: nextcloudci/php7.2:php7.2-13
516527
commands:
528+
- bash tests/drone-run-php-tests.sh || exit 0
517529
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
518530

519531
services:
@@ -546,6 +558,7 @@ steps:
546558
- name: mysql-php7.3
547559
image: nextcloudci/php7.3:php7.3-4
548560
commands:
561+
- bash tests/drone-run-php-tests.sh || exit 0
549562
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
550563

551564
services:
@@ -578,6 +591,7 @@ steps:
578591
- name: mysql5.6-php7.2
579592
image: nextcloudci/php7.2:php7.2-13
580593
commands:
594+
- bash tests/drone-run-php-tests.sh || exit 0
581595
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
582596

583597
services:
@@ -612,6 +626,7 @@ steps:
612626
- name: postgres-php7.3
613627
image: nextcloudci/php7.3:php7.3-4
614628
commands:
629+
- bash tests/drone-run-php-tests.sh || exit 0
615630
- sleep 10 # gives the database enough time to initialize
616631
- POSTGRES=9 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
617632

@@ -647,6 +662,7 @@ steps:
647662
- name: postgres-php7.2
648663
image: nextcloudci/php7.2:php7.2-13
649664
commands:
665+
- bash tests/drone-run-php-tests.sh || exit 0
650666
- sleep 10 # gives the database enough time to initialize
651667
- POSTGRES=10 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
652668

@@ -681,6 +697,7 @@ steps:
681697
- name: postgres-php7.2
682698
image: nextcloudci/php7.2:php7.2-13
683699
commands:
700+
- bash tests/drone-run-php-tests.sh || exit 0
684701
- sleep 10 # gives the database enough time to initialize
685702
- POSTGRES=11 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
686703

@@ -716,6 +733,7 @@ steps:
716733
- name: mysqlmb4-php7.2
717734
image: nextcloudci/php7.2:php7.2-13
718735
commands:
736+
- bash tests/drone-run-php-tests.sh || exit 0
719737
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysqlmb4
720738

721739
services:
@@ -751,6 +769,7 @@ steps:
751769
- name: mysqlmb4-php7.3
752770
image: nextcloudci/php7.3:php7.3-4
753771
commands:
772+
- bash tests/drone-run-php-tests.sh || exit 0
754773
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysqlmb4
755774

756775
services:

tests/drone-run-integration-tests.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ echo "========================="
88

99
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | wc -l) -eq 0 ]] && echo "No files are modified => merge commit" && exit 0
1010

11+
[[ $(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
12+
13+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".sh") -gt 0 ]] && echo "bash files are modified" && exit 0
14+
15+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".yml") -gt 0 ]] && echo "YML files are modified" && exit 0
16+
17+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".xml") -gt 0 ]] && echo "info.xml files are modified" && exit 0
18+
1119
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".php$") -gt 0 ]] && echo "PHP files are modified" && exit 0
1220

1321
[[ $(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

tests/drone-run-php-tests.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
echo "========================="
4+
echo "= List of changed files ="
5+
echo "========================="
6+
git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA
7+
echo "========================="
8+
9+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | wc -l) -eq 0 ]] && echo "No files are modified => merge commit" && exit 0
10+
11+
[[ $(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
12+
13+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".sh") -gt 0 ]] && echo "bash files are modified" && exit 0
14+
15+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".yml") -gt 0 ]] && echo "YML files are modified" && exit 0
16+
17+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".xml") -gt 0 ]] && echo "info.xml files are modified" && exit 0
18+
19+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c ".php$") -gt 0 ]] && echo "PHP files are modified" && exit 0
20+
21+
[[ $(git diff --name-only origin/$DRONE_TARGET_BRANCH...$DRONE_COMMIT_SHA | grep -c "^tests/") -gt 0 ]] && echo "PHP test files are modified" && exit 0
22+
23+
[[ $(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
24+
25+
exit 1

0 commit comments

Comments
 (0)