From bf138d8a6fd88b67816a6a9f85e9f3107dd04329 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 19 Dec 2025 10:36:00 +0100 Subject: [PATCH] CI: Working to get MySQL server collaborate with CI env --- .github/actions/run-tests/action.yml | 34 +++++++++++++++++++ .github/actions/setup-database/action.yml | 6 ++-- .../workflows/github_action_test_suite.yml | 2 +- .github/workflows/mysql_settings.py | 4 +-- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index ee3fdc595c..aa8ada4f39 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -64,7 +64,41 @@ runs: evennia --init testing_mygame cp .github/workflows/${{ inputs.testing-db }}_settings.py testing_mygame/server/conf/settings.py cd testing_mygame + # For MySQL, ensure default row format is set before migrations + if [ "${{ inputs.testing-db }}" == "mysql" ]; then + python -c " + import os + import django + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings') + django.setup() + from django.db import connection + with connection.cursor() as cursor: + cursor.execute('SET GLOBAL innodb_default_row_format = \"DYNAMIC\"') + cursor.execute('SELECT @@innodb_default_row_format') + result = cursor.fetchone() + print(f'MySQL default row format: {result[0]}') + " + fi evennia migrate + # For MySQL, ensure all existing tables use DYNAMIC row format + if [ "${{ inputs.testing-db }}" == "mysql" ]; then + python -c " + import os + import django + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings') + django.setup() + from django.db import connection + with connection.cursor() as cursor: + cursor.execute(\"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND ENGINE = 'InnoDB'\") + tables = [row[0] for row in cursor.fetchall()] + for table in tables: + try: + cursor.execute(f'ALTER TABLE \`{table}\` ROW_FORMAT=DYNAMIC') + print(f'Set ROW_FORMAT=DYNAMIC for table {table}') + except Exception as e: + print(f'Warning: Could not set ROW_FORMAT for {table}: {e}') + " + fi evennia collectstatic --noinput shell: bash diff --git a/.github/actions/setup-database/action.yml b/.github/actions/setup-database/action.yml index 0759914e25..8898e5f9e9 100644 --- a/.github/actions/setup-database/action.yml +++ b/.github/actions/setup-database/action.yml @@ -64,13 +64,13 @@ runs: GRANT PROCESS ON *.* TO 'evennia'@'%'; FLUSH PRIVILEGES; EOF - # Set database character set and default row format + # Set database character set mysql -u root -proot_password -h 127.0.0.1 evennia <