name: Build and Test
on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - 'action*'
  workflow_call:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 8
        uses: actions/setup-java@v4
        with:
          java-version: '8'
          distribution: 'temurin'
          cache: maven

      - name: Validate Java Format
        run: mvn spring-javaformat:validate

      - name: Build with Maven
        run: mvn -B package
