Skip to content

Commit

Permalink
SLE-1000: Specific ITs for the CDT integration
Browse files Browse the repository at this point in the history
Move the CDT tests from the SonarQube Cloud axis and remove the dead code or references.

Update the CI pipeline in order to parallelize the work IT tasks.
  • Loading branch information
thahnen committed Dec 10, 2024
1 parent 73c1cc3 commit b41117d
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 110 deletions.
88 changes: 85 additions & 3 deletions .cirrus.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ qa_connectedModeSonarQube_task:
cd its/
mvn -B -e -V org.jacoco:jacoco-maven-plugin:prepare-agent verify \
-s ${HOME}/.m2/settings-public-auth.xml \
-P coverage,\!standaloneMode,\!connectedModeSc \
-P coverage,\!standaloneMode,\!connectedModeSc,\!cdtIntegration \
-Declipse.p2.mirrors=false \
-Dtarget.platform=latest-java-17_e431 \
-Dtycho.localArtifacts=ignore \
Expand Down Expand Up @@ -310,7 +310,7 @@ qa_connectedModeSonarCloud_task:
env SONARCLOUD_IT_PASSWORD=$SONARCLOUD_IT_PASSWORD \
mvn -B -e -V org.jacoco:jacoco-maven-plugin:prepare-agent verify \
-s ${HOME}/.m2/settings-public-auth.xml \
-P coverage,\!standaloneMode,\!connectedModeSq \
-P coverage,\!standaloneMode,\!connectedModeSq,\!cdtIntegration \
-Declipse.p2.mirrors=false \
-Dtarget.platform=latest-java-21 \
-Dtycho.localArtifacts=ignore \
Expand Down Expand Up @@ -389,7 +389,7 @@ qa_standaloneMode_task:
cd its/
mvn -B -e -V org.jacoco:jacoco-maven-plugin:prepare-agent verify \
-s ${HOME}/.m2/settings-public-auth.xml \
-P coverage,\!connectedModeSq,\!connectedModeSc \
-P coverage,\!connectedModeSq,\!connectedModeSc,\!cdtIntegration \
-Declipse.p2.mirrors=false \
-Dtarget.platform=${TARGET_PLATFORM} \
-Dtycho.localArtifacts=ignore \
Expand Down Expand Up @@ -424,6 +424,85 @@ qa_standaloneMode_task:
slack_notification_script: |
source slack-failure-notification "Cirrus CI build failure on pipeline: $CIRRUS_PIPELINE_NAME"
qa_cdtIntegration_task:
# name: "Run ITs for CDT integration"
depends_on:
- build
<<: *ONLY_IF_EXCEPT_NIGHTLY
eks_container:
<<: *BUILDER_CONTAINER_DEFINITION
cpu: 4
memory: 12G
type: m6a.large
env:
ARTIFACTORY_API_KEY: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
GITHUB_TOKEN: VAULT[development/github/token/licenses-ro token]
DISPLAY: :10
MAVEN_OPTS: -Xmx3072m
matrix:
- env:
TARGET_PLATFORM: 'oldest-java-11_e48'
- env:
TARGET_PLATFORM: 'latest-java-17_e431'
- env:
TARGET_PLATFORM: 'latest-java-21'
<<: *SETUP_MAVEN_CACHE_QA
download_staged_update_site_script: |
set -euo pipefail
source cirrus-env QA
source .cirrus/set_maven_build_version $BUILD_NUMBER
mvn -B -e -V dependency:unpack \
-Declipse.p2.mirrors=false \
-Dtycho.mode=maven \
-Dartifact=org.sonarsource.sonarlint.eclipse:org.sonarlint.eclipse.site:${PROJECT_VERSION}:zip \
-DoutputDirectory=${CIRRUS_WORKING_DIR}/staged-repository
prepare_background_script: |
set -euo pipefail
/etc/init.d/xvfb start
metacity --sm-disable --replace &
sleep 10 # give metacity some time to start
echo 'Recording tests on video'
ffmpeg -loglevel warning -f x11grab -video_size 1920x1080 -i ${DISPLAY} -codec:v libx264 -r 12 ${CIRRUS_WORKING_DIR}/recording_${TARGET_PLATFORM}.mp4
run_its_script: |
echo "Run Maven ITs for CDT integration on Eclipse '${TARGET_PLATFORM}'"
cd its/
mvn -B -e -V org.jacoco:jacoco-maven-plugin:prepare-agent verify \
-s ${HOME}/.m2/settings-public-auth.xml \
-P coverage,\!standaloneMode,\!connectedModeSq,\!connectedModeSc \
-Declipse.p2.mirrors=false \
-Dtarget.platform=${TARGET_PLATFORM} \
-Dtycho.localArtifacts=ignore \
-Dsonarlint-eclipse.p2.url="file://${CIRRUS_WORKING_DIR}/staged-repository" \
-Djacoco.append=true \
-Djacoco.destFile=${CIRRUS_WORKING_DIR}/it-coverage.exec
mv ${CIRRUS_WORKING_DIR}/it-coverage.exec ${CIRRUS_WORKING_DIR}/it-coverage-${TARGET_PLATFORM}.exec
cleanup_before_cache_script: cleanup_maven_repository
always:
stop_recording_script: |
pkill -SIGINT -f ffmpeg
while pgrep ffmpeg >/dev/null; do sleep 1; done
/etc/init.d/xvfb stop
test_recording_artifacts:
path: "${CIRRUS_WORKING_DIR}/recording_${TARGET_PLATFORM}.mp4"
jacoco_it_cdt_artifacts:
path: "${CIRRUS_WORKING_DIR}/it-coverage*.exec"
mvn_startTestLog_artifacts:
path: "${CIRRUS_WORKING_DIR}/its/**/target/work/configuration/*.log"
mvn_runTestLog_artifacts:
path: "${CIRRUS_WORKING_DIR}/its/**/target/work/data/.metadata/.log"
on_failure:
xvfb_log_artifacts:
path: "${CIRRUS_WORKING_DIR}/Xvfb.out"
reports_artifacts:
path: "**/reports/**/*"
junit_artifacts:
paths:
- "**/test-results/**/*.xml"
- "**/target/surefire-reports/TEST-*.xml"
format: junit
slack_notification_script: |
source slack-failure-notification "Cirrus CI build failure on pipeline: $CIRRUS_PIPELINE_NAME"
inspect_orchestrator_cache_task:
<<: *ONLY_IF
depends_on: qa_connectedModeSonarQube
Expand All @@ -446,6 +525,7 @@ sonarqube_task:
- qa_connectedModeSonarQube
- qa_connectedModeSonarCloud
- qa_standaloneMode
- qa_cdtIntegration
<<: *ONLY_IF_EXCEPT_NIGHTLY
eks_container:
<<: *BUILDER_CONTAINER_DEFINITION
Expand All @@ -468,10 +548,12 @@ sonarqube_task:
curl --no-progress-meter https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/jacoco_it.zip -o jacoco_it.zip
curl --no-progress-meter https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/jacoco_it_sq.zip -o jacoco_it_sq.zip
curl --no-progress-meter https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/jacoco_it_sc.zip -o jacoco_it_sc.zip
curl --no-progress-meter https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/jacoco_it_cdt.zip -o jacoco_it_cdt.zip
unzip jacoco_ut.zip -d ${CIRRUS_WORKING_DIR}/org.sonarlint.eclipse.core.tests/target/
unzip jacoco_it.zip -d ${CIRRUS_WORKING_DIR}/org.sonarlint.eclipse.core.tests/target/
unzip jacoco_it_sq.zip -d ${CIRRUS_WORKING_DIR}/org.sonarlint.eclipse.core.tests/target/
unzip jacoco_it_sc.zip -d ${CIRRUS_WORKING_DIR}/org.sonarlint.eclipse.core.tests/target/
unzip jacoco_it_cdt.zip -d ${CIRRUS_WORKING_DIR}/org.sonarlint.eclipse.core.tests/target/
source cirrus-env QA
.cirrus/regular_mvn_build_deploy_analyze \
-P-deploy-sonarsource,-release,-sign \
Expand Down
2 changes: 1 addition & 1 deletion .cirrus.ibuilds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ qa_ibuilds_task:
cd its/
mvn -B -e -V verify \
-s ${HOME}/.m2/settings-public-auth.xml \
-P \!connectedModeSq,\!connectedModeSc \
-P \!connectedModeSq,\!connectedModeSc,\!cdtIntegration \
-Declipse.p2.mirrors=false \
-Dtarget.platform=ibuilds \
-Dtycho.localArtifacts=ignore \
Expand Down
76 changes: 46 additions & 30 deletions its/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# SonarLint for Eclipse: Integration tests
# SonarQube for Eclipse: Integration tests

This project including its modules contains the integration tests (including compatibility against
[iBuilds](https://download.eclipse.org/eclipse/downloads/), the in-development version of the Eclipse IDE) for
SonarLint that are relying on [Eclipse RedDeer](https://github.com/eclipse/reddeer) as the test framework connected
SonarQube that are relying on [Eclipse RedDeer](https://github.com/eclipse/reddeer) as the test framework connected
to [Eclipse Tycho](https://github.com/eclipse-tycho/tycho).

The tests are split into separate modules for testing in Standalone Mode only, in Connected Mode with SonarQube and
SonarCloud. Additionally, one module is used for shared logic. This Maven/Tycho project is completely decoupled from
the main SonarLint for Eclipse project.
The tests are split into separate modules for testing in Standalone Mode only, with the integration into CDT (which is
also in Standalone Mode), in Connected Mode with SonarQube Server and SonarQube Cloud. Additionally, one module is used
for shared logic. This Maven/Tycho project is completely decoupled from the main SonarQube for Eclipse project.

## Building

In order to build the integration tests, the main SonarLint for Eclipse project must be build first to create the
In order to build the integration tests, the main SonarQube for Eclipse project must be build first to create the
Eclipse Update Site. On the CI/CD pipeline this is not done in one step, but locally it has to be done.

The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarLint
The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarQube
for Eclipse project directory.

```
Expand All @@ -25,7 +25,7 @@ mvn clean verify -Dtarget.platform=latest-java-17_e431 -Dtycho.localArtifacts=ig
```

When all the projects are opened inside Eclipse and the target platform correctly configured, this is done in the
background (not for the main SonarLint for Eclipse project tho if not also imported into Eclipse, which is required).
background (not for the main SonarQube for Eclipse project tho if not also imported into Eclipse, which is required).

## Running the Tests

Expand All @@ -37,48 +37,64 @@ instance.
### Standalone Mode / iBuilds compatibility

To run all the tests, or a specific one with the additionally command line option `-Dtest={TestClassName}`, for the
Standalone Mode, the following command has to be run that excludes the tests for the Connected Mode with SonarQube and
SonarCloud.
Standalone Mode, the following command has to be run that excludes the tests for the Connected Mode with SonarQube
Server and SonarQube Cloud and the integration into CDT.

The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarLint
The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarQube
for Eclipse project directory. For Standalone Mode all target platforms are useful, for the iBuilds compatibility the
`ibuilds` target platform must be used.

```
mvn clean verify -Dtarget.platform=latest-java-17_e431 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!connectedModeSc,\!connectedModeSq
mvn clean verify -Dtarget.platform=latest-java-17_e431 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!connectedModeSc,\!connectedModeSq,\!cdtIntegration
```

### Connected Mode (SQ)
### Connected Mode (SonarQube Server)

To run all the tests, or a specific one with the additionally command line option `-Dtest={TestClassName}`, for the
Connected Mode with SonarQube, the following command has to be run that excludes the tests for the Standalone Mode and
the Connected Mode with SonarCloud. With the additional command line option `-Dsonar.runtimeVersion={version alias}`
(see [Orchestrator documentation](https://github.com/SonarSource/orchestrator?tab=readme-ov-file#version-aliases)) the
specific SonarQube version can be configured, the default one is `LATEST_RELEASE`.
Connected Mode with SonarQube Server, the following command has to be run that excludes the tests for the Standalone
Mode and the Connected Mode with SonarQube Cloud and the integration into CDT. With the additional command line option
`-Dsonar.runtimeVersion={version alias}` (see
[Orchestrator documentation](https://github.com/SonarSource/orchestrator?tab=readme-ov-file#version-aliases)) the
specific SonarQube Server version can be configured, the default one is `LATEST_RELEASE`.

The target platform provided should be run against the latest one linked to the Eclipse IDE that is shipped with Java
17 (Eclipse IDE 2024-03 / 4.31). This is also what the CI/CD pipeline is doing in order to provide the correct runtime
for the SonarQube instance provided via [Orchestrator](https://github.com/SonarSource/orchestrator) for the latest
supported LTA version, the latest supported version and the currently in-development version (of SonarQube).
for the SonarQube Server instance provided via [Orchestrator](https://github.com/SonarSource/orchestrator) for the
latest supported LTA version, the latest supported version and the currently in-development version (of SonarQube
Server).

```
mvn clean verify -Dtarget.platform=latest-java-17_e431 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!standaloneMode,\!connectedModeSc
mvn clean verify -Dtarget.platform=latest-java-17_e431 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!standaloneMode,\!connectedModeSc,\!cdtIntegration
```

### Connected Mode (SC)
### Connected Mode (SonarQube Cloud)

To run all the tests, or a specific one with the additionally command line option `-Dtest={TestClassName}`, for the
Connected Mode with SonarCloud, the following command has to be run that excludes the tests for the Standalone Mode and
the Connected Mode with SonarQube.
Connected Mode with SonarQube Cloud, the following command has to be run that excludes the tests for the Standalone
Mode and the Connected Mode with SonarQube Server and the integration into CDT.

The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarLint
for Eclipse project directory. Compared to the integration tests for the Connected Mode with SonarCloud there is no
dependency on the Java version and the CI/CD pipeline will run against the latest one linked to the Eclipse IDE that is
shipped with Java 21 (the current Java runtime used for upcoming releases as well).
The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarQube
for Eclipse project directory. Compared to the integration tests for the Connected Mode with SonarQube Cloud there is
no dependency on the Java version and the CI/CD pipeline will run against the latest one linked to the Eclipse IDE that
is shipped with Java 21 (the current Java runtime used for upcoming releases as well).

Due to us requiring the password for the SonarCloud staging environment, we have to pass it directly to the command as
the Eclipse IDE runtime won't pick it up otherwise via `System.getenv("SONARCLOUD_IT_PASSWORD")`!
Due to us requiring the password for the SonarQube Cloud staging environment, we have to pass it directly to the
command as the Eclipse IDE runtime won't pick it up otherwise via `System.getenv("SONARCLOUD_IT_PASSWORD")`!

```
env SONARCLOUD_IT_PASSWORD=$SONARCLOUD_IT_PASSWORD mvn clean verify -Dtarget.platform=latest-java-21 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!standaloneMode,\!connectedModeSq
env SONARCLOUD_IT_PASSWORD=$SONARCLOUD_IT_PASSWORD mvn clean verify -Dtarget.platform=latest-java-21 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!standaloneMode,\!connectedModeSq,\!cdtIntegration
```

### CDT integration

To run all the tests, or a specific one with the additionally command line option `-Dtest={TestClassName}`, for the
integration into CDT, the following command has to be run that excludes the tests for the Standalone
Mode and the Connected Mode with SonarQube Server and the Connected Mode with SonarQube Cloud.

The target platform provided must be one of the supported in the `target-platforms` folder inside the main SonarQube
for Eclipse project directory. For the integration into CDT, all target platforms are useful, for the iBuilds
compatibility the `ibuilds` target platform must be used.

```
mvn clean verify -Dtarget.platform=latest-java-17_e431 -Dtycho.localArtifacts=ignore -Dsonarlint-eclipse.p2.url="file://{path to repo}/org.sonarlint.eclipse.site/target/repository" -P \!standaloneMode,\!connectedModeSc,\!connectedModeSq
```
47 changes: 47 additions & 0 deletions its/org.sonarlint.eclipse.its.cdt/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SonarLint for Eclipse ITs (CDT integration)
Bundle-SymbolicName: org.sonarlint.eclipse.its.cdt;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: SonarSource
Require-Bundle: org.eclipse.jdt.core,
org.eclipse.jdt.ui,
org.eclipse.debug.core,
org.eclipse.jdt.launching,
org.eclipse.jface,
org.eclipse.jface.text,
org.eclipse.ui.workbench,
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.swt,
org.eclipse.ui.forms,
org.eclipse.search,
org.eclipse.ui.editors,
org.junit;bundle-version="4.11.0",
org.eclipse.equinox.security,
org.eclipse.ui.console,
assertj-core,
org.eclipse.reddeer.junit,
org.eclipse.reddeer.requirements,
org.eclipse.reddeer.eclipse,
org.eclipse.reddeer.swt,
org.eclipse.reddeer.common,
org.eclipse.reddeer.workbench.core,
org.eclipse.reddeer.workbench,
org.eclipse.reddeer.jface,
org.eclipse.reddeer.core,
com.google.gson;bundle-version="2.9.1",
org.apache.commons.commons-io;bundle-version="2.16.1",
org.awaitility;bundle-version="4.2.2",
org.hamcrest;bundle-version="2.2.0",
minimal-json;bundle-version="0.9.5",
org.apache.commons.exec;bundle-version="1.3.0",
com.google.protobuf;bundle-version="3.25.1",
org.sonarlint.eclipse.its.shared
Import-Package: org.sonarlint.eclipse.ui.internal.views.issues
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Export-Package: org.sonarlint.eclipse.its.cdt
4 changes: 4 additions & 0 deletions its/org.sonarlint.eclipse.its.cdt/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
.
49 changes: 49 additions & 0 deletions its/org.sonarlint.eclipse.its.cdt/its.cdt.product
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="Runtime of the ITs (CDT integration)"
uid="org.sonarlint.eclipse.its.cdt.product"
id="org.eclipse.sdk.ide"
application="org.eclipse.ui.ide.workbench"
version="1"
type="features"
includeLaunchers="true"
autoIncludeRequirements="true">
<configIni use="default">
</configIni>

<launcherArgs>
<programArgs>--launcher.defaultAction openFile --launcher.appendVmargs
</programArgs>
<vmArgs>-Dosgi.requiredJavaVersion=17 -Dosgi.dataAreaRequiresExplicitInit=true -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true --add-modules=ALL-SYSTEM -Djava.security.manager=allow
</vmArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>

<launcher name="eclipse">
<win useIco="false">
<bmp/>
</win>
</launcher>

<features>
<feature id="org.eclipse.platform"/>
<feature id="org.eclipse.cdt"/>
<feature id="org.sonarlint.eclipse.feature"/>
</features>

<configurations>
<plugin id="org.apache.aries.spifly.dynamic.bundle" autoStart="true" startLevel="2" />
<plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.p2.reconciler.dropins" autoStart="true" startLevel="4" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<property name="osgi.bundles.defaultStartLevel" value="4" />
<property name="eclipse.buildId" value="${unqualifiedVersion}.${buildQualifier}" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="osgi.instance.area.default" value="@user.home/workspace" />
<property name="osgi.instance.area.default" value="@user.home/Documents/workspace" os="macosx" />
</configurations>
</product>
Loading

0 comments on commit b41117d

Please sign in to comment.