Skip to content

Commit

Permalink
Prepare for Quarkus LangChain4j arrival
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Nov 8, 2024
1 parent ffd4b22 commit 37906ed
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.15.1</quarkus.version>
<quarkus.version>3.16.2</quarkus.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<surefire-plugin.version>3.5.0</surefire-plugin.version>
Expand All @@ -26,7 +26,7 @@

<quarkus-github-app.version>2.7.0</quarkus-github-app.version>
<glob.version>0.9.0</glob.version>
<build-reporter.version>3.9.5</build-reporter.version>
<build-reporter.version>3.9.6</build-reporter.version>
<assertj.version>3.26.3</assertj.version>
</properties>
<dependencyManagement>
Expand Down
50 changes: 49 additions & 1 deletion src/main/java/io/quarkus/bot/AnalyzeWorkflowRunResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ void analyzeWorkflowResults(@WorkflowRun.Completed @WorkflowRun.Requested GHEven
return;
}

Comparator<GHWorkflowJob> workflowJobComparator;

switch (workflowRunPayload.getRepository().getFullName()) {
case "quarkusio/quarkus":
workflowJobComparator = QuarkusWorkflowJobComparator.INSTANCE;
break;
case "quarkiverse/quarkus-langchain4j":
workflowJobComparator = QuarkusLangChain4jWorkflowJobComparator.INSTANCE;
break;
default:
// it will use the default ones
workflowJobComparator = null;
}

BuildReporterConfig buildReporterConfig = BuildReporterConfig.builder()
.dryRun(quarkusBotConfig.isDryRun())
.monitoredWorkflows(quarkusBotConfigFile.workflowRunAnalysis.workflows)
.workflowJobComparator(QuarkusWorkflowJobComparator.INSTANCE)
.workflowJobComparator(workflowJobComparator)
.enableDevelocity(quarkusBotConfigFile.develocity.enabled)
.develocityUrl(quarkusBotConfigFile.develocity.url)
.build();
Expand Down Expand Up @@ -113,4 +127,38 @@ private static int getOrder(String jobName) {
return 200;
}
}

private final static class QuarkusLangChain4jWorkflowJobComparator implements Comparator<GHWorkflowJob> {

private static final QuarkusLangChain4jWorkflowJobComparator INSTANCE = new QuarkusLangChain4jWorkflowJobComparator();

@Override
public int compare(GHWorkflowJob o1, GHWorkflowJob o2) {
int order1 = getOrder(o1.getName());
int order2 = getOrder(o2.getName());

if (order1 == order2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}

return order1 - order2;
}

private static int getOrder(String jobName) {
if (jobName.startsWith("Quick Build")) {
return 1;
}
if (jobName.startsWith("JVM tests - ")) {
return 2;
}
if (jobName.startsWith("Native tests - ")) {
return 12;
}
if (jobName.startsWith("In process embedding model tests - ")) {
return 22;
}

return 200;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class QuarkusWorkflowConstants {
public static final String JOB_NAME_INITIAL_JDK_PREFIX = "Initial JDK ";
public static final String JOB_NAME_JVM_TESTS_PREFIX = "JVM Tests";
public static final String JOB_NAME_JDK_PREFIX = "JDK";
public static final String JOB_NAME_JAVA_PREFIX = "Java";
public static final String JOB_NAME_WINDOWS = "Windows";
public static final String JOB_NAME_BUILD_REPORT = "Build report";
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public String label(String name) {
String[] tokens = name.split(QuarkusWorkflowConstants.JOB_NAME_DELIMITER);

for (int i = 0; i < tokens.length; i++) {
if (tokens[i].startsWith(QuarkusWorkflowConstants.JOB_NAME_JDK_PREFIX)) {
if (tokens[i].startsWith(QuarkusWorkflowConstants.JOB_NAME_JDK_PREFIX)
|| tokens[i].startsWith(QuarkusWorkflowConstants.JOB_NAME_JAVA_PREFIX)) {
break;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.bot.workflow.report;

import java.util.Locale;

import jakarta.inject.Singleton;

import io.quarkus.bot.buildreporter.githubactions.WorkflowConstants;
Expand Down Expand Up @@ -38,7 +40,8 @@ public boolean include(WorkflowReport report, WorkflowReportJob job) {
}

private static boolean isJvmTests(WorkflowReportJob job) {
return job.getName().startsWith(QuarkusWorkflowConstants.JOB_NAME_JVM_TESTS_PREFIX);
return job.getName().toLowerCase(Locale.ROOT)
.startsWith(QuarkusWorkflowConstants.JOB_NAME_JVM_TESTS_PREFIX.toLowerCase(Locale.ROOT));
}

private static boolean isWindows(WorkflowReportJob job) {
Expand Down

0 comments on commit 37906ed

Please sign in to comment.