From e91ebec7df4469ca7e07e62e75fcc7f2fda1c278 Mon Sep 17 00:00:00 2001 From: Colin Stewart <79332690+costdev@users.noreply.github.com> Date: Thu, 9 Jan 2025 00:37:08 +0000 Subject: [PATCH] Workflows: Prime a WP install and skip install for the actual test run. (#256) The PHPUnit test workflow now performs a dummy run to prime the WordPress install for tests. When this completes, the actual test run is performed, with the `WP_TESTS_SKIP_INSTALL` environment variable set to `1`. Since many of the tests must run in separate processes, this change means that installation occurs only once, instead of once per process. --- .github/workflows/phpunit-tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index d433dd4..eef2b75 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -41,5 +41,10 @@ jobs: - name: Setup tests run: bash bin/install-wp-tests.sh wordpress_tests root root 127.0.0.1 latest true + - name: Prime the WordPress install for tests + id: prime-tests + run: XDEBUG_MODE=off phpunit${{ matrix.multisite && ' -c tests/phpunit/multisite.xml' || '' }} --filter gha_install_wp > /dev/null 2>&1 + - name: Run tests - run: XDEBUG_MODE=off phpunit${{ matrix.multisite && ' -c tests/phpunit/multisite.xml' || '' }} + if: steps.prime-tests.outcome == 'success' + run: XDEBUG_MODE=off WP_TESTS_SKIP_INSTALL=1 phpunit${{ matrix.multisite && ' -c tests/phpunit/multisite.xml' || '' }}