name: Validate Java e2e smoke

on:
  push:
    branches:
      - main
    paths-ignore:
      - '**.md'
  pull_request:
    paths-ignore:
      - '**.md'

permissions:
  contents: read

jobs:
  setup-java:
    name: ${{ matrix.distribution }} ${{ matrix.version }} (${{ matrix.java-package }}) - ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: macos-latest
            distribution: temurin
            version: '11'
            java-package: jdk
          - os: windows-latest
            distribution: temurin
            version: '17'
            java-package: jdk
          - os: ubuntu-latest
            distribution: temurin
            version: '21'
            java-package: jdk
          - os: macos-latest
            distribution: temurin
            version: '25'
            java-package: jdk
          - os: windows-latest
            distribution: temurin
            version: '25'
            java-package: jdk
          - os: ubuntu-latest
            distribution: temurin
            version: '25'
            java-package: jdk
          - os: macos-latest
            distribution: microsoft
            version: '25'
            java-package: jdk
          - os: windows-latest
            distribution: microsoft
            version: '25'
            java-package: jdk
          - os: ubuntu-latest
            distribution: microsoft
            version: '25'
            java-package: jdk
          - os: ubuntu-latest
            distribution: zulu
            version: '17'
            java-package: jre
          - os: ubuntu-latest
            distribution: liberica
            version: '21'
            java-package: jdk+fx
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          persist-credentials: false
      - name: setup-java
        uses: ./
        id: setup-java
        with:
          java-version: ${{ matrix.version }}
          java-package: ${{ matrix.java-package }}
          distribution: ${{ matrix.distribution }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Verify Java
        env:
          JAVA_VERSION: ${{ matrix.version }}
          JAVA_PATH: ${{ steps.setup-java.outputs.path }}
        run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
        shell: bash
