diff --git a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporter.java b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporter.java index 8da60be..18ae841 100644 --- a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporter.java +++ b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporter.java @@ -64,6 +64,7 @@ public Optional generateReportComment(String workflowName, workflowRunIdMarker, WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER, buildReporterConfig.isDevelocityEnabled(), + buildReporterConfig.getDevelocityUrl(), indicateSuccess, hasOtherPendingCheckRuns, true, @@ -77,6 +78,7 @@ public Optional generateReportComment(String workflowName, workflowRunIdMarker, WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER, buildReporterConfig.isDevelocityEnabled(), + buildReporterConfig.getDevelocityUrl(), indicateSuccess, hasOtherPendingCheckRuns, false, @@ -91,6 +93,22 @@ public Optional generateReportComment(String workflowName, workflowRunIdMarker, WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER, buildReporterConfig.isDevelocityEnabled(), + buildReporterConfig.getDevelocityUrl(), + indicateSuccess, + hasOtherPendingCheckRuns, + false, + false, + workflowReportJobIncludeStrategy); + } + if (reportComment.length() > GITHUB_FIELD_LENGTH_HARD_LIMIT) { + reportComment = workflowReportFormatter.getReportComment(workflowReport, + artifactsAvailable, + checkRunOptional.orElse(null), + statusCommentMarker, + workflowRunIdMarker, + WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER, + false, + null, indicateSuccess, hasOtherPendingCheckRuns, false, @@ -112,12 +130,19 @@ public Optional createCheckRun(GHWorkflowRun workflowRun, String name = WorkflowConstants.BUILD_SUMMARY_CHECK_RUN_PREFIX + workflowRun.getHeadSha(); String summary = workflowReportFormatter.getCheckRunReportSummary(workflowReport, workflowContext, artifactsAvailable, workflowReportJobIncludeStrategy); - String checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, true, true); + String checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, + buildReporterConfig.isDevelocityEnabled(), buildReporterConfig.getDevelocityUrl(), true, true); + if (checkRunReport.length() > GITHUB_FIELD_LENGTH_HARD_LIMIT) { + checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, + buildReporterConfig.isDevelocityEnabled(), buildReporterConfig.getDevelocityUrl(), false, true); + } if (checkRunReport.length() > GITHUB_FIELD_LENGTH_HARD_LIMIT) { - checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, false, true); + checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, + buildReporterConfig.isDevelocityEnabled(), buildReporterConfig.getDevelocityUrl(), false, false); } if (checkRunReport.length() > GITHUB_FIELD_LENGTH_HARD_LIMIT) { - checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, false, false); + checkRunReport = workflowReportFormatter.getCheckRunReport(workflowReport, + false, null, false, false); } Output checkRunOutput = new Output(name, summary).withText(checkRunReport); diff --git a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporterConfig.java b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporterConfig.java index bd0861a..f94b80d 100644 --- a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporterConfig.java +++ b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/BuildReporterConfig.java @@ -13,14 +13,17 @@ public class BuildReporterConfig { private final Set monitoredWorkflows; private final boolean createCheckRun; private final boolean develocityEnabled; + private final String develocityUrl; private BuildReporterConfig(boolean dryRun, Comparator workflowJobComparator, - Set monitoredWorkflows, boolean createCheckRun, boolean develocityEnabled) { + Set monitoredWorkflows, boolean createCheckRun, boolean develocityEnabled, + String develocityUrl) { this.dryRun = dryRun; this.workflowJobComparator = workflowJobComparator; this.monitoredWorkflows = monitoredWorkflows; this.createCheckRun = createCheckRun; this.develocityEnabled = develocityEnabled; + this.develocityUrl = develocityUrl; } public boolean isDryRun() { @@ -43,6 +46,10 @@ public boolean isDevelocityEnabled() { return develocityEnabled; } + public String getDevelocityUrl() { + return develocityUrl; + } + public static Builder builder() { return new Builder(); } @@ -54,6 +61,7 @@ public static class Builder { private Comparator workflowJobComparator = DefaultJobNameComparator.INSTANCE; private Set monitoredWorkflows = Collections.emptySet(); private boolean develocityEnabled; + private String develocityUrl; public Builder dryRun(boolean dryRun) { this.dryRun = dryRun; @@ -80,9 +88,14 @@ public Builder enableDevelocity(boolean develocityEnabled) { return this; } + public Builder develocityUrl(String develocityUrl) { + this.develocityUrl = develocityUrl; + return this; + } + public BuildReporterConfig build() { return new BuildReporterConfig(dryRun, workflowJobComparator, monitoredWorkflows, createCheckRun, - develocityEnabled); + develocityEnabled, develocityUrl); } } diff --git a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/WorkflowReportFormatter.java b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/WorkflowReportFormatter.java index bf191f1..6e4b230 100644 --- a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/WorkflowReportFormatter.java +++ b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/WorkflowReportFormatter.java @@ -18,18 +18,20 @@ public String getCheckRunReportSummary(WorkflowReport report, WorkflowContext wo .render(); } - public String getCheckRunReport(WorkflowReport report, boolean includeStackTraces, boolean includeFailureLinks) { - return Templates.checkRunReport(report, includeStackTraces, includeFailureLinks).render(); + public String getCheckRunReport(WorkflowReport report, boolean develocityEnabled, String develocityUrl, + boolean includeStackTraces, boolean includeFailureLinks) { + return Templates.checkRunReport(report, develocityEnabled, develocityUrl, includeStackTraces, includeFailureLinks) + .render(); } public String getReportComment(WorkflowReport report, boolean artifactsAvailable, GHCheckRun checkRun, String messageIdActive, String workflowRunId, String buildScansCheckRunMarker, - boolean develocityEnabled, boolean indicateSuccess, boolean hasOtherPendingCheckRuns, + boolean develocityEnabled, String develocityUrl, boolean indicateSuccess, boolean hasOtherPendingCheckRuns, boolean includeStackTraces, boolean includeFailureLinks, WorkflowReportJobIncludeStrategy workflowReportJobIncludeStrategy) { return Templates .commentReport(report, artifactsAvailable, checkRun, messageIdActive, workflowRunId, buildScansCheckRunMarker, - develocityEnabled, indicateSuccess, hasOtherPendingCheckRuns, + develocityEnabled, develocityUrl, indicateSuccess, hasOtherPendingCheckRuns, includeStackTraces, includeFailureLinks, workflowReportJobIncludeStrategy) .render(); } @@ -40,12 +42,13 @@ private static class Templates { public static native TemplateInstance checkRunReportSummary(WorkflowReport report, WorkflowContext workflowContext, boolean artifactsAvailable, WorkflowReportJobIncludeStrategy workflowReportJobIncludeStrategy); - public static native TemplateInstance checkRunReport(WorkflowReport report, boolean includeStackTraces, - boolean includeFailureLinks); + public static native TemplateInstance checkRunReport(WorkflowReport report, + boolean develocityEnabled, String develocityUrl, + boolean includeStackTraces, boolean includeFailureLinks); public static native TemplateInstance commentReport(WorkflowReport report, boolean artifactsAvailable, GHCheckRun checkRun, String messageIdActive, String workflowRunId, String buildScansCheckRunMarker, - boolean develocityEnabled, boolean indicateSuccess, boolean hasOtherPendingCheckRuns, + boolean develocityEnabled, String develocityUrl, boolean indicateSuccess, boolean hasOtherPendingCheckRuns, boolean includeStackTraces, boolean includeFailureLinks, WorkflowReportJobIncludeStrategy workflowReportJobIncludeStrategy); } diff --git a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportFlakyTestCase.java b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportFlakyTestCase.java index 9803e02..bace148 100644 --- a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportFlakyTestCase.java +++ b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportFlakyTestCase.java @@ -13,12 +13,14 @@ public class WorkflowReportFlakyTestCase implements Comparable flakes; public WorkflowReportFlakyTestCase(String classPath, ReportTestCase reportTestCase, List flakes) { this.classPath = classPath; this.fullName = reportTestCase.getFullName(); this.fullClassName = reportTestCase.getFullClassName(); + this.name = reportTestCase.getName(); this.flakes = Collections.unmodifiableList(flakes); } @@ -34,6 +36,10 @@ public String getFullClassName() { return fullClassName; } + public String getName() { + return name; + } + public List getFlakes() { return flakes; } diff --git a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportTestCase.java b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportTestCase.java index 2a888c8..d6a4aaa 100644 --- a/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportTestCase.java +++ b/build-reporter-github-actions/src/main/java/io/quarkus/bot/buildreporter/githubactions/report/WorkflowReportTestCase.java @@ -10,6 +10,7 @@ public class WorkflowReportTestCase implements Comparable{failure.fullName}{#if failure.failureErrorLine} line {failure.failureErrorLine}{/if}{#if includeFailureLinks} - Source on GitHub - 🠅{/if}

+

{failure.fullName}{#if failure.failureErrorLine} line {failure.failureErrorLine}{/if}{#if develocityEnabled && develocityUrl} - History{/if}{#if includeFailureLinks} - Source on GitHub - 🠅{/if}

{#if (failure.abbreviatedFailureDetail && includeStackTraces) || (report.sameRepository && failure.failureErrorLine)}
@@ -60,7 +60,7 @@ {/for} {#if report.flakyTests} -## Flaky tests +## Flaky tests{#if develocityEnabled && develocityUrl} - Develocity{/if} {#for job in report.jobsWithFlakyTests} ### :gear: {job.name} @@ -69,7 +69,7 @@ #### :package: {module.name ? module.name : "Root project"} {#for flakyTest : module.flakyTests} -

{flakyTest.fullName}

+

{flakyTest.fullName}{#if develocityEnabled && develocityUrl} - History{/if}

{#for flake : flakyTest.flakes} - `{flake.message}`{#if flake.type} - {flake.type}{/if} diff --git a/build-reporter-github-actions/src/main/resources/templates/WorkflowReportFormatter/commentReport.md b/build-reporter-github-actions/src/main/resources/templates/WorkflowReportFormatter/commentReport.md index 7897b79..bd83103 100644 --- a/build-reporter-github-actions/src/main/resources/templates/WorkflowReportFormatter/commentReport.md +++ b/build-reporter-github-actions/src/main/resources/templates/WorkflowReportFormatter/commentReport.md @@ -54,7 +54,7 @@ Full information is available in the [Build summary check run]({checkRun.htmlUrl {#if module.testFailures} {#for failure : module.testFailures} -

{failure.fullName}{#if failure.failureErrorLine} line {failure.failureErrorLine}{/if}{#if includeFailureLinks} - {#if checkRun && failure.failureDetail}More details - {/if}Source on GitHub{/if}

+

{failure.fullName}{#if failure.failureErrorLine} line {failure.failureErrorLine}{/if}{#if develocityEnabled && develocityUrl} - History{/if}{#if includeFailureLinks} - {#if checkRun && failure.failureDetail}More details - {/if}Source on GitHub{/if}

{#if failure.abbreviatedFailureDetail && includeStackTraces}
@@ -98,7 +98,7 @@ It should be safe to merge provided you have a look at the other checks in the s --- -## Flaky tests +## Flaky tests{#if develocityEnabled && develocityUrl} - Develocity{/if} {#for job in report.jobsWithFlakyTests} ### :gear: {job.name} @@ -107,7 +107,7 @@ It should be safe to merge provided you have a look at the other checks in the s #### :package: {module.name ? module.name : "Root project"} {#for flakyTest : module.flakyTests} -

{flakyTest.fullName}

+

{flakyTest.fullName}{#if develocityEnabled && develocityUrl} - History{/if}

{#for flake : flakyTest.flakes} - `{flake.message}`{#if flake.type} - {flake.type}{/if}