Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
73 changes: 0 additions & 73 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,78 +308,6 @@ jobs:
-DuseMissingFile \
"-Dlicense.overrideUrl=file://${PWD}/override-dep-licenses.properties"

autoscan:
name: Autoscan Tests
needs:
- build
if: ${{ needs.build.outputs.deployed }}
runs-on: sonar-m-public
permissions:
id-token: write
contents: write
env:
BUILD_NUMBER: ${{ needs.build.outputs.build-number }}
SQ_VERSION: LATEST_RELEASE
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# For now, the autoscan job need to execute two mvn commands:
# * The build of java-checks-test-sources module which requires Java 24.
# * The tests using Orchestrator and SonarQube that, for now, fail to work using Java 24
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
with:
version: 2026.4.25
- uses: SonarSource/vault-action-wrapper@v3
id: secrets
with:
secrets: |
development/kv/data/next url | SONAR_HOST_URL;
development/kv/data/next token | SONAR_TOKEN;
development/github/token/licenses-ro token | GITHUB_TOKEN;
- name: Ensure Separate Job Cache Key
uses: ./.github/actions/write-file
with:
file-path: target/just_for_cache_key_calculation/pom.xml
content: ${{ github.job }}
- uses: SonarSource/ci-github-actions/config-maven@v1
with:
artifactory-reader-role: private-reader
use-develocity: ${{ env.USE_DEVELOCITY }}
develocity-url: ${{ env.DEVELOCITY_URL }}
- name: Compile Test Sources
env:
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
SONAR_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_TOKEN }}
working-directory: java-checks-test-sources
run: |
mvn clean compile test-compile --batch-mode
- name: Select Java 21
run: mise use java@21
- name: Orchestrator Cache
uses: ./.github/actions/orchestrator-cache
with:
sq-version: ${{ env.SQ_VERSION }}
- name: Run autoscan tests
env:
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
SONAR_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_TOKEN }}
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
working-directory: its/autoscan
run: >
mvn clean package --batch-mode --errors --show-version
--activate-profiles it-autoscan
-Dsonar.runtimeVersion="$SQ_VERSION"
-Dmaven.test.redirectTestOutputToFile=false
-Dparallel=methods
-DuseUnlimitedThreads=true
- name: Upload Actual Results On Failure
if: failure()
uses: ./.github/actions/upload-actual
with:
name: autoscan
it-dir: its/autoscan
expected-dir: src/test/resources/autoscan/diffs
actual-dir: target/actual/autoscan-diffs

qa-os-win:
name: Build and Unit Test on Windows
# No dependency on build step, because we do not need the build number.
Expand Down Expand Up @@ -416,7 +344,6 @@ jobs:
- sanity
- test-analyze
- custom-rules-license-check
- autoscan
- qa-os-win
if: ${{ needs.build.outputs.deployed }}
runs-on: sonar-s-public
Expand Down
41 changes: 0 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,47 +155,6 @@ For example using the command:

cp its/ruling/target/actual/* its/ruling/src/test/resources/

#### Autoscan Test

The tests in the [autoscan module](its/autoscan) are designed to detect differences between the issues the Java analyzer can find with and without bytecode.
The goal here is to spot and fix the potential FPs, and verify the expected FNs between that would show up in [SonarQube Cloud's automatic analysis](https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/automatic-analysis/).

Running this test can be broken down in 2 steps:

1. Compiling the test sources
2. Executing the autoscan test

##### Compiling the test sources

Make sure that the `java-checks-test-sources` module has been compiled (ie: the .class files in `java-checks-test-sources/target/` are up to date).

In doubt, go the [`java-checks-test-sources`](java-checks-tests-sources) module and run:
```shell
# Use java 26!
mvn clean compile
```

##### Executing the autoscan test

To run the tests, move to the [`its/autoscan`](its/autoscan) folder and run:
```shell
# cd its/autoscan
# use Java 21!
mvn clean package --batch-mode --errors --show-version \
--activate-profiles it-autoscan \
-Dsonar.runtimeVersion=LATEST_RELEASE
```

The artifacts produced during the test execution will be found in [`its/autoscan/target/actual`](its/autoscan/target/actual).
You will want to compare the results produced in the autoscan-diff-by-rules

For more detailed information, you can compare the differences between the results found with bytecode and without bytecode by comparing two respective folders:
* [java-checks-test-sources-mvn](its/autoscan/target/actual/java-checks-test-sources-mvn)
* [java-checks-test-sources-no-binaries](its/autoscan/target/actual/java-checks-test-sources-no-binaries)

Depending on the results found, you might need to update the ground truth.
The expected results are listed in [src/test/resources](its/autoscan/src/test/resources/autoscan/diffs).

#### Debugging Integration Tests
You can debug ITs by adding `-Dmaven.binary=mvnDebug` as an option when running the tests. This will cause the analyzer JVM to wait for a debugger to be attached before continuing.

Expand Down
95 changes: 0 additions & 95 deletions its/autoscan/pom.xml

This file was deleted.

Loading