name: Continuous Android

on:
  schedule:
    - cron: '0 8 * * *'
  pull_request:
    paths:
      - "android/**"

jobs:
  build:
    if: github.repository == 'deepjavalibrary/djl'
    runs-on: ubuntu-latest
    strategy:
      matrix:
        api-level: [ 26 ]
    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          distribution: 'corretto'
          java-version: 17
      - name: Gradle cache
        uses: gradle/gradle-build-action@v2
      - name: run tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ matrix.api-level }}
          force-avd-creation: false
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          disable-animations: true
          script: cd android/core && ./gradlew cAT
