diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21305a0055..2e68137fa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,17 +54,18 @@ jobs: strategy: fail-fast: false matrix: - runner: - - github-ubuntu-latest-m - - github-windows-latest-m - profile: - - without-sonarqube-project - - only-sonarqube-project + item: + - { runner: github-ubuntu-latest-m, profile: without-sonarqube-project } + - { runner: github-ubuntu-latest-m, profile: only-sonarqube-project } + - { runner: github-ubuntu-latest-m, profile: only-guava-project, java_version: 17, sonar-runtime: "LATEST_RELEASE[2025.4]" } + - { runner: github-windows-latest-m, profile: without-sonarqube-project } + - { runner: github-windows-latest-m, profile: only-sonarqube-project } + - { runner: github-windows-latest-m, profile: only-guava-project, java_version: 17, sonar-runtime: "LATEST_RELEASE[2025.4]" } name: Ruling QA needs: - build if: ${{ needs.build.outputs.deployed }} - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.item.runner }} permissions: id-token: write contents: write @@ -77,8 +78,10 @@ jobs: - uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0 with: version: 2025.7.12 - - name: Select Java 17 - run: mise use java@17 + - name: Select Java Version + env: + JAVA_VERSION: ${{ matrix.item.java_version || '21' }} + run: mise use "java@${{ env.JAVA_VERSION }}" - name: Configure Maven uses: SonarSource/ci-github-actions/config-maven@v1 with: @@ -96,9 +99,10 @@ jobs: env: MAVEN_OPTS: "-Xmx3g" GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }} + SONAR_RUNTIME: ${{ matrix.item.sonar-runtime || 'LATEST_RELEASE' }} run: | cd its/ruling - mvn package --batch-mode "-Pit-ruling,${{ matrix.profile }}" -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true + mvn package --batch-mode "-Pit-ruling,${{ matrix.item.profile }}" "-Dsonar.runtimeVersion=${{ env.SONAR_RUNTIME }}" -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true plugin-qa: strategy: @@ -107,8 +111,6 @@ jobs: item: - sq_version: LATEST_RELEASE java_version: 21 - - sq_version: LATEST_RELEASE - java_version: 17 - sq_version: DEV java_version: 21 name: Plugin QA @@ -306,8 +308,8 @@ jobs: working-directory: java-checks-test-sources run: | mvn clean compile test-compile --batch-mode - - name: Select Java 17 - run: mise use java@17 + - name: Select Java 21 + run: mise use java@21 - uses: SonarSource/ci-github-actions/config-maven@v1 with: artifactory-reader-role: private-reader diff --git a/README.md b/README.md index d44c8cfecc..b925019ff7 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,9 @@ To run tests locally follow these instructions. ### Java versions -You need `Java 25` to compile and run the Unit Tests of the project and `Java 17` run the Integration Tests (ITs). -Note that `Java 21` can be used to build and test all modules except under `java-checks-test-sources` (as they require `Java 25`) and `its` (as they require `Java 17` because of SQ incompatibility). +You need `Java 25` to compile and run the Unit Tests of the project and `Java 21` run most Integration Tests (ITs). +Ruling test on Guava project require `Java 17`. +Note that `Java 21` can be used to build and test all modules except under `java-checks-test-sources` (as they require `Java 25`). ### Build the Project and Run Unit Tests @@ -121,7 +122,7 @@ From the `its/ruling` folder, launch the ruling tests: mvn clean install -Pit-ruling -DcommunityEditionTestsOnly=true # Alternatively - JAVA_HOME=/my/local/java17/jdk/ mvn clean install -Pit-ruling -DcommunityEditionTestsOnly=true + JAVA_HOME=/my/local/java21/jdk/ mvn clean install -Pit-ruling -DcommunityEditionTestsOnly=true Note for internal contributors: in order to also execute the tests that depend on the SonarQube Server Enterprise Edition, use: @@ -172,7 +173,7 @@ mvn clean compile To run the tests, move to the [`its/autoscan`](its/autoscan) folder and run: ```shell # cd its/autoscan -# use Java 17! +# use Java 21! mvn clean package --batch-mode --errors --show-version \ --activate-profiles it-autoscan \ -Dsonar.runtimeVersion=LATEST_RELEASE diff --git a/its/autoscan/src/test/java/org/sonar/java/it/AutoScanTest.java b/its/autoscan/src/test/java/org/sonar/java/it/AutoScanTest.java index 017c8de10b..7652540e29 100644 --- a/its/autoscan/src/test/java/org/sonar/java/it/AutoScanTest.java +++ b/its/autoscan/src/test/java/org/sonar/java/it/AutoScanTest.java @@ -199,7 +199,7 @@ public void javaCheckTestSources() throws Exception { softly.assertThat(newDiffs).containsExactlyInAnyOrderElementsOf(knownDiffs.values()); softly.assertThat(newTotal).isEqualTo(knownTotal); softly.assertThat(rulesCausingFPs).hasSize(10); - softly.assertThat(rulesNotReporting).hasSize(17); + softly.assertThat(rulesNotReporting).hasSize(14); /** * 4. Check total number of differences (FPs + FNs) diff --git a/its/autoscan/src/test/resources/autoscan/diffs/diff_S5738.json b/its/autoscan/src/test/resources/autoscan/diffs/diff_S5738.json index 83100f9ae8..49cbf74af7 100644 --- a/its/autoscan/src/test/resources/autoscan/diffs/diff_S5738.json +++ b/its/autoscan/src/test/resources/autoscan/diffs/diff_S5738.json @@ -1,6 +1,6 @@ { "ruleKey": "S5738", "hasTruePositives": true, - "falseNegatives": 4, + "falseNegatives": 3, "falsePositives": 0 } diff --git a/its/autoscan/src/test/resources/autoscan/diffs/diff_S6901.json b/its/autoscan/src/test/resources/autoscan/diffs/diff_S6901.json index 87a9e0f362..4d4c6e3853 100644 --- a/its/autoscan/src/test/resources/autoscan/diffs/diff_S6901.json +++ b/its/autoscan/src/test/resources/autoscan/diffs/diff_S6901.json @@ -1,6 +1,6 @@ { "ruleKey": "S6901", - "hasTruePositives": false, + "hasTruePositives": true, "falseNegatives": 0, "falsePositives": 0 } diff --git a/its/autoscan/src/test/resources/autoscan/diffs/diff_S6913.json b/its/autoscan/src/test/resources/autoscan/diffs/diff_S6913.json index 2a867543df..33cfe79c44 100644 --- a/its/autoscan/src/test/resources/autoscan/diffs/diff_S6913.json +++ b/its/autoscan/src/test/resources/autoscan/diffs/diff_S6913.json @@ -1,6 +1,6 @@ { "ruleKey": "S6913", - "hasTruePositives": false, + "hasTruePositives": true, "falseNegatives": 0, "falsePositives": 0 } diff --git a/its/autoscan/src/test/resources/autoscan/diffs/diff_S6915.json b/its/autoscan/src/test/resources/autoscan/diffs/diff_S6915.json index d3193d90a7..815beee4ff 100644 --- a/its/autoscan/src/test/resources/autoscan/diffs/diff_S6915.json +++ b/its/autoscan/src/test/resources/autoscan/diffs/diff_S6915.json @@ -1,6 +1,6 @@ { "ruleKey": "S6915", - "hasTruePositives": false, + "hasTruePositives": true, "falseNegatives": 0, "falsePositives": 0 } diff --git a/its/ruling/pom.xml b/its/ruling/pom.xml index 3aed137ca9..813e5fa110 100644 --- a/its/ruling/pom.xml +++ b/its/ruling/pom.xml @@ -108,7 +108,7 @@ org.apache.maven.plugins maven-surefire-plugin - !org.sonar.java.it.JavaRulingTest#sonarqube_server + !org.sonar.java.it.JavaRulingTest#sonarqube_server,!org.sonar.java.it.JavaRulingTest#guava @@ -128,6 +128,20 @@ + + only-guava-project + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.sonar.java.it.JavaRulingTest#guava + + + + + diff --git a/its/ruling/src/test/resources/eclipse-jetty/java-S5738.json b/its/ruling/src/test/resources/eclipse-jetty/java-S5738.json index 76430bdbfe..3cdf353f49 100644 --- a/its/ruling/src/test/resources/eclipse-jetty/java-S5738.json +++ b/its/ruling/src/test/resources/eclipse-jetty/java-S5738.json @@ -15,6 +15,13 @@ "org.eclipse.jetty:jetty-project:jetty-util/src/main/java/org/eclipse/jetty/util/TypeUtil.java": [ 680 ], +"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java": [ +198, +216 +], +"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java": [ +730 +], "org.eclipse.jetty:jetty-project:jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java": [ 1761 ]