#=========================================ANDROID===================================================
# This is the workflow responsible for verifying a PR before it gets merged. It will build the
# project on every PR opened to the main branch

name: Android 01 - PR Check

on:
    workflow_dispatch:
    pull_request:
        branches: [ main ]

jobs:
    build:
        name: Build debug version of the project
        runs-on: ubuntu-latest
        timeout-minutes: 10
        steps:
            -   uses: actions/checkout@v3

            # Setup caches
            -   name: Cache Gradle
                uses: actions/cache@v3
                with:
                    path: |
                        ~/.gradle/caches
                        ~/.gradle/wrapper
                    key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
                    restore-keys: |
                        ${{ runner.os }}-gradle-
            -   name: Cache Maven
                uses: actions/cache@v3
                with:
                    path: ~/.m2/repository
                    key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
                    restore-keys: |
                        ${{ runner.os }}-maven-

            -   name: Configure Java for the runner
                uses: actions/setup-java@v1
                with:
                    java-version: '17'

            # Build debug, validate PR
            -   name: Build debug version of app
                run: bash ./gradlew :android:app:assembleDebug
