name: PR Check

on:
  pull_request:
    branches: [ master ]
    paths-ignore:
      - 'fastlane/**'
      - '.github/**'
      - 'icons/**'
      - 'images/**'
      - 'scripts/**'
      - 'whatsnew/**'
      - '**.md'
      - '**.MD'


jobs:
  validate-pr:
    name: 'Spotless, Tests and Build Production Debug Build'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
    
      - name: Setting up project 
        uses: ./.github/actions/setup

      - name: 🛠 Build Project with Spotless Check
        run: ./gradlew spotlessCheck
        
      - name: 🧪 Run Tests
        run: ./gradlew test

      - name: 🏗 Build APK
        run: bash ./gradlew assembleDebug

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