Translations update from Hosted Weblate #51
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: PR Build Check | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'android/**' | |
| - '.github/workflows/pr-build-check.yml' | |
| jobs: | |
| build: | |
| name: Build & Test APK | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.head.ref != 'weblate-translations' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Gradle Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Extract version | |
| run: | | |
| VERSION_NAME=$(grep "versionName = " android/app/build.gradle.kts | sed 's/.*versionName = "\(.*\)".*/\1/') | |
| VERSION_CODE=$(grep "versionCode = " android/app/build.gradle.kts | sed 's/.*versionCode = \([0-9]*\).*/\1/') | |
| echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV | |
| echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV | |
| echo "π± Version: $VERSION_NAME (Code: $VERSION_CODE)" | |
| # π Code Quality Checks (v1.6.1) | |
| - name: Run detekt (Code Quality) | |
| run: | | |
| cd android | |
| ./gradlew detekt --no-daemon | |
| continue-on-error: false | |
| - name: Run ktlint (Code Style) | |
| run: | | |
| cd android | |
| ./gradlew ktlintCheck --no-daemon | |
| continue-on-error: true # Parser issues in legacy code | |
| - name: Upload Lint Reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lint-reports-pr-${{ github.event.pull_request.number }} | |
| path: | | |
| android/app/build/reports/detekt/ | |
| android/app/build/reports/ktlint/ | |
| android/app/build/reports/lint-results*.html | |
| retention-days: 7 | |
| - name: Build Debug APK (unsigned) | |
| run: | | |
| cd android | |
| ./gradlew assembleStandardDebug assembleFdroidDebug --no-daemon --stacktrace | |
| - name: Run Unit Tests | |
| run: | | |
| cd android | |
| ./gradlew test --no-daemon --stacktrace | |
| continue-on-error: false | |
| - name: Verify build result | |
| run: | | |
| if [ -f "android/app/build/outputs/apk/standard/debug/app-standard-debug.apk" ]; then | |
| echo "β Standard Debug APK built successfully" | |
| ls -lh android/app/build/outputs/apk/standard/debug/*.apk | |
| else | |
| echo "β Standard Debug APK build failed" | |
| exit 1 | |
| fi | |
| if [ -f "android/app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk" ]; then | |
| echo "β F-Droid Debug APK built successfully" | |
| ls -lh android/app/build/outputs/apk/fdroid/debug/*.apk | |
| else | |
| echo "β F-Droid Debug APK build failed" | |
| exit 1 | |
| fi | |
| - name: Upload Debug APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug-apks-pr-${{ github.event.pull_request.number }} | |
| path: | | |
| android/app/build/outputs/apk/standard/debug/*.apk | |
| android/app/build/outputs/apk/fdroid/debug/*.apk | |
| retention-days: 30 | |
| - name: Post PR comment | |
| uses: actions/github-script@v7 | |
| if: success() | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const standardApk = fs.readdirSync('android/app/build/outputs/apk/standard/debug/') | |
| .filter(f => f.endsWith('.apk')); | |
| const fdroidApk = fs.readdirSync('android/app/build/outputs/apk/fdroid/debug/') | |
| .filter(f => f.endsWith('.apk')); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `## β Build successful! | |
| **Version:** ${{ env.VERSION_NAME }} (Code: ${{ env.VERSION_CODE }}) | |
| ### π¦ Debug APKs (Test Builds) | |
| Debug APKs were built successfully and are available as artifacts: | |
| **Standard Flavor:** | |
| ${standardApk.map(f => '- \`' + f + '\`').join('\n')} | |
| **F-Droid Flavor:** | |
| ${fdroidApk.map(f => '- \`' + f + '\`').join('\n')} | |
| > β οΈ **Note:** These are unsigned debug builds for testing. Production releases are only created on merge to \`main\`. | |
| [π₯ Download Artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})` | |
| }) |