fix(lint): fix all ruff errors (unused imports, bare f-strings, unuse… #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Run ruff check | |
| run: ruff check export_script.py import_script.py make_demo_data.py | |
| integration-test: | |
| name: Integration Test (export → validate → import → verify) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Generate demo game data | |
| run: python make_demo_data.py | |
| - name: Export game text | |
| run: python export_script.py Game -o exported_ci | |
| - name: Validate exported JSON structure | |
| run: | | |
| python - << 'EOF' | |
| import json, sys | |
| with open('exported_ci/script.json', encoding='utf-8') as f: | |
| data = json.load(f) | |
| assert 'info' in data, 'Missing info section' | |
| assert 'strings' in data, 'Missing strings section' | |
| count = data['info']['string_count'] | |
| actual = len(data['strings']) | |
| assert count == actual, 'string_count mismatch: {} != {}'.format(count, actual) | |
| print('Export OK: {} strings'.format(actual)) | |
| EOF | |
| - name: Fill translated field with original text (simulate translation) | |
| run: | | |
| python - << 'EOF' | |
| import json | |
| with open('exported_ci/script.json', encoding='utf-8') as f: | |
| data = json.load(f) | |
| for entry in data['strings']: | |
| if not entry.get('translated'): | |
| entry['translated'] = entry['original'] | |
| with open('exported_ci/script.json', 'w', encoding='utf-8') as f: | |
| json.dump(data, f, ensure_ascii=False, indent=2) | |
| print('Filled translated fields') | |
| EOF | |
| - name: Validate translation progress | |
| run: python import_script.py validate exported_ci/script.json | |
| - name: Import translations | |
| run: python import_script.py import Game exported_ci/script.json -o Game_ci_out | |
| - name: Verify output structure | |
| run: python import_script.py verify Game Game_ci_out | |
| - name: Upload exported script as artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: exported-script | |
| path: exported_ci/script.json | |
| retention-days: 7 |