From ca91f034742ff3489344d6d75a7d1ecf6c9b4a56 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 08:15:30 +0000 Subject: [PATCH] Start MySQL in the background while PHP is set up Use the new background/wait-all step keywords so the database server download and start overlaps with the PHP and Composer setup. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XKUgMbWCUXHvDzgDBPWcZA --- .github/workflows/reusable-testing.yml | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/reusable-testing.yml b/.github/workflows/reusable-testing.yml index a9c4c03c..f2826009 100644 --- a/.github/workflows/reusable-testing.yml +++ b/.github/workflows/reusable-testing.yml @@ -59,6 +59,24 @@ jobs: id: check_files run: echo "files_exists=$([ -f composer.json ] && [ -f behat.yml ] && echo true || echo false)" >> "$GITHUB_OUTPUT" + # Downloading and starting the database server is the slowest part of the + # setup, and nothing needs it until the test database is prepared, so it + # runs in the background alongside the PHP and Composer setup below. The + # action only downloads its own binaries, so it cannot contend with apt. + - name: Setup MySQL Server + id: setup-mysql + if: ${{ inputs.dbtype != 'sqlite' }} + background: true + uses: shogo82148/actions-setup-mysql@334a29f22d90428932f75b11e0d5fcc00bb6b4f4 # v1 + with: + mysql-version: '8.0' # Standard MySQL version for these tests + auto-start: true + root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }} + user: ${{ env.WP_CLI_TEST_DBUSER}} + password: ${{ env.WP_CLI_TEST_DBPASS}} + my-cnf: | + default_authentication_plugin=mysql_native_password + # Ghostscript ships with the GitHub hosted images, so the `apt-get update` # this used to run unconditionally cost every job ~25s for a package that # was already there. Keep the install as a fallback in case a future image @@ -103,18 +121,10 @@ jobs: run: | sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml - - name: Setup MySQL Server - id: setup-mysql - if: ${{ inputs.dbtype != 'sqlite' }} - uses: shogo82148/actions-setup-mysql@334a29f22d90428932f75b11e0d5fcc00bb6b4f4 # v1 - with: - mysql-version: '8.0' # Standard MySQL version for these tests - auto-start: true - root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }} - user: ${{ env.WP_CLI_TEST_DBUSER}} - password: ${{ env.WP_CLI_TEST_DBPASS}} - my-cnf: | - default_authentication_plugin=mysql_native_password + # Waits for the database server started in the background above. `wait-all` + # rather than `wait: setup-mysql`, as the step is skipped for SQLite legs. + - name: Wait for the MySQL server + wait-all: - name: Prepare test database if: steps.check_files.outputs.files_exists == 'true' && inputs.dbtype != 'sqlite'