From 2e5e1de9ce4f0fca2535ee3b0552dbdca030a30b Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 19 Dec 2025 14:37:41 +0100 Subject: [PATCH] CI: More testing with custom mysql.cnf file --- .github/actions/setup-database/action.yml | 37 ++++++++++++++++------- .github/workflows/mysql.cnf | 5 +++ .github/workflows/mysql_settings.py | 4 ++- 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/mysql.cnf diff --git a/.github/actions/setup-database/action.yml b/.github/actions/setup-database/action.yml index 03c029d9df..ab1e10c05a 100644 --- a/.github/actions/setup-database/action.yml +++ b/.github/actions/setup-database/action.yml @@ -46,24 +46,39 @@ runs: - name: Set up MySQL Configuration and Privileges if: ${{ inputs.database == 'mysql' }} run: | - # Set MySQL global variables for character set, collation, and row format - # These must be set before migrations run to ensure tables are created with correct settings + # Create MySQL config file inside the container and restart MySQL to apply settings + # This ensures settings are applied at server startup, similar to command-line arguments + CONTAINER_ID=$(docker ps --filter "ancestor=mysql:8.0" --format "{{.ID}}" | head -1) + if [ -n "$CONTAINER_ID" ]; then + # Create config file in container + docker exec $CONTAINER_ID sh -c 'printf "[mysqld]\ncharacter-set-server=utf8mb4\ncollation-server=utf8mb4_unicode_ci\ninnodb-default-row-format=DYNAMIC\n" > /etc/mysql/conf.d/custom.cnf' + # Restart MySQL to apply config (graceful shutdown and start) + docker exec $CONTAINER_ID sh -c 'mysqladmin -u root -proot_password shutdown' || true + sleep 2 + docker start $CONTAINER_ID + # Wait for MySQL to be ready again + until mysqladmin ping -h 127.0.0.1 -u root -proot_password --silent; do + sleep 1 + echo -n . + done + fi + # Also set global variables as a fallback (though config file should handle this) mysql -u root -proot_password -h 127.0.0.1 mysql <