Closed Jinksi closed 1 year ago
GH checks for PHP < 7.4 are failing on ubuntu-latest
with the error:
Error: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or that contact with the database server at `localhost` could not be established. This could mean your host’s database server is down.
I borrowed the following solution from WCPay, which fixes the issue for PHP < 7.4:
# bin/run-ci-tests.sh
# On GitHub actions, set MySQL authentication to mysql_native_password instead of caching_sha2_password
# to prevent DB connection problems with PHP versions less than 7.4
if [[ -n $CI ]]; then
echo "Configuring MySQL to use mysql_native_password"
mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; FLUSH PRIVILEGES;"
fi
Description
Ubuntu v18.04 has been deprecated for GH actions runners since 2023/04/03, resulting in the GH checks for this repo eventually failing and showing the following error:
This PR updates the Ubuntu version to
ubuntu-latest
for failing checks.How to test this PR
Ensure all GH checks for this PR pass ✅
Product impact