name: Android CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]


jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: 🧱 Set Up JDK
        uses: actions/setup-java@v1
        with:
          java-version: 11
          
      - name: Grant Gradlew rights
        run: chmod +x gradlew

      - name: 🧪 Run Tests
        run: ./gradlew test

      - name: 🛠 Build Project with Spotless Check
        run: ./gradlew spotlessCheck

      - name: ⏳ Build with Gradle
        run: ./gradlew build

      - name: 🏗 Build APK
        run: bash ./gradlew assembleProductionDebug --stacktrace

      - name: 🚀 Upload APK 📱
        uses: actions/upload-artifact@v2
        with:
          name: app
          path: app/build/outputs/apk/production/debug/*.apk
          retention-days: 3
