diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index d8b5a79d..227759aa 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -1,4 +1,4 @@ -name: Gradle Build and Test +name: Build and Test on: pull_request: push: @@ -10,12 +10,22 @@ jobs: gradle: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - name: Check out + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 with: distribution: temurin - # Always build with JDK 8 initially - java-version: 8 + # SonarQube requires JDK 17 or higher + java-version: 17 + + - name: Cache JDK + uses: actions/cache@v4 + with: + path: ~/.jdk + key: ${{ runner.os }}-jdk + restore-keys: ${{ runner.os }}-jdk - name: Setup Gradle uses: gradle/gradle-build-action@v3 @@ -65,12 +75,6 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - uses: actions/setup-java@v4 - with: - distribution: temurin - # Sonar needs JDK 17 or higher - java-version: 17 - - name: Analyze with SonarCloud env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any