diff --git a/.circleci/config.yml b/.circleci/config.yml index 5abe12acbc..4f8e367399 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ jobs: - run: name: Run acceptance tests command: | - docker-compose run codeception --steps --debug -vvv --html --xml + docker-compose run -e SKIP_DEPS=1 codeception --steps --debug -vvv --html --xml - store_artifacts: path: tests/_output - store_test_results: @@ -126,7 +126,7 @@ jobs: - run: name: Run acceptance tests command: | - docker-compose run -e MULTISITE=1 codeception --steps --debug -vvv --html --xml + docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception --steps --debug -vvv --html --xml - store_artifacts: path: tests/_output - store_test_results: diff --git a/README.md b/README.md index 13b9bd4ea9..a70bb00a85 100644 --- a/README.md +++ b/README.md @@ -197,4 +197,9 @@ If you’re on a Mac, you can open vnc://localhost:5900 in Safari to watch the t To run tests: ```sh $ ./do test:acceptance -``` \ No newline at end of file +``` + +You can skip installation of composer dependencies using --skip-deps parameter. +```sh +$ ./do test:acceptance --skip-deps +``` diff --git a/RoboFile.php b/RoboFile.php index 20a7602e23..27b4be4a3a 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -231,19 +231,19 @@ class RoboFile extends \Robo\Tasks { return $this->_exec($command); } - function testAcceptance($opts=['file' => null, 'keep-deps' => false]) { + function testAcceptance($opts=['file' => null, 'skip-deps' => false]) { return $this->_exec( 'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' . - ($opts['keep-deps'] ? '-e KEEP_DEPS=1 ' : '') . + ($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') . 'codeception --steps --debug -vvv ' . '-f ' . ($opts['file'] ? $opts['file'] : '') ); } - function testAcceptanceMultisite($opts=['file' => null, 'keep-deps' => false]) { + function testAcceptanceMultisite($opts=['file' => null, 'skip-deps' => false]) { return $this->_exec( 'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' . - ($opts['keep-deps'] ? '-e KEEP_DEPS=1 ' : '') . + ($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') . '-e MULTISITE=1 ' . 'codeception --steps --debug -vvv' . '-f ' . ($opts['file'] ? $opts['file'] : '') diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index fc085fe4b6..3979eb779f 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -94,14 +94,9 @@ fi sed -i "s/define( *'WP_DEBUG', false *);/define('WP_DEBUG', true);define('WP_DEBUG_DISPLAY', true);define('WP_DEBUG_LOG', true);/" ./wp-config.php # Load Composer dependencies -# Set KEEP_DEPS environment flag to not redownload them on each run, only for the 1st time, useful for development. -# Example: docker-compose run -e KEEP_DEPS=1 codeception ... -# Don't forget to restore your original /vendor folder from /vendor_backup manually or by running acceptance tests without this flag. -if [[ -z "${KEEP_DEPS}" ]]; then - rm -rf /project/vendor_backup -fi -if [ ! -d "/project/vendor_backup" ]; then - mv /project/vendor /project/vendor_backup +# Set SKIP_DEPS environment flag to not download them. E.g. you have downloaded them yourself +# Example: docker-compose run -e SKIP_DEPS=1 codeception ... +if [[ -z "${SKIP_DEPS}" ]]; then cd /project php composer.phar install fi @@ -111,9 +106,4 @@ cd /wp-core/wp-content/plugins/mailpoet /project/vendor/bin/codecept run acceptance -c codeception.acceptance.yml $@ exitcode=$? -if [[ -z "${KEEP_DEPS}" ]]; then - rm -rf /project/vendor - mv /project/vendor_backup /project/vendor -fi - exit $exitcode