diff --git a/docker/tests/init.sh b/docker/tests/init.sh index 6c1e6e3c..cce18a7c 100755 --- a/docker/tests/init.sh +++ b/docker/tests/init.sh @@ -1,113 +1,104 @@ #!/bin/bash set -e set -x -rsync -av \ - --exclude=vendor \ - --exclude=composer.lock \ - --exclude=node_modules \ - --exclude=package-lock.json \ - --exclude=public \ - --exclude=storage \ - --exclude=resources/build \ - --exclude=.gitignore \ - /src/kolabsrc.orig/ /opt/app-root/src/ | tee /tmp/rsync.output - cd /opt/app-root/src/ if [ "$1" == "--refresh" ]; then /update.sh shift +else + /update-source.sh fi ./artisan route:list EXCLUDE_GROUPS=${EXCLUDE_GROUPS:-"skipci,ldap,coinbase,mollie,stripe,meet,dns,slow"} if [ "$1" == "browsertest" ]; then ./artisan octane:start --port=80 & echo "127.0.0.1 kolab.local admin.kolab.local reseller.kolab.local" >> /etc/hosts php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --testsuite Browser elif [ "$1" == "testsuite" ]; then php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --testsuite Unit php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --testsuite Functional php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --testsuite Feature elif [ "$1" == "quicktest" ]; then php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --stop-on-defect \ --stop-on-error \ --stop-on-failure \ --testsuite Unit php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --stop-on-defect \ --stop-on-error \ --stop-on-failure \ --testsuite Functional php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --stop-on-defect \ --stop-on-error \ --stop-on-failure \ --testsuite Feature elif [ "$1" == "shell" ]; then exec /bin/bash elif [ "$1" == "lint" ]; then php -dmemory_limit=-1 vendor/bin/phpcs -p php -dmemory_limit=-1 vendor/bin/phpstan analyse npm run lint else if [[ "$1" =~ "Browser" ]]; then echo "Assuming a browsertest and starting octane" ./artisan octane:start --port=80 & echo "127.0.0.1 kolab.local admin.kolab.local reseller.kolab.local" >> /etc/hosts fi php \ -dmemory_limit=-1 \ vendor/bin/phpunit \ --exclude-group "$EXCLUDE_GROUPS" \ --verbose \ --stop-on-defect \ --stop-on-error \ --stop-on-failure \ $@ fi diff --git a/docker/webapp/update-source.sh b/docker/webapp/update-source.sh index 8088a556..ed25b307 100755 --- a/docker/webapp/update-source.sh +++ b/docker/webapp/update-source.sh @@ -1,13 +1,12 @@ #!/bin/bash rsync -av \ --exclude=vendor \ --exclude=composer.lock \ --exclude=node_modules \ --exclude=package-lock.json \ --exclude=public \ --exclude=storage \ --exclude=resources/build \ - --exclude=bootstrap \ --exclude=.gitignore \ /src/kolabsrc.orig/ /opt/app-root/src/ | tee /tmp/rsync.output diff --git a/docker/webapp/update.sh b/docker/webapp/update.sh index 5a672a43..f11f95f5 100755 --- a/docker/webapp/update.sh +++ b/docker/webapp/update.sh @@ -1,24 +1,27 @@ #!/bin/bash set -e set -x /update-source.sh cd /opt/app-root/src/ rm -rf storage/framework mkdir -p storage/framework/{sessions,views,cache} +if grep -e "composer.json" -e "app" /tmp/rsync.output; then + rm composer.lock + # Must be before the first artisan command because those can fail otherwise) + php -dmemory_limit=-1 $(command -v composer) install +fi + find bootstrap/cache/ -type f ! -name ".gitignore" -delete ./artisan clear-compiled ./artisan cache:clear -if grep -e "composer.json" -e "app" /tmp/rsync.output; then - php -dmemory_limit=-1 $(command -v composer) update -fi - # Only run npm if something relevant was updated if grep -e "package.json" -e "resources" /tmp/rsync.output; then npm run dev fi -./artisan octane:reload +# Can fail if octane is not running +./artisan octane:reload || :