From b1f1fd7cd3cfb43b18c7a3aa22ddcd9e319d10d8 Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Fri, 23 Oct 2026 10:59:31 -0400 Subject: [PATCH 1/2] test: load the Gutenberg plugin when WP_TESTS_LOAD_GUTENBERG is set --- tests/bootstrap.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 10b1d3d3..239915fb 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -23,7 +23,11 @@ tests_add_filter( 'wp_loaded', '_output_wp_version' ); function _output_wp_version() { - echo 'Running on WordPress ' . esc_html( get_bloginfo( 'version' ) ) . "...\n"; + echo 'Running on WordPress ' . esc_html( get_bloginfo( 'version' ) ); + if ( defined( 'GUTENBERG_VERSION' ) ) { + echo ' with Gutenberg ' . esc_html( GUTENBERG_VERSION ); + } + echo "...\n"; } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); @@ -39,6 +43,11 @@ function _manually_load_plugin() { // Load WP-GraphQL require_once WP_TEST_PLUGINS_DIR . '/wp-graphql/wp-graphql.php'; + + // Load the Gutenberg plugin when asked to, to test against unreleased block changes. + if ( getenv( 'WP_TESTS_LOAD_GUTENBERG' ) ) { + require_once WP_TEST_PLUGINS_DIR . '/gutenberg/gutenberg.php'; + } } require $_tests_dir . '/includes/bootstrap.php'; From 0fbd588a6a26b006aaaeb2f9eb8d341ca2ae311a Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Fri, 23 Oct 2026 10:59:32 -0400 Subject: [PATCH 2/2] ci: run the unit tests daily against the latest Gutenberg plugin --- .github/workflows/test-plugin-gutenberg.yml | 63 +++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/test-plugin-gutenberg.yml diff --git a/.github/workflows/test-plugin-gutenberg.yml b/.github/workflows/test-plugin-gutenberg.yml new file mode 100644 index 00000000..1139aa44 --- /dev/null +++ b/.github/workflows/test-plugin-gutenberg.yml @@ -0,0 +1,63 @@ +name: Test Plugin (Gutenberg) + +# Runs the unit tests with the latest Gutenberg plugin active, to catch block +# changes before they reach a WordPress release. Kept out of `test-plugin.yml` +# so a Gutenberg breakage never blocks the Release workflow, which calls it. + +on: + pull_request: + paths-ignore: + - '**/*.md' + schedule: + - cron: '17 6 * * *' + workflow_dispatch: + +concurrency: + group: test-plugin-gutenberg-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + test_plugin_gutenberg: + runs-on: ubuntu-22.04 + name: WordPress 7.1 + Gutenberg, PHP 8.3 + env: + PHP_VERSION: '8.3' + WP_VERSION: '7.1' + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Create Docker Containers + env: + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + run: | + docker compose build \ + --build-arg WP_VERSION="$WP_VERSION" \ + --build-arg PHP_VERSION="$PHP_VERSION" + docker compose up -d + + - name: Wait for db + run: | + while ! mysqladmin ping --host=127.0.0.1 --port=33066 --password="$MYSQL_ROOT_PASSWORD" --silent; do + sleep 1 + done + + - name: Setup testing framework + run: docker exec "$(docker compose ps -q wordpress)" init-testing-environment.sh + + - name: Install and activate WP GraphQL + run: docker exec --workdir=/var/www/html/wp-content/plugins/wp-graphql-content-blocks "$(docker compose ps -q wordpress)" wp plugin install wp-graphql --activate --allow-root + + # The test bootstrap loads it when WP_TESTS_LOAD_GUTENBERG is set. + - name: Install Gutenberg + run: docker exec --workdir=/var/www/html/wp-content/plugins/wp-graphql-content-blocks "$(docker compose ps -q wordpress)" wp plugin install gutenberg --allow-root + + - name: Install Dependencies + run: docker exec -w /var/www/html/wp-content/plugins/wp-graphql-content-blocks "$(docker compose ps -q wordpress)" composer install + + - name: Run unit tests + run: docker exec -e WP_TESTS_LOAD_GUTENBERG=1 -w /var/www/html/wp-content/plugins/wp-graphql-content-blocks "$(docker compose ps -q wordpress)" composer test