Skip to content

Commit 5882656

Browse files
committed
Be more permissive for Surefire and Failsafe reports' path
1 parent 17a0d4f commit 5882656

File tree

1 file changed

+21
-10
lines changed
  • build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions

1 file changed

+21
-10
lines changed

build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReports.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkus.bot.buildreporter.githubactions;
22

3+
import java.nio.file.Files;
34
import java.nio.file.Path;
45
import java.util.Collections;
56
import java.util.HashSet;
@@ -9,10 +10,6 @@
910

1011
class BuildReports {
1112

12-
private static final Path MAVEN_SUREFIRE_REPORTS_PATH = Path.of("target", "surefire-reports");
13-
private static final Path MAVEN_FAILSAFE_REPORTS_PATH = Path.of("target", "failsafe-reports");
14-
private static final Path GRADLE_REPORTS_PATH = Path.of("build", "test-results", "test");
15-
1613
private final Path jobDirectory;
1714
private final Path buildReportPath;
1815
private final Path gradleBuildScanUrlPath;
@@ -61,6 +58,11 @@ public String toString() {
6158

6259
static class Builder {
6360

61+
private static final String TARGET = "target";
62+
private static final String FAILSAFE_REPORTS = "failsafe-reports";
63+
private static final String SUREFIRE_REPORTS = "surefire-reports";
64+
private static final Path GRADLE_REPORTS_PATH = Path.of("build", "test-results", "test");
65+
6466
private final Path jobDirectory;
6567
private Path buildReportPath;
6668
private Path gradleBuildScanUrlPath;
@@ -102,14 +104,23 @@ private boolean addTestPath(Path path) {
102104
return true;
103105
}
104106

105-
if (path.endsWith(MAVEN_SUREFIRE_REPORTS_PATH)) {
106-
testResultsPaths.add(new SurefireTestResultsPath(path));
107-
return true;
107+
if (!Files.isDirectory(path) || path.getNameCount() < 2) {
108+
return false;
108109
}
109-
if (path.endsWith(MAVEN_FAILSAFE_REPORTS_PATH)) {
110-
testResultsPaths.add(new FailsafeTestResultsPath(path));
111-
return true;
110+
111+
if (path.getFileName().toString().startsWith(SUREFIRE_REPORTS)) {
112+
if (path.getName(path.getNameCount() - 2).toString().equals(TARGET)) {
113+
testResultsPaths.add(new SurefireTestResultsPath(path));
114+
return true;
115+
}
112116
}
117+
if (path.getFileName().toString().startsWith(FAILSAFE_REPORTS)) {
118+
if (path.getName(path.getNameCount() - 2).toString().equals(TARGET)) {
119+
testResultsPaths.add(new FailsafeTestResultsPath(path));
120+
return true;
121+
}
122+
}
123+
113124
if (path.endsWith(GRADLE_REPORTS_PATH)) {
114125
testResultsPaths.add(new GradleTestResultsPath(path));
115126
return true;

0 commit comments

Comments
 (0)