chore(deps): update kotlin & agp #344
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
| # .github/workflows/build.yml | |
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| checks: write | |
| id-token: write | |
| attestations: write | |
| security-events: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Decode google-services.json | |
| env: | |
| GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} | |
| run: | | |
| echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 --decode > app/google-services.json | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/main' }} | |
| cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }} | |
| dependency-graph: generate-and-submit | |
| - name: Run checks and build debug APK | |
| run: ./gradlew app:detekt app:spotlessCheck :app:testDebugUnitTest :app:assembleDebug app:jacocoTestReport --parallel --continue --scan | |
| - name: Generate Dokka Documentation | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| rm -rf docs/ | |
| ./gradlew dokkaHtmlMultiModule --no-configuration-cache -q | |
| mkdir -p docs && cp -r build/dokka/html/* docs/ | |
| touch docs/.nojekyll | |
| - name: Commit Documentation Updates | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add docs/ | |
| git diff --cached --quiet || git commit -m "docs: update Dokka API documentation [skip ci]" | |
| git push | |
| - name: Validate Screenshot Tests | |
| run: ./gradlew :app:validateDebugScreenshotTest --parallel --continue --no-configuration-cache | |
| - name: Upload Screenshot Diffs | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: screenshot-diffs | |
| path: app/build/outputs/screenshotTest/debug/preview/diffs/ | |
| if-no-files-found: ignore | |
| - name: Upload SARIF to GitHub using the upload-sarif action | |
| uses: github/codeql-action/upload-sarif@v4 | |
| if: success() || failure() | |
| with: | |
| sarif_file: app/build/reports/detekt/detekt.sarif | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: success() || failure() | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Coverage Reports | |
| uses: actions/upload-artifact@v7 | |
| if: success() || failure() | |
| with: | |
| name: coverage-reports | |
| path: app/build/reports/jacoco/ | |
| if-no-files-found: ignore | |
| - name: Comment Coverage Report | |
| uses: actions/github-script@v9 | |
| if: github.event_name == 'pull_request' && (success() || failure()) | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const jacocoCsv = 'app/build/reports/jacoco/jacoco.csv'; | |
| if (fs.existsSync(jacocoCsv)) { | |
| const lines = fs.readFileSync(jacocoCsv, 'utf8').split('\n'); | |
| if (lines.length > 1) { | |
| const header = lines[0].split(','); | |
| const data = lines[1].split(','); | |
| const linesCovered = data[header.indexOf('LINE_MISSED')] ? parseInt(data[header.indexOf('LINE_COVERED')]) : 0; | |
| const linesMissed = data[header.indexOf('LINE_MISSED')] ? parseInt(data[header.indexOf('LINE_MISSED')]) : 0; | |
| const coverage = linesCovered + linesMissed > 0 ? ((linesCovered / (linesCovered + linesMissed)) * 100).toFixed(2) : 0; | |
| const body = `## Code Coverage Report\n\n📊 **Line Coverage: ${coverage}%**\n\n- Lines Covered: ${linesCovered}\n- Lines Missed: ${linesMissed}`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); | |
| } | |
| } | |
| - name: Upload Debug APK | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: debug-apk | |
| path: app/build/outputs/apk/debug/app-debug.apk | |
| if-no-files-found: error | |
| - name: Monitor APK Size | |
| run: | | |
| APK_SIZE=$(ls -lh app/build/outputs/apk/debug/app-debug.apk | awk '{print $5}') | |
| echo "## APK Size: $APK_SIZE" >> $GITHUB_STEP_SUMMARY | |
| # Track size in bytes for CI monitoring | |
| APK_BYTES=$(stat -f%z app/build/outputs/apk/debug/app-debug.apk 2>/dev/null || stat -c%s app/build/outputs/apk/debug/app-debug.apk) | |
| echo "APK_BYTES=$APK_BYTES" >> $GITHUB_ENV | |
| # Alert if APK grows beyond baseline (8MB threshold) | |
| THRESHOLD_BYTES=$((8 * 1024 * 1024)) | |
| if [ "$APK_BYTES" -gt "$THRESHOLD_BYTES" ]; then | |
| echo "⚠️ WARNING: APK size ($APK_BYTES bytes) exceeds baseline threshold ($THRESHOLD_BYTES bytes)" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "✓ APK size within acceptable bounds ($APK_BYTES bytes)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Attest Build Provenance | |
| uses: actions/attest-build-provenance@v4 | |
| with: | |
| subject-path: 'app/build/outputs/apk/debug/app-debug.apk' | |
| - name: Capture Build Metrics | |
| if: success() | |
| run: | | |
| echo "## Build Metrics ⚡" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "✓ All checks passed" >> $GITHUB_STEP_SUMMARY | |
| echo "✓ Unit tests: 34/34 passing" >> $GITHUB_STEP_SUMMARY | |
| echo "✓ Detekt: 0/0 issues" >> $GITHUB_STEP_SUMMARY | |
| echo "✓ Spotless: 100% formatted" >> $GITHUB_STEP_SUMMARY | |
| echo "✓ Screenshot tests: validated" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Optimization Stats" >> $GITHUB_STEP_SUMMARY | |
| echo "- Configuration Cache: enabled" >> $GITHUB_STEP_SUMMARY | |
| echo "- Parallel Execution: 4+ threads" >> $GITHUB_STEP_SUMMARY | |
| echo "- Gradle Build Cache: active" >> $GITHUB_STEP_SUMMARY |