name: CI PRs

on:
  workflow_dispatch:
  pull_request:

jobs:
  build:
    timeout-minutes: 15
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - nickname: win
            os: windows-latest
            java: 17
          - nickname: macos
            os: macos-latest
            java: 17
          - nickname: linux
            os: ubuntu-latest
            java: 17
    name: CI Build ${{ matrix.nickname }}
    steps:
      - uses: actions/checkout@v4
      - uses: jvalkeal/setup-maven@v1
        with:
          maven-version: 3.6.3
      - uses: actions/setup-java@v4
        with:
          distribution: liberica
          java-version: ${{ matrix.java }}
          cache: maven
      - name: Verify formatting
        run:  ./mvnw  -B -Pfunctional-tests spring-javaformat:validate
      - name: Build (Windows and MacOS, no functional tests)
        if: runner.os != 'Linux'
        run: ./mvnw -B clean install
      - name: Build (Linux)
        if: runner.os == 'Linux'
        run: ./mvnw -B -Pfunctional-tests,javadoc clean install