From bc6373881ee9702f5ee6907be1a7579d8ca22cf6 Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Thu, 5 Dec 2024 15:56:15 +0100 Subject: [PATCH 1/2] sonar: run sonar analyze with jdk 11 --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dde3a0ff6..e4993a21f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,11 +29,14 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: ${{ matrix.java }} + java-version: | + 11 + ${{ matrix.java }} cache: 'maven' - name: Build run: ./mvnw -Pcoverage clean verify - - name: Analyse with SonarCloud + + - name: SonarQube Cloud - Analyse if: ${{ github.repository == 'focus-shift/jollyday' && matrix.java == 21 && matrix.os == 'ubuntu-24.04' && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) }} run: > ./mvnw -Pcoverage verify @@ -41,6 +44,7 @@ jobs: -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=focus-shift -Dsonar.projectKey=focus-shift_jollyday + -Dsonar.java.jdkHome=${{ env.JAVA_HOME_11_X64 }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 03a06b2d7fdd1df54eb1c928bed2f18d69c2e401 Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Thu, 5 Dec 2024 16:37:46 +0100 Subject: [PATCH 2/2] sonar: split build and analyse into two jobs --- .github/workflows/build.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4993a21f..7bc474a7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,30 +14,41 @@ env: jobs: build: - name: build and analyse + name: Build strategy: matrix: java: [ '11', '17', '21', '22', '23' ] os: [ 'ubuntu-24.04', 'macos-14', 'windows-2022' ] runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + cache: 'maven' + - name: Build + run: ./mvnw verify + + sonarqube: + name: SonarQube Cloud + runs-on: ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up JDK ${{ matrix.java }} + - name: Set up JDK 11 and 17 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: | 11 - ${{ matrix.java }} + 17 cache: 'maven' - - name: Build - run: ./mvnw -Pcoverage clean verify - - - name: SonarQube Cloud - Analyse - if: ${{ github.repository == 'focus-shift/jollyday' && matrix.java == 21 && matrix.os == 'ubuntu-24.04' && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) }} + - name: SonarQube Cloud Analysis run: > ./mvnw -Pcoverage verify sonar:sonar