# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Branch

on:
  push:
    branches-ignore: [ '3.x' ]

jobs:
  build:

    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 8
      uses: actions/setup-java@v2
      with:
        distribution: 'adopt'
        java-version: '8'
    - name: Cache Gradle packages
      uses: actions/cache@v2.1.5
      with:
        path: ~/.gradle/caches
        key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/*.gradle') }}
        restore-keys: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}
    - name: Grant execute permission for gradlew
      run: chmod +x gradlew
    - name: Build branch without snapshot
      run: ./gradlew -PreleaseMode=pr build --stacktrace
    - name: Upload to Codecov  
      uses: codecov/codecov-action@v1
