File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,30 @@ if [ "${RUN_CS_FIXER}" = "true" ]; then
2020 ${HOME} /php-cs-fixer fix --dry-run --diff
2121fi
2222
23- # loop through all directories containing "phpunit.xml*" and run them
23+ # Determine all files changed on this branch
24+ # (will be empty if running from "master").
25+ FILES_CHANGED=$( git diff --name-only HEAD $( git merge-base HEAD master) )
26+
27+ # If any files outside the sample directires changed, or if we are not
28+ # on a Pull Request, run the whole test suite.
29+ if grep -q ^testing\/ <<< " $FILES_CHANGED" || \
30+ grep -qv \/ <<< " $FILES_CHANGED" || \
31+ [ -e $TRAVIS_PULL_REQUEST_BRANCH ]; then
32+ RUN_ALL_TESTS=1
33+ else
34+ RUN_ALL_TESTS=0
35+ fi
36+
37+ # Loop through all directories containing "phpunit.xml*" and run the test suites.
2438find * -name ' phpunit.xml*' -not -path ' */vendor/*' -exec dirname {} \; | while read DIR
2539do
40+ # Only run tests for samples that have changed.
41+ if [ " $RUN_ALL_TESTS " -ne " 1" ]; then
42+ if ! grep -q ^$DIR <<< " $FILES_CHANGED" ; then
43+ echo " Skipping tests in $DIR \n"
44+ continue
45+ fi
46+ fi
2647 pushd ${DIR}
2748 if [ -f " composer.json" ]; then
2849 composer install
You can’t perform that action at this time.
0 commit comments