Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
87 stars 33 forks source link

Update from deprecated Ubuntu v18.04 for GH workflows #431

Closed Jinksi closed 1 year ago

Jinksi commented 1 year ago

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 request was automatically failed because there were no enabled runners online to process the request for more than 1 days.

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

Jinksi commented 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.
image
Jinksi commented 1 year ago

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