diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4993a21f..62a4eb225 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ env: jobs: build: - name: build and analyse + name: Build strategy: matrix: java: [ '11', '17', '21', '22', '23' ] @@ -23,21 +23,35 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: | - 11 - ${{ matrix.java }} + java-version: ${{ matrix.java }} cache: 'maven' - name: Build - run: ./mvnw -Pcoverage clean verify - - - name: SonarQube Cloud - Analyse + run: ./mvnw verify + - name: Trigger SonarQube Cloud Analysis 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: echo "::set-output name=run-sonarqube-analysis::$GITHUB_ENV" + + sonarqube: + name: SonarQube Cloud + needs: build + if: ${{ needs.build.outputs.run-sonarqube-analysis == 'true' }} + runs-on: ubuntu-24.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 11 + cache: 'maven' + - name: SonarQube Cloud Analysis run: > ./mvnw -Pcoverage verify sonar:sonar