name: Build

on:
  push:
    branches: [ master ]
    paths:
      - 'app/**'
      - 'buildSrc/**'
      - '*.gradle.kts'
      - 'gradle/**'
      - 'gradle.properties'
      - 'detekt.yml'
      - '.github/workflows/build.yml'
  pull_request:
    branches: [ master ]
    paths:
      - 'app/**'
      - 'buildSrc/**'
      - '*.gradle.kts'
      - 'gradle/**'
      - 'gradle.properties'
      - 'detekt.yml'
      - '.github/workflows/build.yml'

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      
      - name: Set up JDK 21
        uses: actions/setup-java@v5
        with:
          java-version: '21'
          distribution: 'temurin'
          
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
        
      - name: Run ktlint check
        run: ./gradlew ktlintCheck --stacktrace
        
      - name: Run detekt check
        run: ./gradlew detekt --stacktrace
        
      - name: Build debug APK
        run: ./gradlew assembleDebug --stacktrace
