CI: Fixing indents in custom python inject code

This commit is contained in:
Griatch 2025-12-19 10:52:33 +01:00
parent bf138d8a6f
commit fe80bfb80c

View file

@ -64,41 +64,31 @@ runs:
evennia --init testing_mygame evennia --init testing_mygame
cp .github/workflows/${{ inputs.testing-db }}_settings.py testing_mygame/server/conf/settings.py cp .github/workflows/${{ inputs.testing-db }}_settings.py testing_mygame/server/conf/settings.py
cd testing_mygame cd testing_mygame
# For MySQL, ensure default row format is set before migrations shell: bash
if [ "${{ inputs.testing-db }}" == "mysql" ]; then
python -c " - name: Set MySQL row format before migrations
import os if: ${{ inputs.testing-db == 'mysql' }}
import django working-directory: testing_mygame
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings') run: |
django.setup() python -c "import os; import django; os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings'); django.setup(); from django.db import connection; cursor = connection.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]}')"
from django.db import connection shell: bash
with connection.cursor() as cursor:
cursor.execute('SET GLOBAL innodb_default_row_format = \"DYNAMIC\"') - name: Run migrations
cursor.execute('SELECT @@innodb_default_row_format') working-directory: testing_mygame
result = cursor.fetchone() run: |
print(f'MySQL default row format: {result[0]}')
"
fi
evennia migrate evennia migrate
# For MySQL, ensure all existing tables use DYNAMIC row format shell: bash
if [ "${{ inputs.testing-db }}" == "mysql" ]; then
python -c " - name: Set MySQL table row format after migrations
import os if: ${{ inputs.testing-db == 'mysql' }}
import django working-directory: testing_mygame
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings') run: |
django.setup() python -c "import os; import django; os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.conf.settings'); django.setup(); from django.db import connection; cursor = connection.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()]; [cursor.execute(f'ALTER TABLE \`{table}\` ROW_FORMAT=DYNAMIC') or print(f'Set ROW_FORMAT=DYNAMIC for table {table}') for table in tables]"
from django.db import connection shell: bash
with connection.cursor() as cursor:
cursor.execute(\"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND ENGINE = 'InnoDB'\") - name: Collect static files
tables = [row[0] for row in cursor.fetchall()] working-directory: testing_mygame
for table in tables: run: |
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 evennia collectstatic --noinput
shell: bash shell: bash