From 155b9d42f47518aebd3400f3da159e6380961f52 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 16:49:36 +0000 Subject: [PATCH 1/2] Retry the database server setup when it fails in the background The MySQL setup runs in the background alongside setup-php and the Ghostscript install. The action unpacks its binaries with the system tar, which fails to load libpcre2-8.so.0 while apt upgrades that library. Let the background step fail softly and retry it in the foreground once the other setup steps are done. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5qGVcfTHmYNMmJgdGu --- .github/workflows/reusable-functional.yml | 35 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-functional.yml b/.github/workflows/reusable-functional.yml index a247216..a3063e0 100644 --- a/.github/workflows/reusable-functional.yml +++ b/.github/workflows/reusable-functional.yml @@ -118,12 +118,16 @@ jobs: # Downloading and starting the database server is the slowest part of the # setup, and nothing needs it until the test database is prepared. Run it # in the background alongside the PHP and Composer setup below, and wait - # for it right before it is first used. The action only downloads its own - # binaries, so it cannot contend with apt, Homebrew or Chocolatey. + # for it right before it is first used. The action downloads its own + # binaries, but unpacks them with the system `tar`, which apt can break + # for a moment by upgrading a shared library it loads, such as libpcre2, + # while setup-php or the Ghostscript install run. A failure here is + # therefore retried once those are done, see below. - name: Setup MySQL Server id: setup-mysql if: ${{ inputs.dbtype != 'sqlite' }} background: true + continue-on-error: true uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1 with: mysql-version: ${{ inputs.mysql }} @@ -225,10 +229,35 @@ jobs: # Waits for the database server and the Windows dependencies. `wait-all` # rather than `wait: setup-mysql`, as either background step may have been - # skipped by its condition. A failure in either fails the job here. + # skipped by its condition. A failure of the Windows dependencies fails the + # job here, one of the database server is retried below. - name: Wait for background setup steps wait-all: + - name: Clean up after the failed MySQL Server setup + if: ${{ inputs.dbtype != 'sqlite' && steps.setup-mysql.outcome == 'failure' }} + shell: bash + run: | + echo "::warning::Setting up the database server failed, retrying." + if command -v pkill > /dev/null 2>&1; then + pkill -x mysqld || true + pkill -x mariadbd || true + fi + + - name: Setup MySQL Server (retry) + if: ${{ inputs.dbtype != 'sqlite' && steps.setup-mysql.outcome == 'failure' }} + uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1 + with: + mysql-version: ${{ inputs.mysql }} + auto-start: true + root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }} + user: ${{ env.WP_CLI_TEST_DBUSER}} + password: ${{ env.WP_CLI_TEST_DBPASS}} + my-cnf: | + ${{ steps.mysql-config.outputs.auth-config || 'default_authentication_plugin=mysql_native_password' }} + ${{ inputs.dbtype == 'mariadb' && '[client]' || '' }} + ${{ inputs.dbtype == 'mariadb' && 'disable-ssl-verify-server-cert' || '' }} + - name: Remove system MySQL binary if: ${{ inputs.dbtype != 'sqlite' && !startsWith(inputs.os, 'windows') && !startsWith(inputs.os, 'macos') }} run: sudo rm -f /usr/bin/mysql /usr/bin/mysqldump From d075a687b4e513e63ecc692d7b19ba95c533a097 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 16:53:41 +0000 Subject: [PATCH 2/2] Set up the database server in the foreground Replaces the retry from the previous commit. The action unpacks its binaries with the system tar, which fails to load libpcre2-8.so.0 while setup-php or the Ghostscript install upgrade that library with apt. Running it before those steps instead of in the background avoids the race altogether. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5qGVcfTHmYNMmJgdGu --- .github/workflows/reusable-functional.yml | 44 ++++------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/.github/workflows/reusable-functional.yml b/.github/workflows/reusable-functional.yml index a3063e0..d075911 100644 --- a/.github/workflows/reusable-functional.yml +++ b/.github/workflows/reusable-functional.yml @@ -115,19 +115,12 @@ jobs: echo "authentication_policy=mysql_native_password," >> $GITHUB_OUTPUT echo "EOF" >> $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. Run it - # in the background alongside the PHP and Composer setup below, and wait - # for it right before it is first used. The action downloads its own - # binaries, but unpacks them with the system `tar`, which apt can break - # for a moment by upgrading a shared library it loads, such as libpcre2, - # while setup-php or the Ghostscript install run. A failure here is - # therefore retried once those are done, see below. + # Not run in the background alongside the setup below: the action unpacks + # its binaries with the system `tar`, which fails to load libpcre2 while + # setup-php or the Ghostscript install upgrade that library with apt. - name: Setup MySQL Server id: setup-mysql if: ${{ inputs.dbtype != 'sqlite' }} - background: true - continue-on-error: true uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1 with: mysql-version: ${{ inputs.mysql }} @@ -227,37 +220,12 @@ jobs: env: COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} - # Waits for the database server and the Windows dependencies. `wait-all` - # rather than `wait: setup-mysql`, as either background step may have been - # skipped by its condition. A failure of the Windows dependencies fails the - # job here, one of the database server is retried below. + # Waits for the Windows dependencies. `wait-all` rather than a named `wait`, + # as the background step may have been skipped by its condition. A failure + # there fails the job here. - name: Wait for background setup steps wait-all: - - name: Clean up after the failed MySQL Server setup - if: ${{ inputs.dbtype != 'sqlite' && steps.setup-mysql.outcome == 'failure' }} - shell: bash - run: | - echo "::warning::Setting up the database server failed, retrying." - if command -v pkill > /dev/null 2>&1; then - pkill -x mysqld || true - pkill -x mariadbd || true - fi - - - name: Setup MySQL Server (retry) - if: ${{ inputs.dbtype != 'sqlite' && steps.setup-mysql.outcome == 'failure' }} - uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1 - with: - mysql-version: ${{ inputs.mysql }} - auto-start: true - root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }} - user: ${{ env.WP_CLI_TEST_DBUSER}} - password: ${{ env.WP_CLI_TEST_DBPASS}} - my-cnf: | - ${{ steps.mysql-config.outputs.auth-config || 'default_authentication_plugin=mysql_native_password' }} - ${{ inputs.dbtype == 'mariadb' && '[client]' || '' }} - ${{ inputs.dbtype == 'mariadb' && 'disable-ssl-verify-server-cert' || '' }} - - name: Remove system MySQL binary if: ${{ inputs.dbtype != 'sqlite' && !startsWith(inputs.os, 'windows') && !startsWith(inputs.os, 'macos') }} run: sudo rm -f /usr/bin/mysql /usr/bin/mysqldump