name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

permissions:
  contents: read

jobs:
  build:
    name: Build on JDK ${{ matrix.java }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        java: [8, 11]
        os: [ubuntu-latest, windows-latest]

    steps:

    - uses: actions/checkout@v3.0.2

    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v3
      with:
        java-version: ${{ matrix.java }}
        distribution: 'temurin'
        cache: 'maven'

    - name: Build with Maven
      run: mvn -Pjacoco clean verify -B -V --no-transfer-progress ${{ matrix.flags }}

    - name: Codecov coverage
      uses: codecov/codecov-action@v3
      with:
        file: '*jacoco.xml'
