name: Android CI

on:
  workflow_dispatch:

jobs:
  build:
    name: Build & Test
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 17

      - name: Setup Gradle
        uses: gradle/actions/setup-gradle@v4

      - name: Build debug APK
        run: ./gradlew assembleDebug

      - name: Run unit tests
        run: ./gradlew test

      - name: Upload debug APK
        uses: actions/upload-artifact@v4
        if: success()
        with:
          name: debug-apk
          path: app/build/outputs/apk/debug/*.apk
          retention-days: 14
