Skip to content

Commit c2a7ab8

Browse files
committed
Make MySQL conditional check more Windows compatible
The bash if/else won't work in PowerShell. Follow-up to #209
1 parent 4ee01f6 commit c2a7ab8

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

.github/workflows/reusable-testing.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -540,20 +540,15 @@ jobs:
540540
# Bust the cache at least once a month - output format: YYYY-MM.
541541
custom-cache-suffix: $(date -u "+%Y-%m")
542542

543+
# MySQL 8.4 requires explicit loading of mysql_native_password plugin
543544
- name: Determine MySQL authentication configuration
544545
id: mysql-config
545-
if: ${{ matrix.dbtype != 'sqlite' }}
546+
if: ${{ matrix.dbtype != 'sqlite' && matrix.mysql == 'mysql-8.4' }}
546547
run: |
547-
if [[ "${{ matrix.mysql }}" == *"mysql-8.4"* ]]; then
548-
# MySQL 8.4 requires explicit loading of mysql_native_password plugin
549-
echo "auth-config<<EOF" >> $GITHUB_OUTPUT
550-
echo "mysql_native_password=ON" >> $GITHUB_OUTPUT
551-
echo "authentication_policy=mysql_native_password," >> $GITHUB_OUTPUT
552-
echo "EOF" >> $GITHUB_OUTPUT
553-
else
554-
# MySQL 5.6, 5.7, 8.0 and MariaDB use the legacy configuration
555-
echo "auth-config=default_authentication_plugin=mysql_native_password" >> $GITHUB_OUTPUT
556-
fi
548+
echo "auth-config<<EOF" >> $GITHUB_OUTPUT
549+
echo "mysql_native_password=ON" >> $GITHUB_OUTPUT
550+
echo "authentication_policy=mysql_native_password," >> $GITHUB_OUTPUT
551+
echo "EOF" >> $GITHUB_OUTPUT
557552
558553
- name: Setup MySQL Server
559554
id: setup-mysql
@@ -565,8 +560,9 @@ jobs:
565560
root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }}
566561
user: ${{ env.WP_CLI_TEST_DBUSER}}
567562
password: ${{ env.WP_CLI_TEST_DBPASS}}
563+
# Fall back to legacy configuration for MySQL 5.6, 5.7, 8.0 and MariaDB.
568564
my-cnf: |
569-
${{ steps.mysql-config.outputs.auth-config }}
565+
${{ steps.mysql-config.outputs.auth-config || 'default_authentication_plugin=mysql_native_password' }}
570566
571567
- name: Prepare test database
572568
if: ${{ matrix.dbtype != 'sqlite' }}

0 commit comments

Comments
 (0)