name: Java CI

on:
  push:
    branches:
      - master
      - 'release-*'
  pull_request:
    branches:
      - master
      - 'release-*'

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - scala: "scala-2.11"
            spark: "spark2"
          - scala: "scala-2.11"
            spark: "spark2,spark-shade-unbundle-avro"
          - scala: "scala-2.12"
            spark: "spark3.0.x"
          - scala: "scala-2.12"
            spark: "spark3.0.x,spark-shade-unbundle-avro"
          - scala: "scala-2.12"
            spark: "spark3.1.x"
          - scala: "scala-2.12"
            spark: "spark3.1.x,spark-shade-unbundle-avro"
          - scala: "scala-2.12"
            spark: "spark3"
          - scala: "scala-2.12"
            spark: "spark3,spark-shade-unbundle-avro"
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 8
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'
          architecture: x64
      - name: Build Project
        env:
          SCALA_PROFILE: ${{ matrix.scala }}
          SPARK_PROFILE: ${{ matrix.spark }}
        run: mvn install -P "$SCALA_PROFILE,$SPARK_PROFILE" -DskipTests=true -Dmaven.javadoc.skip=true -B -V
