|
| 1 | +name: Localization Validation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - feature/firebase-remote-localization |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - develop |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: localization-validation-${{ github.event_name }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + validate: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 45 |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v5 |
| 24 | + |
| 25 | + - name: Set up JDK 21 |
| 26 | + uses: actions/setup-java@v5 |
| 27 | + with: |
| 28 | + distribution: temurin |
| 29 | + java-version: '21' |
| 30 | + |
| 31 | + - name: Make Gradle wrapper executable |
| 32 | + run: chmod +x gradlew |
| 33 | + |
| 34 | + - name: Verify localization architecture |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + if grep -R --line-number --include='*.kt' 'Res\.string' app core data domain infrastructure model ui; then |
| 38 | + echo 'Found remaining Compose Res.string usage.' |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | + if grep -R --line-number --include='*.kt' 'org\.jetbrains\.compose\.resources\.stringResource' app core data domain infrastructure model ui; then |
| 42 | + echo 'Found remaining JetBrains Compose stringResource import.' |
| 43 | + exit 1 |
| 44 | + fi |
| 45 | + if grep -R --line-number --include='*.kt' 'com\.google\.firebase' data/localization; then |
| 46 | + echo 'Localization data code must use Firebase-KMP-Kit.' |
| 47 | + exit 1 |
| 48 | + fi |
| 49 | + if ! grep -R --line-number --include='*.kt' 'com\.firebasekit\.remoteconfig' data/localization/src/commonMain; then |
| 50 | + echo 'Firebase-KMP-Kit Remote Config must be used from commonMain.' |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | + if grep -R --line-number --include='*.kt' 'dev\.gitlive\.firebase' data/localization; then |
| 54 | + echo 'Found obsolete GitLive localization integration.' |
| 55 | + exit 1 |
| 56 | + fi |
| 57 | + if [ -d data/firebase ]; then |
| 58 | + echo 'Obsolete data/firebase module still exists.' |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | + if find data/localization/src -type f -name '*.kt' | grep -v '/com/velord/data/localization/' | grep -q .; then |
| 62 | + echo 'Found Kotlin source in data/localization outside com.velord.data.localization.' |
| 63 | + find data/localization/src -type f -name '*.kt' | grep -v '/com/velord/data/localization/' |
| 64 | + exit 1 |
| 65 | + fi |
| 66 | + if find core/core-resource/src/androidMain/res -path '*/values-*/strings.xml' | grep -q .; then |
| 67 | + echo 'Translated Android strings.xml files are forbidden; localization.json is canonical.' |
| 68 | + find core/core-resource/src/androidMain/res -path '*/values-*/strings.xml' |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | +
|
| 72 | + - name: Validate localization publishing script |
| 73 | + shell: pwsh |
| 74 | + run: ./scripts/firebase/publish-localization.ps1 -ValidateOnly |
| 75 | + |
| 76 | + - name: Verify QA reuses Develop Firebase client |
| 77 | + shell: bash |
| 78 | + run: | |
| 79 | + trap 'rm -f app/android/google-services.json' EXIT |
| 80 | + cat > app/android/google-services.json <<'JSON' |
| 81 | + { |
| 82 | + "project_info": { |
| 83 | + "project_number": "1", |
| 84 | + "project_id": "firebase-mapping-test" |
| 85 | + }, |
| 86 | + "client": [ |
| 87 | + { |
| 88 | + "client_info": { |
| 89 | + "mobilesdk_app_id": "1:1:android:develop-test", |
| 90 | + "android_client_info": { |
| 91 | + "package_name": "com.velord.composescreenexample.develop" |
| 92 | + } |
| 93 | + }, |
| 94 | + "api_key": [ |
| 95 | + { |
| 96 | + "current_key": "test-api-key" |
| 97 | + } |
| 98 | + ] |
| 99 | + } |
| 100 | + ] |
| 101 | + } |
| 102 | + JSON |
| 103 | + ./gradlew :app:android:processQaDebugGoogleServices --stacktrace |
| 104 | + if [ -e app/android/src/qa/google-services.json ]; then |
| 105 | + echo 'QA must not generate or rewrite a Firebase client configuration.' |
| 106 | + exit 1 |
| 107 | + fi |
| 108 | +
|
| 109 | + - name: Compile and test localization |
| 110 | + run: >- |
| 111 | + ./gradlew |
| 112 | + :data:localization:desktopTest |
| 113 | + :infrastructure:di:desktopTest |
| 114 | + :app:desktop:compileKotlinDesktop |
| 115 | + :app:android:processDevelopDebugMainManifest |
| 116 | + :app:android:compileDevelopDebugKotlin |
| 117 | + -x :app:android:processDevelopDebugGoogleServices |
| 118 | + --stacktrace |
| 119 | +
|
| 120 | + - name: Compile QA |
| 121 | + run: >- |
| 122 | + ./gradlew |
| 123 | + :app:android:compileQaDebugKotlin |
| 124 | + -x :app:android:processQaDebugGoogleServices |
| 125 | + --stacktrace |
| 126 | +
|
| 127 | + - name: Compile Stage |
| 128 | + run: >- |
| 129 | + ./gradlew |
| 130 | + :app:android:compileStageDebugKotlin |
| 131 | + -x :app:android:processStageDebugGoogleServices |
| 132 | + --stacktrace |
| 133 | +
|
| 134 | + - name: Compile Production |
| 135 | + run: >- |
| 136 | + ./gradlew |
| 137 | + :app:android:compileProductionDebugKotlin |
| 138 | + -x :app:android:processProductionDebugGoogleServices |
| 139 | + --stacktrace |
| 140 | +
|
| 141 | + - name: Run project quality checks |
| 142 | + run: >- |
| 143 | + ./gradlew |
| 144 | + :infrastructure:konsist:test |
| 145 | + detekt |
| 146 | + --stacktrace |
0 commit comments