name: Android CI

on:
  push:
    branches: [ lsp ]
  pull_request:

jobs:
  build:
    name: Build on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu-latest, windows-latest, macOS-latest ]
        
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        submodules: 'recursive'
        
    - name: Set up JDK 11
      uses: actions/setup-java@v2
      with:
        java-version: '11'
        distribution: 'adopt'

    - name: Grant execute permission for gradlew
      run: chmod +x gradlew
      
    - name: Build Debug
      run: ./gradlew buildDebug
    - name: Upload Debug artifact
      uses: actions/upload-artifact@v2
      with:
        name: lspatch-debug
        path: out/
        
    - name: Build Release
      run: ./gradlew buildRelease
    - name: Upload Release artifact
      uses: actions/upload-artifact@v2
      with:
        name: lspatch-release
        path: out/
