From 0a1e18aa99ed82bac4f47e131f47699231eebca8 Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 09:33:26 -0500 Subject: [PATCH 1/8] Add "latest" to testing matrix --- .github/workflows/test-plugin.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index 5a091c52..98aa9968 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: php: [ '8.2', '7.4' ] - wordpress: [ '6.5', '6.4', '6.3', '6.2', '6.1' ] + wordpress: [ 'latest', '6.5', '6.4', '6.3', '6.2', '6.1' ] exclude: - php: 8.2 wordpress: 6.1 @@ -24,6 +24,8 @@ jobs: wordpress: 6.4 - php: 7.4 wordpress: 6.5 + - php: 7.4 + wordpress: 'latest' fail-fast: false name: WordPress ${{ matrix.wordpress }}, PHP ${{ matrix.php }} steps: From a32b13b919a67dc96bdd3a6964ef84192733281a Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 09:40:03 -0500 Subject: [PATCH 2/8] Always use "latest" image as we're downloading WordPress separately --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 239394ef..feb36564 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,7 +1,7 @@ ARG WP_VERSION ARG PHP_VERSION -FROM wordpress:${WP_VERSION}-php${PHP_VERSION} +FROM wordpress:latest # Save the build args for use by the runtime environment ENV WP_VERSION=${WP_VERSION} From 94e16ad2d3f739a887635502ab8e69ac4231d150 Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 09:40:13 -0500 Subject: [PATCH 3/8] Echo the WordPress build file --- bin/_lib.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/_lib.sh b/bin/_lib.sh index 7bd66e66..5e526742 100644 --- a/bin/_lib.sh +++ b/bin/_lib.sh @@ -12,7 +12,7 @@ download() { } install_wordpress() { - + if [ -d $WP_CORE_DIR ]; then return; fi @@ -51,6 +51,8 @@ install_wordpress() { fi download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php + + cat $WP_CORE_DIR/wp-content/version.php } recreate_db() { @@ -113,7 +115,7 @@ configure_wordpress() { echo "Setting up WordPress..." export WP_CLI_CONFIG_PATH=${WP_CLI_CONFIG_PATH}; - + wp config create --dbname="$DB_NAME" --dbuser="$DB_USER" --dbpass="$DB_PASS" --dbhost="$DB_HOST" --skip-check --force=true wp core install --url=$WP_DOMAIN --title=Test --admin_user=$ADMIN_USERNAME --admin_password=$ADMIN_PASSWORD --admin_email=$ADMIN_EMAIL wp rewrite structure '/%year%/%monthnum%/%postname%/' --hard From 49aea58440c7201c55846dddecfc7a0f19265c9c Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 09:51:10 -0500 Subject: [PATCH 4/8] Use wp-cli to echo core version for confirmation --- .github/actions/setup-wordpress/action.yml | 3 ++- bin/_lib.sh | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-wordpress/action.yml b/.github/actions/setup-wordpress/action.yml index ca998521..7ca03eec 100644 --- a/.github/actions/setup-wordpress/action.yml +++ b/.github/actions/setup-wordpress/action.yml @@ -25,4 +25,5 @@ runs: shell: bash run: | cp .env.dist .env - composer run install-test-env \ No newline at end of file + composer run install-test-env + wp core version \ No newline at end of file diff --git a/bin/_lib.sh b/bin/_lib.sh index 5e526742..e11d70e2 100644 --- a/bin/_lib.sh +++ b/bin/_lib.sh @@ -51,8 +51,6 @@ install_wordpress() { fi download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php - - cat $WP_CORE_DIR/wp-content/version.php } recreate_db() { From 6ab31668ac76eedc448df3ad883677bf41b502ed Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 09:55:50 -0500 Subject: [PATCH 5/8] Echo WP version from the appropriate workflow --- .github/actions/setup-wordpress/action.yml | 3 +-- .github/workflows/test-plugin.yml | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-wordpress/action.yml b/.github/actions/setup-wordpress/action.yml index 7ca03eec..ca998521 100644 --- a/.github/actions/setup-wordpress/action.yml +++ b/.github/actions/setup-wordpress/action.yml @@ -25,5 +25,4 @@ runs: shell: bash run: | cp .env.dist .env - composer run install-test-env - wp core version \ No newline at end of file + composer run install-test-env \ No newline at end of file diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index 98aa9968..16311d0d 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -51,7 +51,9 @@ jobs: - name: Setup testing framework working-directory: ./ - run: docker exec -e COVERAGE=1 $(docker-compose ps -q wordpress) init-testing-environment.sh + run: | + docker exec -e COVERAGE=1 $(docker-compose ps -q wordpress) init-testing-environment.sh + docker exec --workdir=/var/www/html/wp-content/plugins/wp-graphql-content-blocks $(docker-compose ps -q wordpress) wp core version - name: Install and activate WP GraphQL working-directory: ./ From 168142b1d2e9bae56fa54a0adfefb8cde8bca0b8 Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 09:57:59 -0500 Subject: [PATCH 6/8] We need to allow root on the version command --- .github/workflows/test-plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index 16311d0d..dda69ea2 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -53,7 +53,7 @@ jobs: working-directory: ./ run: | docker exec -e COVERAGE=1 $(docker-compose ps -q wordpress) init-testing-environment.sh - docker exec --workdir=/var/www/html/wp-content/plugins/wp-graphql-content-blocks $(docker-compose ps -q wordpress) wp core version + docker exec --workdir=/var/www/html/wp-content/plugins/wp-graphql-content-blocks $(docker-compose ps -q wordpress) wp core version --allow-root - name: Install and activate WP GraphQL working-directory: ./ From 882c649d05c0ef5dfda654557a11608ee8191a43 Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 10:03:44 -0500 Subject: [PATCH 7/8] Use the Dockerfile to try to get the correct version. --- .docker/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index feb36564..3f66ad1e 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -17,6 +17,10 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli && mv wp-cli.phar /usr/local/bin/wp \ && wp --info +RUN wp core update --version=${WP_VERSION} --force + && wp core update-db --force + && wp core version + RUN set -e \ ; apt-get -qq update \ ; apt-get install \ From 2aea6fc2ecae19bc8c9858bfe54c4f56dfa7de0b Mon Sep 17 00:00:00 2001 From: Chris Wiegman Date: Wed, 10 Apr 2024 10:04:56 -0500 Subject: [PATCH 8/8] Ensure we can split the bash command between lines --- .docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 3f66ad1e..5ae5d372 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -17,8 +17,8 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli && mv wp-cli.phar /usr/local/bin/wp \ && wp --info -RUN wp core update --version=${WP_VERSION} --force - && wp core update-db --force +RUN wp core update --version=${WP_VERSION} --force \ + && wp core update-db --force \ && wp core version RUN set -e \