Skip to content

Commit 4a36698

Browse files
committed
chore: fix integration tests
Signed-off-by: Stephane Bouchet <[email protected]>
1 parent da69e76 commit 4a36698

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ jobs:
8888
name: linux-steplogger-logs
8989
path: src/test-project/build/test-results/*
9090
if: always()
91+
- name: Archiving coverage for sonar
92+
uses: actions/upload-artifact@v4
93+
if: always()
94+
with:
95+
name: sonar-coverage
96+
path: |
97+
src/test-project/build/test-results/**/*.xml
98+
src/test-project/build/jacoco/
9199
92100
run_on_windows:
93101
runs-on: windows-latest

.github/workflows/sonar.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/download-artifact@v4
2424
with:
2525
path: reports
26-
pattern: -test-reports
26+
pattern: sonar-coverage
2727
github-token: ${{ secrets.GITHUB_TOKEN }}
2828
run-id: ${{github.event.workflow_run.id}}
2929
- name: Download PrInfo
@@ -37,13 +37,16 @@ jobs:
3737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3838
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3939
run: |
40+
mkdir build
41+
ls reports
42+
cp -r reports/* build/
4043
if [ '${{github.event.workflow_run.event}}' == 'pull_request' ]; then
4144
PR_NUMBER=$(<prInfo/PR)
4245
BASE_REF=$(<prInfo/base_ref)
4346
HEAD_REF=$(<prInfo/head_ref)
44-
./gradlew build sonar -Dsonar.pullrequest.base=$BASE_REF -Dsonar.pullrequest.branch=$HEAD_REF -Dsonar.pullrequest.key=$PR_NUMBER -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=${{github.repository}}
47+
./gradlew jacocoTestReport sonar -Dsonar.pullrequest.base=$BASE_REF -Dsonar.pullrequest.branch=$HEAD_REF -Dsonar.pullrequest.key=$PR_NUMBER -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=${{github.repository}}
4548
else
46-
./gradlew build sonar
49+
./gradlew jacocoTestReport sonar
4750
fi
4851
shell: bash
4952

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tasks {
4646
property("sonar.organization", "redhat-developer")
4747
property("sonar.host.url", "https://sonarcloud.io")
4848
property("sonar.junit.reportsPath", layout.buildDirectory.dir("test-results").get().asFile.absolutePath)
49+
property("sonar.gradle.skipCompile", "true")
4950
}
5051
}
5152
}

src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void setProjectSdkIfAvailable(String targetSdkName) {
167167
String label = foundItems.values().stream().findFirst().get();
168168
projectSdkList.jList().clickItem(label, true);
169169
// wait for 'resolving JDK' progressmonitor to end
170-
waitForIgnoringError(Duration.ofSeconds(5), () -> remoteRobot.callJs("true"));
170+
waitForIgnoringError(Duration.ofSeconds(10), () -> remoteRobot.callJs("true"));
171171
} else {
172172
ScreenshotUtils.takeScreenshot(remoteRobot, "No SDK found starting with " + targetSdkName);
173173
}

src/test-project/build.gradle.kts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ repositories {
2626
dependencies {
2727
intellijPlatform {
2828
create(IntelliJPlatformType.IntellijIdeaCommunity, platformVersion)
29-
instrumentationTools()
3029
}
3130
testImplementation("com.redhat.devtools.intellij:intellij-common-ui-test-library")
3231
testImplementation("org.junit.platform:junit-platform-launcher:1.10.3")
@@ -44,6 +43,25 @@ tasks {
4443
from("idea_license_token/idea.key")
4544
into("build/idea-sandbox/config-uiTest")
4645
}
46+
47+
withType<Test> {
48+
configure<JacocoTaskExtension> {
49+
isIncludeNoLocationClasses = true
50+
excludes = listOf("jdk.internal.*")
51+
}
52+
}
53+
54+
jacocoTestReport {
55+
executionData.setFrom(fileTree(layout.buildDirectory).include("/jacoco/*.exec"))
56+
classDirectories.setFrom(instrumentCode)
57+
reports {
58+
xml.required = true
59+
}
60+
}
61+
62+
jacocoTestCoverageVerification {
63+
classDirectories.setFrom(instrumentCode)
64+
}
4765
}
4866

4967
val integrationUITestUltimate by intellijPlatformTesting.testIde.registering {

0 commit comments

Comments
 (0)