name: Build

# Run this Action on all pull requests and non-main branch pushes
on:
  push:
    branches-ignore:
      - main
  pull_request:

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up JDK 11
        uses: actions/setup-java@v3
        with:
          java-version: 11
          distribution: temurin

      - name: Validate Gradle wrapper
        uses: gradle/wrapper-validation-action@v1

      - name: Build with Gradle
        uses: gradle/gradle-build-action@v2
        with:
          gradle-version: wrapper
          arguments: build

  static:
    name: Static Analysis
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Set up JDK 11
        uses: actions/setup-java@v3
        with:
          java-version: 11
          distribution: temurin
      - name: Validate Gradle wrapper
        uses: gradle/wrapper-validation-action@v1
      - name: Run Static Analysis
        uses: gradle/gradle-build-action@v2
        with:
          gradle-version: wrapper
          arguments: jacocoTestReport sonarqube --info
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
name: Build

# Run this Action on all pull requests and non-main branch pushes
on:
  push:
    branches-ignore:
      - main
  pull_request:

jobs:
  build:
    name: Build
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        java: [8,11,17]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3

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

      - name: Validate Gradle wrapper
        uses: gradle/wrapper-validation-action@v1

      - name: Build with Gradle
        uses: gradle/gradle-build-action@v2
        with:
          gradle-version: wrapper
          arguments: build

  static:
    name: Static Analysis
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up JDK 11
        uses: actions/setup-java@v3
        with:
          java-version: 11
          distribution: temurin

      - name: Validate Gradle wrapper
        uses: gradle/wrapper-validation-action@v1

      - name: Run Static Analysis
        uses: gradle/gradle-build-action@v2
        with:
          gradle-version: wrapper
          arguments: jacocoTestReport sonarqube --info
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Test on all major platforms and current LTS java versions
ci: Test on all major platforms and current LTS java versions
