Skip to content

Commit

Permalink
Merge pull request #432 from gsmet/improve-job-order
Browse files Browse the repository at this point in the history
Enforce the job order
  • Loading branch information
gsmet authored Mar 22, 2024
2 parents 5f72755 + 3c78dfe commit e63a48e
Showing 1 changed file with 57 additions and 7 deletions.
64 changes: 57 additions & 7 deletions src/main/java/io/quarkus/bot/AnalyzeWorkflowRunResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io.quarkus.bot.config.Feature;
import io.quarkus.bot.config.QuarkusGitHubBotConfig;
import io.quarkus.bot.config.QuarkusGitHubBotConfigFile;
import io.quarkus.bot.workflow.QuarkusWorkflowConstants;
import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient;

public class AnalyzeWorkflowRunResults {
Expand Down Expand Up @@ -51,16 +50,67 @@ private final static class QuarkusWorkflowJobComparator implements Comparator<GH

@Override
public int compare(GHWorkflowJob o1, GHWorkflowJob o2) {
if (o1.getName().startsWith(QuarkusWorkflowConstants.JOB_NAME_INITIAL_JDK_PREFIX)
&& !o2.getName().startsWith(QuarkusWorkflowConstants.JOB_NAME_INITIAL_JDK_PREFIX)) {
return -1;
int order1 = getOrder(o1.getName());
int order2 = getOrder(o2.getName());

if (order1 == order2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
if (!o1.getName().startsWith(QuarkusWorkflowConstants.JOB_NAME_INITIAL_JDK_PREFIX)
&& o2.getName().startsWith(QuarkusWorkflowConstants.JOB_NAME_INITIAL_JDK_PREFIX)) {

return order1 - order2;
}

private static int getOrder(String jobName) {
if (jobName.startsWith("Initial JDK")) {
return 1;
}
if (jobName.startsWith("Calculate Test Jobs")) {
return 2;
}
if (jobName.startsWith("JVM Tests - ")) {
if (jobName.contains("Windows")) {
return 12;
}
return 11;
}
if (jobName.startsWith("Maven Tests - ")) {
if (jobName.contains("Windows")) {
return 22;
}
return 21;
}
if (jobName.startsWith("Gradle Tests - ")) {
if (jobName.contains("Windows")) {
return 32;
}
return 31;
}
if (jobName.startsWith("Devtools Tests - ")) {
if (jobName.contains("Windows")) {
return 42;
}
return 41;
}
if (jobName.startsWith("Kubernetes Tests - ")) {
if (jobName.contains("Windows")) {
return 52;
}
return 51;
}
if (jobName.startsWith("Quickstarts Compilation")) {
return 61;
}
if (jobName.startsWith("MicroProfile TCKs Tests")) {
return 71;
}
if (jobName.startsWith("Native Tests - ")) {
if (jobName.contains("Windows")) {
return 82;
}
return 81;
}

return o1.getName().compareTo(o2.getName());
return 200;
}
}
}

0 comments on commit e63a48e

Please sign in to comment.