From 2f19b7098f5e8d259e1ace854083234cbffe7037 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Tue, 21 May 2024 16:33:11 -0600 Subject: [PATCH 1/2] Remove the need for the wpcli container --- Makefile | 5 ++++- docker-compose.yml | 22 +--------------------- {.buildkite => scripts}/setup-test-site.sh | 10 ++++++++++ 3 files changed, 15 insertions(+), 22 deletions(-) rename {.buildkite => scripts}/setup-test-site.sh (82%) diff --git a/Makefile b/Makefile index 87e3460f2..21a44f057 100644 --- a/Makefile +++ b/Makefile @@ -190,7 +190,7 @@ test-rust-doc: test-server: stop-server rm -rf test_credentials && touch test_credentials && chmod 777 test_credentials docker-compose up -d - docker-compose run wpcli + docker exec -i wordpress /bin/bash < ./scripts/setup-test-site.sh stop-server: delete-wp-plugins-backup docker-compose down @@ -235,6 +235,9 @@ dev-server: mkdir -p .wordpress docker-compose up +prepare-dev-server: + docker exec -i wordpress /bin/bash < ./scripts/setup-test-site.sh + setup-rust: RUST_TOOLCHAIN=stable $(MAKE) setup-rust-toolchain RUST_TOOLCHAIN=$(rust_nightly_toolchain) $(MAKE) setup-rust-toolchain diff --git a/docker-compose.yml b/docker-compose.yml index e7496eae6..e0cafb8c0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: - '80:80' volumes: - .wordpress:/var/www/html + - ./test_credentials:/tmp/test_credentials environment: WORDPRESS_DB_HOST: mysql WORDPRESS_DB_USER: wordpress @@ -25,27 +26,6 @@ services: timeout: 1s retries: 30 - wpcli: - image: 'public.ecr.aws/docker/library/wordpress:cli' - user: 33:33 # Fixes permissions issues with writing files - volumes: - - ./.buildkite/setup-test-site.sh:/setup-test-site.sh:ro - - ./.wordpress/wp-config.php:/var/www/html/wp-config.php:ro - - ./test_credentials:/tmp/test_credentials - environment: - WORDPRESS_DB_HOST: mysql - WORDPRESS_DB_USER: wordpress - WORDPRESS_DB_PASSWORD: wordpress - WORDPRESS_DB_NAME: wordpress - depends_on: - mysql: - condition: service_healthy - wordpress: - condition: service_healthy - entrypoint: ["/setup-test-site.sh"] - profiles: - - donotstart - mysql: image: 'public.ecr.aws/docker/library/mysql:8.0' ports: diff --git a/.buildkite/setup-test-site.sh b/scripts/setup-test-site.sh similarity index 82% rename from .buildkite/setup-test-site.sh rename to scripts/setup-test-site.sh index fbcb0e926..bbd4d990d 100755 --- a/.buildkite/setup-test-site.sh +++ b/scripts/setup-test-site.sh @@ -8,6 +8,13 @@ set -e # for each WordPress version – if there are issues with DB migrations, different default themes # available, etc we don't want to have to deal with them. +curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output /usr/bin/wp +chmod +x /usr/bin/wp + +# Run all the commands below as `www-data` (because that's what WordPress uses itself, so there shouldn't +# be any weird permissions issues) +su -s /bin/bash www-data + ## Install WordPress wp core download --force @@ -32,8 +39,11 @@ wp plugin install wordpress-importer --activate wp import /tmp/testdata.xml --authors=create ## Then clean up the importer plugin +wp plugin deactivate wordpress-importer wp plugin delete wordpress-importer +wp plugin install classic-editor --activate + { printf "http://localhost\ntest@example.com\n" ## Create an Application password for the admin user, and store it where it can be used by the test suite From 1b386701e4b76e0686e2a6df31e43a927469a6a4 Mon Sep 17 00:00:00 2001 From: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> Date: Tue, 21 May 2024 16:51:01 -0600 Subject: [PATCH 2/2] Update scripts/setup-test-site.sh Co-authored-by: Oguz Kocer --- scripts/setup-test-site.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/setup-test-site.sh b/scripts/setup-test-site.sh index bbd4d990d..07ddef152 100755 --- a/scripts/setup-test-site.sh +++ b/scripts/setup-test-site.sh @@ -42,7 +42,6 @@ wp import /tmp/testdata.xml --authors=create wp plugin deactivate wordpress-importer wp plugin delete wordpress-importer -wp plugin install classic-editor --activate { printf "http://localhost\ntest@example.com\n"