Update README.md #2057
This file contains 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: Java CI with Maven | |
on: | |
push: | |
branches: [ main, 2.3.x, 2.4.x, 3.0.x, 3.1.x, 3.2.x ] | |
pull_request: | |
branches: [ main, 2.3.x, 2.4.x, 3.0.x, 3.1.x, 3.2.x ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Test with JDK ${{ matrix.version }} | |
strategy: | |
matrix: | |
version: [ 17.0.12, 21.0.4 ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.version }} | |
cache: maven | |
- name: Build with Maven | |
run: ./mvnw -V -B verify -Pspring | |
sonar: | |
name: Run Sonar Analysis | |
runs-on: ubuntu-latest | |
# Disable Sonar for foreign PRs | |
if: (github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17.0.12 | |
cache: maven | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build with Maven | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./mvnw -V -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage,spring |