From cf8ce469ecc9de5d664f86a9c2a76216862bdb44 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Tue, 18 Feb 2020 17:56:32 +0800 Subject: [PATCH 1/8] Update e2e tests to use wp-env when run in travis --- .travis.yml | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f49bc702e765c..0044945b13aa52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,44 +53,12 @@ install: - npm run build - | if [[ "$INSTALL_WORDPRESS" = "true" ]]; then - # Download and unpack WordPress. - curl -sL https://github.com/WordPress/WordPress/archive/master.zip -o /tmp/wordpress-latest.zip - unzip -q /tmp/wordpress-latest.zip -d /tmp - mkdir -p wordpress/src - mv /tmp/WordPress-master/* wordpress/src - - # Create the upload directory with permissions that Travis can handle. - mkdir -p wordpress/src/wp-content/uploads - chmod 767 wordpress/src/wp-content/uploads - - # Grab the tools we need for WordPress' local-env. - curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip - unzip -q /tmp/wordpress-develop.zip -d /tmp - mv \ - /tmp/wordpress-develop-master/tools \ - /tmp/wordpress-develop-master/tests \ - /tmp/wordpress-develop-master/.env \ - /tmp/wordpress-develop-master/docker-compose.yml \ - /tmp/wordpress-develop-master/wp-cli.yml \ - /tmp/wordpress-develop-master/*config-sample.php \ - /tmp/wordpress-develop-master/package.json wordpress - - # Install WordPress. The additional dependencies are required by the copied `wordpress-develop` tools. - cd wordpress - npm install dotenv wait-on - npm run env:start - sleep 10 - npm run env:install - cd .. - - # Connect Gutenberg to WordPress. - npm run env connect - npm run env cli plugin activate gutenberg + npm run wp-env start fi - | if [[ "$E2E_ROLE" = "author" ]]; then - npm run env cli -- user create author author@example.com --role=author --user_pass=authpass - npm run env cli -- post update 1 --post_author=2 + npm run wp-env run tests-cli user create author author@example.com --role=author --user_pass=authpass + npm run wp-env run tests-cli post update 1 --post_author=2 fi jobs: From 03ed63c6aabdd97a053aa05fa39809d0e11f5443 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 19 Feb 2020 08:24:24 +0800 Subject: [PATCH 2/8] Use wp command --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0044945b13aa52..e48ea25987ca8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,8 +57,8 @@ install: fi - | if [[ "$E2E_ROLE" = "author" ]]; then - npm run wp-env run tests-cli user create author author@example.com --role=author --user_pass=authpass - npm run wp-env run tests-cli post update 1 --post_author=2 + npm run wp-env run tests-cli wp user create author author@example.com --role=author --user_pass=authpass + npm run wp-env run tests-cli wp post update 1 --post_author=2 fi jobs: From b5f8ea157c9b823aee6730056a331c06eb6bf1bd Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 21 Feb 2020 05:50:26 +0800 Subject: [PATCH 3/8] Use quotes around command to pass to docker container --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e48ea25987ca8b..87cc01664e8468 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,8 +57,8 @@ install: fi - | if [[ "$E2E_ROLE" = "author" ]]; then - npm run wp-env run tests-cli wp user create author author@example.com --role=author --user_pass=authpass - npm run wp-env run tests-cli wp post update 1 --post_author=2 + npm run wp-env run tests-cli "wp user create author author@example.com --role=author --user_pass=authpass" + npm run wp-env run tests-cli "wp post update 1 --post_author=2" fi jobs: From 48e803a933fb9682f9de9e3ad9da6a22df807ece Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 4 Mar 2020 16:44:35 +0800 Subject: [PATCH 4/8] Set script debug to false --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 87cc01664e8468..30146a18ff36a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,7 @@ install: - npm run build - | if [[ "$INSTALL_WORDPRESS" = "true" ]]; then + echo '{ "config": { "SCRIPT_DEBUG": false } }' > wp-env.override.json npm run wp-env start fi - | From 172d59b026285c83cd1c3221eaaf115d6acb636b Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 4 Mar 2020 16:51:47 +0800 Subject: [PATCH 5/8] Try chmod on the uploads folder --- packages/env/lib/commands/start.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/env/lib/commands/start.js b/packages/env/lib/commands/start.js index 16aa48d40302e7..e7ab8f6a4249d5 100644 --- a/packages/env/lib/commands/start.js +++ b/packages/env/lib/commands/start.js @@ -85,6 +85,15 @@ module.exports = async function start( { spinner, debug } ) { config.coreSource.path, config.coreSource.testsPath ); + + // Ensure the tests uploads folder is writeable for travis, + // creating the folder if necessary. + const testsUploadsPath = path.join( + config.coreSource.testsPath, + 'wp-content/uploads' + ); + await fs.mkdir( testsUploadsPath, { recursive: true } ); + await fs.chmod( testsUploadsPath, 0o0767 ); } } )(), From 8a6638048f5ad69d6edeee72b6f86971458c45d3 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 4 Mar 2020 17:09:32 +0800 Subject: [PATCH 6/8] Adding missing . --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 30146a18ff36a7..5efa34e07dbdd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ install: - npm run build - | if [[ "$INSTALL_WORDPRESS" = "true" ]]; then - echo '{ "config": { "SCRIPT_DEBUG": false } }' > wp-env.override.json + echo '{ "config": { "SCRIPT_DEBUG": false } }' > .wp-env.override.json npm run wp-env start fi - | From a9ad63f5afe3c1cbc82a3dbd141899bb735f767d Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Thu, 21 May 2020 11:20:46 +0800 Subject: [PATCH 7/8] Remove duplicate wp-env start commands --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5efa34e07dbdd0..bcdff36ae6d98b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,14 +131,12 @@ jobs: env: WP_ENV_TESTS_PORT=8887 WP_ENV_PORT=8886 # TODO: Remove tests port when scripts/env is replaced with wp-env. script: - chmod -R 767 ./build - - npm run wp-env start - npm run test-php && npm run test-unit-php-multisite - name: PHP unit tests (PHP 5.6) env: LOCAL_PHP=5.6-fpm WP_ENV_TESTS_PORT=8887 WP_ENV_PORT=8886 # TODO: Remove tests port when scripts/env is replaced with wp-env. script: - chmod -R 767 ./build - - npm run wp-env start - npm run test-php && npm run test-unit-php-multisite - name: E2E tests (Admin) (1/4) From 49914319cd7aba33666c3e486fa622f0da63c036 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Thu, 21 May 2020 11:49:16 +0800 Subject: [PATCH 8/8] Ensure PHP binary is defined --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bcdff36ae6d98b..c0f1593784b29c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,7 @@ install: - npm run build - | if [[ "$INSTALL_WORDPRESS" = "true" ]]; then - echo '{ "config": { "SCRIPT_DEBUG": false } }' > .wp-env.override.json + echo '{ "config": { "SCRIPT_DEBUG": false, "WP_PHP_BINARY": "php" } }' > .wp-env.override.json npm run wp-env start fi - |