chore: Configure Maven Central publishing #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} - Java ${{ matrix.java }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| java: [25, 21, 17] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK ${{ matrix.java }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ matrix.java }} | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew (Unix) | |
| if: runner.os != 'Windows' | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build --no-daemon --stacktrace | |
| - name: Run tests | |
| run: ./gradlew test --no-daemon --stacktrace | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }}-java${{ matrix.java }} | |
| path: | | |
| **/build/test-results/**/*.xml | |
| **/build/reports/** | |
| retention-days: 7 | |
| - name: Upload build artifacts | |
| if: matrix.java == 25 && matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: aprismate-jars | |
| path: | | |
| aprismate-api/build/libs/*.jar | |
| aprismate-agent/build/libs/*.jar | |
| retention-days: 30 | |
| lint: | |
| name: Code Quality Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 25 | |
| cache: 'gradle' | |
| - name: Run checkstyle | |
| run: ./gradlew checkstyleMain checkstyleTest --no-daemon | |
| continue-on-error: true | |
| - name: Run spotless check | |
| run: ./gradlew spotlessCheck --no-daemon | |
| continue-on-error: true | |
| verify-signed-commits: | |
| name: Verify Commit Signatures | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify all commits are signed | |
| run: | | |
| # Check if all commits in the push are signed | |
| unsigned_commits=$(git log --show-signature --format="%H %G?" origin/main..HEAD | grep -v "^[A-Z]" | grep "N$" || true) | |
| if [ -n "$unsigned_commits" ]; then | |
| echo "Error: Found unsigned commits:" | |
| echo "$unsigned_commits" | |
| exit 1 | |
| fi | |
| echo "All commits are signed" | |
| compatibility-check: | |
| name: Cross-Version Compatibility | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 25 | |
| cache: 'gradle' | |
| - name: Build with Java 25 | |
| run: ./gradlew clean build -x test --no-daemon | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21 | |
| cache: 'gradle' | |
| - name: Test with Java 21 | |
| run: ./gradlew test --no-daemon | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| cache: 'gradle' | |
| - name: Test with Java 17 | |
| run: ./gradlew test --no-daemon |