You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2026/07/31 01:19:32 UTC

[PR] [DO-NOT-MERGE] check tested scope [incubator-kie-drools]

tkobayas opened a new pull request, #6860:
URL: https://github.com/apache/incubator-kie-drools/pull/6860

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892478351


##########
.github/workflows/ci.yaml:
##########
@@ -216,14 +248,145 @@ jobs:
         uses: actions/upload-artifact@v7
         if: ${{ always() }}
         with:
-          name: build-logs_${{ matrix.os }}_java-${{ matrix.java }}
+          name: build-logs_optaplanner_${{ matrix.os }}_java-${{ matrix.java }}
           path: '**/build.log'
 
       - name: Upload Build Compare
         uses: actions/upload-artifact@v7
         if: ${{ always() }}
         with:
-          name: build-compare_${{ matrix.os }}_java-${{ matrix.java }}
+          name: build-compare_optaplanner_${{ matrix.os }}_java-${{ matrix.java }}
+          path: |
+            **/*.buildcompare
+            **/*.buildinfo
+
+  test-kogito-runtimes:
+    if: github.event.action != 'closed' && github.event_name == 'pull_request'
+    name: 'kogito-runtimes :: ${{ matrix.os }}, Java ${{ matrix.java }}'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os:   [ubuntu-latest]
+        java: [17, 21]
+    steps:
+      - name: "SETUP :: Checkout to load local actions"
+        uses: actions/checkout@v7
+
+      - uses: ./.github/actions/ci-setup
+        with:
+          ref: ${{ github.base_ref }}
+          java-version: ${{ matrix.java }}
+
+      - name: "PR CHECK :: BUILD :: Upstream + drools + optaplanner modules (tests skipped)"
+        shell: bash
+        run: |
+          [ ! -s "$MAVEN_PL_AFFECTED_KOGITO_RUNTIMES_FILE" ] && echo "No affected kogito-runtimes modules. Skipping upstream build." && exit 0
+          upstream=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE")
+          drools=$(paste -sd, "$MAVEN_PL_AFFECTED_DROOLS_FILE")
+          optaplanner=$(paste -sd, "$MAVEN_PL_AFFECTED_OPTAPLANNER_FILE")
+          pl=$(echo "$upstream,$drools,$optaplanner" | sed 's/^,//;s/,,*/,/g;s/,$//')
+          [ -z "$pl" ] && echo "No modules to build. Skipping." && exit 0
+          mvn --batch-mode --no-transfer-progress -T 1C -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install

Review Comment:
   Thanks, yes. I removed the duplication.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892386704


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -166,13 +167,30 @@ public static void main(String[] args) throws Exception {
         writeLines(affectedOut, affected);
         writeLines(changedOut, changed);
 
+        Map<String, Set<Path>> categories = parseModuleCategories(cwd.resolve("pom.xml"), cwd);
+
+        for (String cat : categories.keySet()) {
+            Set<String> catAffected = affected.stream()
+                    .filter(ga -> categorizeGa(ga, gaToDir, categories).equals(cat))
+                    .collect(Collectors.toCollection(LinkedHashSet::new));
+            writeLines(partitionedPath(affectedOut, cat), catAffected);
+        }
+
         int total = gaToDir.size();
         int ignored = total - affected.size() - upstreamAll.size();
-        System.out.println("total=" + total
-                + " changed=" + changed.size()
-                + " affected=" + affected.size()
-                + " upstream=" + upstreamAll.size()
-                + " ignored=" + ignored);
+        StringBuilder sb = new StringBuilder();
+        sb.append("total=").append(total)
+          .append(" changed=").append(changed.size())
+          .append(" affected=").append(affected.size())
+          .append(" upstream=").append(upstreamAll.size())
+          .append(" ignored=").append(ignored);
+        for (String cat : categories.keySet()) {
+            long catCount = affected.stream()
+                    .filter(ga -> categorizeGa(ga, gaToDir, categories).equals(cat))
+                    .count();
+            sb.append(" affected-").append(cat).append("=").append(catCount);
+        }

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3802646786


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static final List<String> EXPECTED_CATEGORIES = List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+    static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path cwd) throws IOException {
+        Map<String, Set<Path>> categories = new LinkedHashMap<>();
+        categories.put("drools", new LinkedHashSet<>());
+        for (String cat : EXPECTED_CATEGORIES) {
+            categories.put(cat, new LinkedHashSet<>());
+        }
+
+        String currentCategory = "drools";
+        boolean inModules = false;
+        Set<String> seenBegins = new HashSet<>();
+        Set<String> seenEnds = new HashSet<>();
+
+        Pattern beginPattern = Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern endPattern = Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern modulePattern = Pattern.compile("<module>(.+)</module>");
+
+        for (String line : Files.readAllLines(rootPom)) {
+            String trimmed = line.trim();
+
+            if (trimmed.equals("<modules>")) {
+                inModules = true;
+                continue;
+            }
+            if (trimmed.equals("</modules>")) {
+                break;
+            }
+            if (!inModules) continue;
+
+            Matcher beginMatcher = beginPattern.matcher(trimmed);
+            if (beginMatcher.matches()) {
+                currentCategory = beginMatcher.group(1);
+                if (!categories.containsKey(currentCategory)) {
+                    System.err.println("ERROR: unknown module category '" + currentCategory
+                            + "' in pom.xml marker. Expected one of: " + EXPECTED_CATEGORIES);
+                    System.exit(1);
+                }
+                seenBegins.add(currentCategory);
+                continue;
+            }
+
+            Matcher endMatcher = endPattern.matcher(trimmed);
+            if (endMatcher.matches()) {
+                seenEnds.add(endMatcher.group(1));
+                currentCategory = "drools";
+                continue;
+            }
+
+            Matcher moduleMatcher = modulePattern.matcher(trimmed);
+            if (moduleMatcher.matches()) {
+                String modulePath = moduleMatcher.group(1);
+                categories.get(currentCategory).add(cwd.resolve(modulePath).toAbsolutePath().normalize());
+            }
+        }
+
+        for (String cat : EXPECTED_CATEGORIES) {
+            if (!seenBegins.contains(cat)) {
+                System.err.println("ERROR: missing '<!-- BEGIN " + cat
+                        + " modules (auto) -->' marker in pom.xml");
+                System.exit(1);
+            }
+            if (!seenEnds.contains(cat)) {
+                System.err.println("ERROR: missing '<!-- END " + cat
+                        + " modules (auto) -->' marker in pom.xml");
+                System.exit(1);
+            }
+        }
+
+        return categories;
+    }
+
+    private static String categorizeGa(String ga, Map<String, Path> gaToDir,
+                                        Map<String, Set<Path>> categories) {
+        Path dir = gaToDir.get(ga);
+        if (dir == null) return "drools";
+        dir = dir.toAbsolutePath().normalize();
+        for (var entry : categories.entrySet()) {
+            for (Path catPath : entry.getValue()) {
+                if (dir.equals(catPath) || dir.startsWith(catPath + "/")) {
+                    return entry.getKey();
+                }
+            }
+        }
+        return "drools";
+    }

Review Comment:
   `dir.startsWith(catPath + "/")` is not path-separator safe (notably on Windows where separators are `\`), and it also bypasses `Path` segment semantics by converting to a `String`. Use `dir.startsWith(catPath)` (which already correctly handles descendants by path segments) and drop the `+ "/"` logic.



##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -166,13 +167,30 @@ public static void main(String[] args) throws Exception {
         writeLines(affectedOut, affected);
         writeLines(changedOut, changed);
 
+        Map<String, Set<Path>> categories = parseModuleCategories(cwd.resolve("pom.xml"), cwd);
+
+        for (String cat : categories.keySet()) {
+            Set<String> catAffected = affected.stream()
+                    .filter(ga -> categorizeGa(ga, gaToDir, categories).equals(cat))
+                    .collect(Collectors.toCollection(LinkedHashSet::new));
+            writeLines(partitionedPath(affectedOut, cat), catAffected);
+        }
+
         int total = gaToDir.size();
         int ignored = total - affected.size() - upstreamAll.size();
-        System.out.println("total=" + total
-                + " changed=" + changed.size()
-                + " affected=" + affected.size()
-                + " upstream=" + upstreamAll.size()
-                + " ignored=" + ignored);
+        StringBuilder sb = new StringBuilder();
+        sb.append("total=").append(total)
+          .append(" changed=").append(changed.size())
+          .append(" affected=").append(affected.size())
+          .append(" upstream=").append(upstreamAll.size())
+          .append(" ignored=").append(ignored);
+        for (String cat : categories.keySet()) {
+            long catCount = affected.stream()
+                    .filter(ga -> categorizeGa(ga, gaToDir, categories).equals(cat))
+                    .count();
+            sb.append(" affected-").append(cat).append("=").append(catCount);
+        }

Review Comment:
   `categorizeGa(...)` is called repeatedly for every category (and again for summary counts), which scales poorly as `affected` grows. Precompute a map `ga -> category` once (or group `affected` using `Collectors.groupingBy(...)`) and reuse it both for writing category files and for the per-category counts.



##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -166,13 +167,30 @@ public static void main(String[] args) throws Exception {
         writeLines(affectedOut, affected);
         writeLines(changedOut, changed);
 
+        Map<String, Set<Path>> categories = parseModuleCategories(cwd.resolve("pom.xml"), cwd);
+
+        for (String cat : categories.keySet()) {
+            Set<String> catAffected = affected.stream()
+                    .filter(ga -> categorizeGa(ga, gaToDir, categories).equals(cat))
+                    .collect(Collectors.toCollection(LinkedHashSet::new));
+            writeLines(partitionedPath(affectedOut, cat), catAffected);
+        }

Review Comment:
   `categorizeGa(...)` is called repeatedly for every category (and again for summary counts), which scales poorly as `affected` grows. Precompute a map `ga -> category` once (or group `affected` using `Collectors.groupingBy(...)`) and reuse it both for writing category files and for the per-category counts.



##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static final List<String> EXPECTED_CATEGORIES = List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+    static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path cwd) throws IOException {
+        Map<String, Set<Path>> categories = new LinkedHashMap<>();
+        categories.put("drools", new LinkedHashSet<>());
+        for (String cat : EXPECTED_CATEGORIES) {
+            categories.put(cat, new LinkedHashSet<>());
+        }
+
+        String currentCategory = "drools";
+        boolean inModules = false;
+        Set<String> seenBegins = new HashSet<>();
+        Set<String> seenEnds = new HashSet<>();
+
+        Pattern beginPattern = Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern endPattern = Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern modulePattern = Pattern.compile("<module>(.+)</module>");
+
+        for (String line : Files.readAllLines(rootPom)) {
+            String trimmed = line.trim();
+
+            if (trimmed.equals("<modules>")) {
+                inModules = true;
+                continue;
+            }
+            if (trimmed.equals("</modules>")) {
+                break;
+            }
+            if (!inModules) continue;
+
+            Matcher beginMatcher = beginPattern.matcher(trimmed);
+            if (beginMatcher.matches()) {
+                currentCategory = beginMatcher.group(1);
+                if (!categories.containsKey(currentCategory)) {
+                    System.err.println("ERROR: unknown module category '" + currentCategory
+                            + "' in pom.xml marker. Expected one of: " + EXPECTED_CATEGORIES);

Review Comment:
   The error message says “Expected one of: [optaplanner, kogito-runtimes, kogito-apps]” but `drools` is also a valid category (it’s always present in `categories`). Include `drools` in the “Expected one of” list (or build the message from `categories.keySet()`) so the guidance matches what the code actually accepts.



##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->

Review Comment:
   This comment implies the BEGIN/END markers are mandatory for all categories, but `parseModuleCategories(...)` only enforces markers for `optaplanner`, `kogito-runtimes`, and `kogito-apps` (not `drools`). Either (a) also enforce the drools BEGIN/END markers in code for consistency, or (b) adjust the comment to reflect which categories are strictly validated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5434690911

   # Parallel CI Test Run: Partition Files Approach
   
   Run `89495155157` — all modules affected (root pom change), 857 modules total.
   
   ## Module distribution
   
   | Partition | Affected modules | Tests |
   |---|---:|---:|
   | partition0 (optaplanner) | 28 | 1,535 |
   | partition1 (kogito-runtimes) | 179 | 2,260 |
   | partition2 (kogito-apps) | 194 | 2,083 |
   | default (drools + shared) | 452 | 29,432 |
   | **Total** | **853** | **35,310** |
   
   ## Job elapsed time
   
   | Job | Java 17 ||| Java 21 |||
   |---|---:|---:|---:|---:|---:|---:|
   | | upstream | test | **total** | upstream | test | **total** |
   | compute-partitions | — | — | **2m 24s** | — | — | — |
   | partition0 (optaplanner) | 3m 26s | 9m 17s | **15m 21s** | 3m 06s | 7m 52s | **13m 28s** |
   | partition1 (kogito-runtimes) | 9m 32s | 40m 21s | **52m 57s** | 7m 26s | 39m 34s | **49m 28s** |
   | partition2 (kogito-apps) | 14m 07s | 1h 03m | **1h 20m 31s** | 13m 12s | 59m 06s | **1h 14m 20s** |
   | default (drools + core) | 8m 41s | 53m 32s | **1h 05m 15s** | 8m 28s | 51m 53s | **1h 03m 29s** |
   
   Wall-clock time = compute-partitions (2m 24s) + slowest test job (1h 20m 31s) = **~1h 23m**
   
   Note: The upstream doesn't have `-T 1C` to avoid quarkus build ordering issue. (will investigate next)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892377542


##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->
+    <!-- BEGIN drools modules (auto) -->

Review Comment:
   Applied the partition approach.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892414776


##########
.github/actions/ci-setup/action.yaml:
##########
@@ -0,0 +1,128 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: "CI Setup"
+description: "Shared CI setup: checkout, Java, JBang, Maven settings, build scope computation"
+
+inputs:
+  ref:
+    description: "Base ref for PR checkout"
+    required: true
+  java-version:
+    description: "Java version to set up"
+    required: true
+
+runs:
+  using: "composite"
+  steps:
+    - name: 'SETUP :: Free disk space (Ubuntu)'
+      if: runner.os == 'Linux'
+      shell: bash
+      run: |
+        sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
+        df -h
+
+    - name: 'SETUP :: Enable long file paths (Windows)'
+      if: runner.os == 'Windows'
+      shell: pwsh
+      run: |
+        git config --system core.longpaths true
+        reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+
+    - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
+      uses: ./.github/actions/checkout-pr
+      with:
+        ref: ${{ inputs.ref }}
+
+    - uses: actions/setup-java@v5
+      name: 'SETUP :: Java ${{ inputs.java-version }}'
+      with:
+        java-version: ${{ inputs.java-version }}
+        distribution: temurin
+        cache: maven
+
+    # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
+    # See https://github.com/apache/infrastructure-actions/pull/806
+    - name: 'SETUP :: Install JBang'
+      shell: bash
+      run: |
+        curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
+        echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
+        unzip -q jbang.zip
+        echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+
+    - name: 'SETUP :: Block apache.snapshots Maven repository'
+      shell: bash
+      run: |
+        mkdir -p "$HOME/.m2"
+        cat > "$HOME/.m2/settings.xml" <<'EOF'
+        <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
+                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
+          <mirrors>
+            <mirror>
+              <id>block-apache-snapshots</id>
+              <mirrorOf>apache.snapshots,apache-snapshot-repository</mirrorOf>
+              <url>https://repository.apache.org/snapshots/</url>
+              <blocked>true</blocked>
+            </mirror>
+          </mirrors>
+        </settings>
+        EOF
+
+    - name: 'SETUP :: Set paths for temporary files'
+      shell: bash
+      run: |
+        echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
+        echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_DROOLS_FILE=${{ runner.temp }}/maven-pl-affected-drools.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_OPTAPLANNER_FILE=${{ runner.temp }}/maven-pl-affected-optaplanner.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_KOGITO_RUNTIMES_FILE=${{ runner.temp }}/maven-pl-affected-kogito-runtimes.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_KOGITO_APPS_FILE=${{ runner.temp }}/maven-pl-affected-kogito-apps.txt" >> "$GITHUB_ENV"
+        touch "${{ runner.temp }}/changed-files.txt"
+        touch "${{ runner.temp }}/maven-pl-affected.txt"
+        touch "${{ runner.temp }}/maven-pl-upstream.txt"
+        touch "${{ runner.temp }}/maven-pl-changed.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-drools.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-optaplanner.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-kogito-runtimes.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-kogito-apps.txt"

Review Comment:
   Thanks. Applied the partition approach.
   Filenames are `partition0.txt`, `partition1.txt`... for easier processing. We can add a comment line like `# optaplanner` for explanation.
   
   Also we have "implicit default" partition which catches:
   - Modules in zero explicit partitions' closures (= not referenced by any leaves in the partition files)
   - Modules in multiple explicit partitions' closures (shared modules like `kogito-api`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5446738079

   # Parallel CI Test Run: Parallel Upstream with Quarkus Application Rebuild
   
   Run `89559962903` — all jobs completed successfully.
   
   ## Job elapsed time
   
   | Job | Java 17 ||| Java 21 |||
   |---|---:|---:|---:|---:|---:|---:|
   | | upstream | test | **total** | upstream | test | **total** |
   | compute-partitions | — | — | **2m 31s** | — | — | — |
   | partition0 (optaplanner) | 4m 55s | 9m 52s | **16m 47s** | 4m 30s | 9m 06s | **16m 00s** |
   | partition1 (kogito-runtimes) | 7m 06s | 43m 29s | **52m 37s** | 7m 29s | 46m 53s | **57m 15s** |
   | partition2 (kogito-apps) | 10m 18s | 1h 04m | **1h 17m 16s** | 10m 05s | 1h 01m | **1h 14m 28s** |
   | default (drools + shared) | 8m 09s | 56m 39s | **1h 07m 18s** | 7m 51s | 51m 20s | **1h 02m 12s** |
   
   The partition2 upstream figures include both upstream phases:
   
   - Java 17: parallel upstream 8m 39s + required Quarkus applications 1m 39s = 10m 18s
   - Java 21: parallel upstream 8m 30s + required Quarkus applications 1m 35s = 10m 05s
   
   The workflow wall-clock time, measured from the start of `compute-partitions` to the end of the slowest matrix job, was approximately **1h 24m 45s**. This includes an approximately five-minute scheduling gap between `compute-partitions` and the matrix jobs.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892383184


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static final List<String> EXPECTED_CATEGORIES = List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+    static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path cwd) throws IOException {
+        Map<String, Set<Path>> categories = new LinkedHashMap<>();
+        categories.put("drools", new LinkedHashSet<>());
+        for (String cat : EXPECTED_CATEGORIES) {
+            categories.put(cat, new LinkedHashSet<>());
+        }
+
+        String currentCategory = "drools";
+        boolean inModules = false;
+        Set<String> seenBegins = new HashSet<>();
+        Set<String> seenEnds = new HashSet<>();
+
+        Pattern beginPattern = Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern endPattern = Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern modulePattern = Pattern.compile("<module>(.+)</module>");
+
+        for (String line : Files.readAllLines(rootPom)) {
+            String trimmed = line.trim();
+
+            if (trimmed.equals("<modules>")) {
+                inModules = true;
+                continue;
+            }
+            if (trimmed.equals("</modules>")) {
+                break;
+            }
+            if (!inModules) continue;
+
+            Matcher beginMatcher = beginPattern.matcher(trimmed);
+            if (beginMatcher.matches()) {
+                currentCategory = beginMatcher.group(1);
+                if (!categories.containsKey(currentCategory)) {
+                    System.err.println("ERROR: unknown module category '" + currentCategory
+                            + "' in pom.xml marker. Expected one of: " + EXPECTED_CATEGORIES);
+                    System.exit(1);
+                }
+                seenBegins.add(currentCategory);
+                continue;
+            }
+
+            Matcher endMatcher = endPattern.matcher(trimmed);
+            if (endMatcher.matches()) {
+                seenEnds.add(endMatcher.group(1));
+                currentCategory = "drools";
+                continue;
+            }
+
+            Matcher moduleMatcher = modulePattern.matcher(trimmed);
+            if (moduleMatcher.matches()) {
+                String modulePath = moduleMatcher.group(1);
+                categories.get(currentCategory).add(cwd.resolve(modulePath).toAbsolutePath().normalize());
+            }
+        }
+
+        for (String cat : EXPECTED_CATEGORIES) {
+            if (!seenBegins.contains(cat)) {
+                System.err.println("ERROR: missing '<!-- BEGIN " + cat
+                        + " modules (auto) -->' marker in pom.xml");
+                System.exit(1);
+            }
+            if (!seenEnds.contains(cat)) {
+                System.err.println("ERROR: missing '<!-- END " + cat
+                        + " modules (auto) -->' marker in pom.xml");
+                System.exit(1);
+            }
+        }
+
+        return categories;
+    }
+
+    private static String categorizeGa(String ga, Map<String, Path> gaToDir,
+                                        Map<String, Set<Path>> categories) {
+        Path dir = gaToDir.get(ga);
+        if (dir == null) return "drools";
+        dir = dir.toAbsolutePath().normalize();
+        for (var entry : categories.entrySet()) {
+            for (Path catPath : entry.getValue()) {
+                if (dir.equals(catPath) || dir.startsWith(catPath + "/")) {
+                    return entry.getKey();
+                }
+            }
+        }
+        return "drools";
+    }

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892888097


##########
.github/workflows/ci-parallel.yaml:
##########
@@ -0,0 +1,178 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: 'CI :: Build - Parallel'
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened, closed, labeled]
+    branches: [main]
+    paths-ignore:
+      - 'LICENSE'
+      - '**/.gitignore'
+      - '**.md'
+      - '**.adoc'
+      - '*.txt'
+      - 'docsimg/**'
+      - '.ci/jenkins/**'
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
+jobs:
+
+  # Compute build scopes and partition affected modules.
+  # Uploads per-partition files as artifact and outputs a JSON array of
+  # partition names that have affected modules.
+  compute-partitions:
+    if: >-
+      github.event.action != 'closed'
+      && github.event_name == 'pull_request'
+      && contains(github.event.pull_request.labels.*.name, 'parallel ci')
+    runs-on: ubuntu-latest
+    outputs:
+      partitions: ${{ steps.partitions.outputs.partitions }}
+    steps:
+      - name: "SETUP :: Checkout to load local actions"
+        uses: actions/checkout@v7
+
+      - uses: ./.github/actions/ci-setup
+        with:
+          ref: ${{ github.base_ref }}
+          java-version: 17
+          partitions-dir: .github/supporting-files/ci/partitions
+
+      - id: partitions
+        name: "SETUP :: Build partition matrix"
+        shell: bash
+        run: |
+          json='['
+          first=true
+          for f in "${{ runner.temp }}"/maven-pl-affected-partition*.txt "${{ runner.temp }}"/maven-pl-affected-default.txt; do
+            [ ! -s "$f" ] && continue
+            name=$(basename "$f" .txt | sed 's/^maven-pl-affected-//')
+            $first || json+=','
+            first=false
+            json+="\"$name\""
+          done
+          json+=']'
+          echo "partitions=$json" >> "$GITHUB_OUTPUT"
+          echo "Partitions with affected modules: $json"
+
+      - uses: actions/upload-artifact@v7
+        with:
+          name: partition-files
+          path: |
+            ${{ runner.temp }}/maven-pl-affected-partition*.txt
+            ${{ runner.temp }}/maven-pl-affected-default.txt
+            ${{ runner.temp }}/maven-pl-upstream-partition*.txt
+            ${{ runner.temp }}/maven-pl-upstream-default.txt
+            ${{ runner.temp }}/maven-pl-image-producers-partition*.txt
+            ${{ runner.temp }}/maven-pl-image-producers-default.txt
+
+  # Each partition runs as an independent job via the dynamic matrix.
+  # GHA computes the cross-product of partition × java × os.
+  test:
+    needs: compute-partitions
+    if: needs.compute-partitions.outputs.partitions != '[]'
+    name: '${{ matrix.partition }} :: ${{ matrix.os }}, Java ${{ matrix.java }}'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        partition: ${{ fromJSON(needs.compute-partitions.outputs.partitions) }}
+        java: [17, 21]
+        os: [ubuntu-latest]
+    steps:
+      - name: "SETUP :: Checkout to load local actions"
+        uses: actions/checkout@v7
+
+      - uses: ./.github/actions/ci-setup
+        with:
+          ref: ${{ github.base_ref }}
+          java-version: ${{ matrix.java }}
+          skip-build-scopes: true
+
+      - uses: actions/download-artifact@v7
+        with:
+          name: partition-files
+          path: ${{ runner.temp }}
+
+      # Flag glossary:
+      #   --no-transfer-progress                    silence download progress bars (critical for 800+ modules)
+      #   -fae / --fail-at-end                      continue past failures so all broken modules are reported
+      #   -Dsurefire.redirectTestOutputToFile=true  redirect test JVM stdout/stderr to surefire-reports files
+      #   -Denforcer.skip=true                      skip Enforcer plugin
+      #   -Dcheckstyle.skip=true                    skip Checkstyle plugin
+      #   -Dformatter.skip=true                     skip formatter plugin
+      #   -Darchunit.skip=true                      skip ArchUnit plugin
+      #   -Dquarkus.build.skip=true                 skip Quarkus application build
+      #   -Ddisable.quarkus.plugin=true             skip compile-time Quarkus bootstrap
+      #   -Dskip.quarkus.image.assembly=true        skip assemblies that package target/quarkus-app
+
+      - name: "PR CHECK :: BUILD :: Upstream modules (tests skipped)"
+        shell: bash
+        run: |
+          pl=$(paste -sd, "${{ runner.temp }}/maven-pl-upstream-${{ matrix.partition }}.txt")
+          [ -z "$pl" ] && echo "No upstream modules. Skipping." && exit 0
+          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Ddisable.quarkus.plugin=true -Dskip.quarkus.image.assembly=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+
+      - name: "PR CHECK :: BUILD :: Required image-producing modules"
+        shell: bash
+        run: |
+          pl=$(paste -sd, "${{ runner.temp }}/maven-pl-image-producers-${{ matrix.partition }}.txt")
+          [ -z "$pl" ] && echo "No required image-producing modules. Skipping." && exit 0
+          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+
+      - name: "PR CHECK :: TEST :: ${{ matrix.partition }}"
+        shell: bash
+        run: |
+          pl=$(paste -sd, "${{ runner.temp }}/maven-pl-affected-${{ matrix.partition }}.txt")
+          [ -z "$pl" ] && echo "No affected modules. Skipping." && exit 0
+          mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible -pl "$pl" install
+
+      - name: 'SUMMARY :: Publish'
+        if: always()
+        shell: bash
+        env:
+          MERMAID_EXPANDED: ${{ matrix.java == 21 }}
+          MATRIX_OS: ${{ matrix.os }}
+          MATRIX_JAVA: ${{ matrix.java }}
+        run: |
+          MAVEN_PL_AFFECTED=$(paste -sd, "$MAVEN_PL_AFFECTED_FILE" 2>/dev/null || true) \
+          MAVEN_PL_UPSTREAM=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE" 2>/dev/null || true) \
+          MAVEN_PL_CHANGED=$(paste -sd, "$MAVEN_PL_CHANGED_FILE" 2>/dev/null || true) \

Review Comment:
   These variables read the unpartitioned placeholder files created by `ci-setup`, which remain empty because this job skips scope computation. The downloaded partition files use suffixed names, and the dependency graph is not included in the artifact either. As a result, every partition summary omits its build scope and presents a full-build reproduction command instead of the commands for the modules this job actually tested. Upload/download the graph and point the summary at `maven-pl-{affected,upstream}-${{ matrix.partition }}.txt` (and provide an appropriately partitioned changed set).



##########
.github/workflows/ci-parallel.yaml:
##########
@@ -0,0 +1,178 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: 'CI :: Build - Parallel'
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened, closed, labeled]

Review Comment:
   Label-based routing is incomplete. This workflow listens for `labeled` but not `unlabeled`, while `ci.yaml` listens for neither. Removing `parallel ci` therefore does not start the standard build, and adding it after a standard build has started does not trigger a standard-workflow run that can cancel that build, so the transition can leave either no replacement CI run or both builds running. Subscribe both workflows to `labeled` and `unlabeled`; their existing job conditions can then route each event and concurrency can cancel the superseded run.



##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -241,6 +277,104 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static Set<String> imageProducersIn(Set<String> modules, Set<String> imageProducers) {
+        Set<String> result = new LinkedHashSet<>(modules);
+        result.retainAll(imageProducers);
+        return result;
+    }
+
+    static class Partition {
+        final String name;
+        final Set<String> entries;
+        Set<String> closure = Set.of();
+        Set<String> assigned = new LinkedHashSet<>();
+        Set<String> upstream = new LinkedHashSet<>();
+        Partition(String name, Set<String> entries) {
+            this.name = name;
+            this.entries = entries;
+        }
+    }
+
+    static List<Partition> readPartitionFiles(Path partitionsDir, Map<Path, String> dirToGa, Path cwd) throws IOException {
+        List<Path> files;
+        try (Stream<Path> s = Files.list(partitionsDir)) {
+            files = s.filter(f -> f.getFileName().toString().startsWith("partition") && f.getFileName().toString().endsWith(".txt"))
+                     .sorted()
+                     .collect(Collectors.toList());
+        }
+        List<Partition> result = new ArrayList<>();
+        for (Path file : files) {
+            String partName = file.getFileName().toString().replaceFirst("\\.txt$", "");
+            result.add(new Partition(partName, readModuleFile(file, dirToGa, cwd, partName)));
+        }
+        return result;
+    }
+
+    static Set<String> readModuleFile(Path file, Map<Path, String> dirToGa, Path cwd, String listName) throws IOException {
+        Set<String> modules = new LinkedHashSet<>();
+        for (String line : Files.readAllLines(file)) {
+            String trimmed = line.trim();
+            if (trimmed.isEmpty() || trimmed.startsWith("#")) continue;
+            Path modDir = cwd.resolve(trimmed).toAbsolutePath().normalize();
+            String ga = dirToGa.get(modDir);
+            if (ga == null) {
+                System.err.println("ERROR: " + listName + ": '" + trimmed + "' does not resolve to a reactor module");
+                System.exit(1);
+            }
+            modules.add(ga);
+        }
+        return modules;
+    }
+
+    private static void computePartitionClosures(List<Partition> partitions, DepGraph graph) {
+        for (Partition p : partitions) {
+            p.closure = DepGraph.traverse(p.entries, graph.upstreamOf);
+        }
+    }
+
+    private static void assignToPartitionsExclusive(Set<String> affected, List<Partition> partitions,
+                                                      Partition defaultPartition) {
+        List<Partition> explicit = partitions.stream()
+                .filter(p -> p != defaultPartition)
+                .collect(Collectors.toList());
+        for (String ga : affected) {
+            Partition sole = null;
+            int count = 0;
+            for (Partition p : explicit) {
+                if (p.closure.contains(ga)) {
+                    sole = p;
+                    count++;
+                    if (count > 1) break;
+                }
+            }
+            if (count == 1) {
+                sole.assigned.add(ga);
+            } else {
+                defaultPartition.assigned.add(ga);
+            }
+        }
+    }
+
+    // The upstream set intentionally includes the partition's own affected modules.
+    // Without them, an upstream module from another partition could fail to resolve
+    // dependencies on this partition's affected modules (e.g., shared module U depends
+    // on affected module V — if V is removed from upstream, building U fails).
+    private static void computePerPartitionUpstream(List<Partition> partitions, DepGraph graph) {
+        for (Partition p : partitions) {
+            if (p.assigned.isEmpty()) continue;
+            p.upstream = DepGraph.traverse(p.assigned, graph.upstreamOf);

Review Comment:
   This traversal includes every seed, so every assigned module is written to both the partition's upstream file and its affected file. The workflow consequently installs every affected module once with tests skipped and then installs it again with tests; the committed goldens confirm complete overlap (for example, all 452 default affected modules in scenario 03 also appear upstream). This substantially duplicates the expensive work this PR is intended to parallelize. Keep other-partition dependencies in the upstream set, but exclude this partition's own assigned modules; derive the image-producer prebuild list from the union before exclusion so affected image producers can still be built ahead of their consumers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5293473995

   GitHub Actions run `86233087403`, with `-T 1C` and `-Dquarkus.build.skip=true` added to the upstream Maven builds, completed successfully for all eight matrix jobs.
   
   | Job | Java 17 | Java 21 |
   |---|---:|---:|
   | Drools | 44m 01s | 41m 55s |
   | OptaPlanner | 15m 27s | 19m 06s |
   | Kogito runtimes | 1h 12m 45s | 1h 06m 30s |
   | Kogito apps | 1h 16m 13s | 1h 05m 33s |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794139729


##########
.github/workflows/ci.yaml:
##########
@@ -178,32 +152,90 @@ jobs:
       #   Affected pass  (-pl affected):             builds exactly the affected modules (changed +
       #                                              transitive downstream), running tests.
 
-      - name: "PR CHECK :: BUILD :: Upstream modules${{ github.event_name == 'push' && ' (skipped)' || '' }}"
-        if: github.event_name == 'pull_request'
+      - name: "PR CHECK :: BUILD :: Upstream modules"
         shell: bash
         run: |
+          [ ! -s "$MAVEN_PL_AFFECTED_DROOLS_FILE" ] && echo "No affected drools modules. Skipping upstream build." && exit 0
           pl=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE")
           [ -z "$pl" ] && echo "No upstream modules. Skipping." && exit 0
-          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+          mvn --batch-mode --no-transfer-progress -T 1C -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
 
-      - name: "PR CHECK :: BUILD :: Changed and affected modules${{ github.event_name == 'push' && ' (skipped)' || '' }}"
-        if: github.event_name == 'pull_request'
+      - name: "PR CHECK :: TEST :: drools"
         shell: bash
         run: |
-          pl=$(paste -sd, "$MAVEN_PL_AFFECTED_FILE")
-          [ -z "$pl" ] && echo "No affected modules. Skipping." && exit 0
+          pl=$(paste -sd, "$MAVEN_PL_AFFECTED_DROOLS_FILE")
+          [ -z "$pl" ] && echo "No affected drools modules. Skipping." && exit 0
           mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible -pl "$pl" install

Review Comment:
   I don't use `-T 2` for the test phase because it will raise many issues, and they will likely require a long time to fix (See https://github.com/apache/incubator-kie/pull/6864).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE][incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-6204955412

   After Tiago's review, I'll do one more round of code review and testing myself.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5289454216

   Confirmed sequential CI (original ci.yaml) and parallel CI have the same test coverage.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892414776


##########
.github/actions/ci-setup/action.yaml:
##########
@@ -0,0 +1,128 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: "CI Setup"
+description: "Shared CI setup: checkout, Java, JBang, Maven settings, build scope computation"
+
+inputs:
+  ref:
+    description: "Base ref for PR checkout"
+    required: true
+  java-version:
+    description: "Java version to set up"
+    required: true
+
+runs:
+  using: "composite"
+  steps:
+    - name: 'SETUP :: Free disk space (Ubuntu)'
+      if: runner.os == 'Linux'
+      shell: bash
+      run: |
+        sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
+        df -h
+
+    - name: 'SETUP :: Enable long file paths (Windows)'
+      if: runner.os == 'Windows'
+      shell: pwsh
+      run: |
+        git config --system core.longpaths true
+        reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+
+    - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
+      uses: ./.github/actions/checkout-pr
+      with:
+        ref: ${{ inputs.ref }}
+
+    - uses: actions/setup-java@v5
+      name: 'SETUP :: Java ${{ inputs.java-version }}'
+      with:
+        java-version: ${{ inputs.java-version }}
+        distribution: temurin
+        cache: maven
+
+    # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
+    # See https://github.com/apache/infrastructure-actions/pull/806
+    - name: 'SETUP :: Install JBang'
+      shell: bash
+      run: |
+        curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
+        echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
+        unzip -q jbang.zip
+        echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+
+    - name: 'SETUP :: Block apache.snapshots Maven repository'
+      shell: bash
+      run: |
+        mkdir -p "$HOME/.m2"
+        cat > "$HOME/.m2/settings.xml" <<'EOF'
+        <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
+                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
+          <mirrors>
+            <mirror>
+              <id>block-apache-snapshots</id>
+              <mirrorOf>apache.snapshots,apache-snapshot-repository</mirrorOf>
+              <url>https://repository.apache.org/snapshots/</url>
+              <blocked>true</blocked>
+            </mirror>
+          </mirrors>
+        </settings>
+        EOF
+
+    - name: 'SETUP :: Set paths for temporary files'
+      shell: bash
+      run: |
+        echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
+        echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_DROOLS_FILE=${{ runner.temp }}/maven-pl-affected-drools.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_OPTAPLANNER_FILE=${{ runner.temp }}/maven-pl-affected-optaplanner.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_KOGITO_RUNTIMES_FILE=${{ runner.temp }}/maven-pl-affected-kogito-runtimes.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_KOGITO_APPS_FILE=${{ runner.temp }}/maven-pl-affected-kogito-apps.txt" >> "$GITHUB_ENV"
+        touch "${{ runner.temp }}/changed-files.txt"
+        touch "${{ runner.temp }}/maven-pl-affected.txt"
+        touch "${{ runner.temp }}/maven-pl-upstream.txt"
+        touch "${{ runner.temp }}/maven-pl-changed.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-drools.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-optaplanner.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-kogito-runtimes.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-kogito-apps.txt"

Review Comment:
   Thanks. Applied the partition approach.
   Filenames are `partition0.txt`, `partition1.txt`... for easier processing. We can add a comment line like `# optaplanner` for explanation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "Rikkola (via GitHub)" <gi...@apache.org>.
Rikkola commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5313986503

   Looks like this is also making the scripts a bit easier to read, but is there an easy way to run this locally? First to test this, but also to run my own nighties on my WIP topic branches.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3806347501


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static final List<String> EXPECTED_CATEGORIES = List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+    static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path cwd) throws IOException {
+        Map<String, Set<Path>> categories = new LinkedHashMap<>();
+        categories.put("drools", new LinkedHashSet<>());
+        for (String cat : EXPECTED_CATEGORIES) {
+            categories.put(cat, new LinkedHashSet<>());
+        }
+
+        String currentCategory = "drools";
+        boolean inModules = false;
+        Set<String> seenBegins = new HashSet<>();
+        Set<String> seenEnds = new HashSet<>();
+
+        Pattern beginPattern = Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern endPattern = Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern modulePattern = Pattern.compile("<module>(.+)</module>");

Review Comment:
   I'm a concerned with this parsing strategy. As it relies on comments being maintained in the top-level pom.xml file. This simply mimics the old structure we had with the repos, and doesn't to separate things logically per domain. I don't think we should carry forward the old, artificial grouping we had. 
   
   Can we try to make this partitioned by domain? We can have even more partitions, like Kogito Data-Index, Kogito Jobs Service, for example.
   
   In `kie-tools`, when we needed to do a similar partitioning effort in order to keep PR checks build times in check, what I did was I created partitioning files which listed the leaf modules which represented good vertical partitions of the dependency DAG.
   
   We don't have this anymore since the 10.3.x+ stream effort began, but you can see how it used to look like in 10.2.
   
   https://github.com/apache/incubator-kie-tools/tree/10.2.0/.github/supporting-files/ci/partitions
   
   Note that there are 2 partition files only, with an implicit 3rd partition which contained all the modules that were not listed explicitly in neither of those 2 partition files.



##########
.github/actions/ci-setup/action.yaml:
##########
@@ -0,0 +1,128 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: "CI Setup"
+description: "Shared CI setup: checkout, Java, JBang, Maven settings, build scope computation"
+
+inputs:
+  ref:
+    description: "Base ref for PR checkout"
+    required: true
+  java-version:
+    description: "Java version to set up"
+    required: true
+
+runs:
+  using: "composite"
+  steps:
+    - name: 'SETUP :: Free disk space (Ubuntu)'
+      if: runner.os == 'Linux'
+      shell: bash
+      run: |
+        sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
+        df -h
+
+    - name: 'SETUP :: Enable long file paths (Windows)'
+      if: runner.os == 'Windows'
+      shell: pwsh
+      run: |
+        git config --system core.longpaths true
+        reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+
+    - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
+      uses: ./.github/actions/checkout-pr
+      with:
+        ref: ${{ inputs.ref }}
+
+    - uses: actions/setup-java@v5
+      name: 'SETUP :: Java ${{ inputs.java-version }}'
+      with:
+        java-version: ${{ inputs.java-version }}
+        distribution: temurin
+        cache: maven
+
+    # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
+    # See https://github.com/apache/infrastructure-actions/pull/806
+    - name: 'SETUP :: Install JBang'
+      shell: bash
+      run: |
+        curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
+        echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
+        unzip -q jbang.zip
+        echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+
+    - name: 'SETUP :: Block apache.snapshots Maven repository'
+      shell: bash
+      run: |
+        mkdir -p "$HOME/.m2"
+        cat > "$HOME/.m2/settings.xml" <<'EOF'
+        <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
+                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
+          <mirrors>
+            <mirror>
+              <id>block-apache-snapshots</id>
+              <mirrorOf>apache.snapshots,apache-snapshot-repository</mirrorOf>
+              <url>https://repository.apache.org/snapshots/</url>
+              <blocked>true</blocked>
+            </mirror>
+          </mirrors>
+        </settings>
+        EOF
+
+    - name: 'SETUP :: Set paths for temporary files'
+      shell: bash
+      run: |
+        echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
+        echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_DROOLS_FILE=${{ runner.temp }}/maven-pl-affected-drools.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_OPTAPLANNER_FILE=${{ runner.temp }}/maven-pl-affected-optaplanner.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_KOGITO_RUNTIMES_FILE=${{ runner.temp }}/maven-pl-affected-kogito-runtimes.txt" >> "$GITHUB_ENV"
+        echo "MAVEN_PL_AFFECTED_KOGITO_APPS_FILE=${{ runner.temp }}/maven-pl-affected-kogito-apps.txt" >> "$GITHUB_ENV"
+        touch "${{ runner.temp }}/changed-files.txt"
+        touch "${{ runner.temp }}/maven-pl-affected.txt"
+        touch "${{ runner.temp }}/maven-pl-upstream.txt"
+        touch "${{ runner.temp }}/maven-pl-changed.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-drools.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-optaplanner.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-kogito-runtimes.txt"
+        touch "${{ runner.temp }}/maven-pl-affected-kogito-apps.txt"

Review Comment:
   Declaring 4 fixes partitions I believe will limit the flexibility of the whole mechanism, and further constrain us into fitting new modules into these 4 boxes. Can we try to make partitions more fluid? Adding/removing a new partition should be easy enough. We can use file names to name them, and list the leaf modules which belong in each partition inside the files. E.g.,
   
   ```
   drools.txt
   optaplanner.txt
   kogito-runtimes.txt
   kogito-data-index.txt
   kogito-jobs-service.txt
   ```
   
   and so on. 



##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->
+    <!-- BEGIN drools modules (auto) -->

Review Comment:
   I see you're putting some guardrails in place, but I think we can do better. The "partitions" files listing leaf modules which bring a larger dependency hierarchy with them will give us a lot more flexibility, and will allow us to not couple the pom.xml with a partitioning solution for PR checks and CI.



##########
.github/workflows/ci.yaml:
##########
@@ -216,14 +248,145 @@ jobs:
         uses: actions/upload-artifact@v7
         if: ${{ always() }}
         with:
-          name: build-logs_${{ matrix.os }}_java-${{ matrix.java }}
+          name: build-logs_optaplanner_${{ matrix.os }}_java-${{ matrix.java }}
           path: '**/build.log'
 
       - name: Upload Build Compare
         uses: actions/upload-artifact@v7
         if: ${{ always() }}
         with:
-          name: build-compare_${{ matrix.os }}_java-${{ matrix.java }}
+          name: build-compare_optaplanner_${{ matrix.os }}_java-${{ matrix.java }}
+          path: |
+            **/*.buildcompare
+            **/*.buildinfo
+
+  test-kogito-runtimes:
+    if: github.event.action != 'closed' && github.event_name == 'pull_request'
+    name: 'kogito-runtimes :: ${{ matrix.os }}, Java ${{ matrix.java }}'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os:   [ubuntu-latest]
+        java: [17, 21]
+    steps:
+      - name: "SETUP :: Checkout to load local actions"
+        uses: actions/checkout@v7
+
+      - uses: ./.github/actions/ci-setup
+        with:
+          ref: ${{ github.base_ref }}
+          java-version: ${{ matrix.java }}
+
+      - name: "PR CHECK :: BUILD :: Upstream + drools + optaplanner modules (tests skipped)"
+        shell: bash
+        run: |
+          [ ! -s "$MAVEN_PL_AFFECTED_KOGITO_RUNTIMES_FILE" ] && echo "No affected kogito-runtimes modules. Skipping upstream build." && exit 0
+          upstream=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE")
+          drools=$(paste -sd, "$MAVEN_PL_AFFECTED_DROOLS_FILE")
+          optaplanner=$(paste -sd, "$MAVEN_PL_AFFECTED_OPTAPLANNER_FILE")
+          pl=$(echo "$upstream,$drools,$optaplanner" | sed 's/^,//;s/,,*/,/g;s/,$//')
+          [ -z "$pl" ] && echo "No modules to build. Skipping." && exit 0
+          mvn --batch-mode --no-transfer-progress -T 1C -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install

Review Comment:
   Commenting on this one, but it applies to each of the fixed 4 partitions. There's a lot of duplication here. If we make partitions dynamic (and thus more flexible), we remove the duplication and keep things simpler to change as we evolve our codebase. We really need a CI system that's not rigid for us to have room to grow / adapt.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5476276484

   Thanks. I'm still working out the details. I'll post an update with a summary of the new changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892388081


##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794188282


##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->
+    <!-- BEGIN drools modules (auto) -->

Review Comment:
   `CiComputeBuildScopes` depends on these `BIGIN` `END` markers for 4 categories split. It's a little fragile, but `CiComputeBuildScopes` makes sure to exit(1) with an error, so we will be able to detect.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5314247421

   @Rikkola 
   > is there an easy way to run this locally?
   
   I haven't tried, but this seems to be for the purpose > https://github.com/nektos/act 
   
   Btw, sometimes I use my fork repo to run GHA jobs (e.g., https://github.com/tkobayas/drools/pull/17) So it doesn't consume my local PC resource :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5863274223

   Hi @tiagobento 
   
   > Let me spend a few hours digesting the code changes, so that I can do a more in-depth code review.
   
   Have you had a chance to review the code? Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892384684


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static final List<String> EXPECTED_CATEGORIES = List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+    static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path cwd) throws IOException {
+        Map<String, Set<Path>> categories = new LinkedHashMap<>();
+        categories.put("drools", new LinkedHashSet<>());
+        for (String cat : EXPECTED_CATEGORIES) {
+            categories.put(cat, new LinkedHashSet<>());
+        }
+
+        String currentCategory = "drools";
+        boolean inModules = false;
+        Set<String> seenBegins = new HashSet<>();
+        Set<String> seenEnds = new HashSet<>();
+
+        Pattern beginPattern = Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern endPattern = Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern modulePattern = Pattern.compile("<module>(.+)</module>");
+
+        for (String line : Files.readAllLines(rootPom)) {
+            String trimmed = line.trim();
+
+            if (trimmed.equals("<modules>")) {
+                inModules = true;
+                continue;
+            }
+            if (trimmed.equals("</modules>")) {
+                break;
+            }
+            if (!inModules) continue;
+
+            Matcher beginMatcher = beginPattern.matcher(trimmed);
+            if (beginMatcher.matches()) {
+                currentCategory = beginMatcher.group(1);
+                if (!categories.containsKey(currentCategory)) {
+                    System.err.println("ERROR: unknown module category '" + currentCategory
+                            + "' in pom.xml marker. Expected one of: " + EXPECTED_CATEGORIES);

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5450109684

   # Parallel CI Test Run: Computed Image-Producer Rebuild
   
   Run `89788266903` — all jobs completed successfully.
   
   ## Job elapsed time
   
   | Job | Java 17 ||| Java 21 |||
   |---|---:|---:|---:|---:|---:|---:|
   | | upstream | test | **total** | upstream | test | **total** |
   | compute-partitions | — | — | **3m 06s** | — | — | — |
   | partition0 (optaplanner) | 1m 52s | 9m 42s | **14m 18s** | 1m 50s | 9m 13s | **13m 36s** |
   | partition1 (kogito-runtimes) | 5m 09s | 42m 09s | **51m 56s** | 6m 21s | 49m 36s | **58m 50s** |
   | partition2 (kogito-apps) | 8m 23s | 1h 03m | **1h 14m 30s** | 7m 04s | 1h 18m | **1h 29m 02s** |
   | default (drools + shared) | 5m 29s | 52m 50s | **1h 00m 33s** | 5m 35s | 54m 54s | **1h 02m 50s** |
   
   The partition2 upstream figures include both upstream phases:
   
   - Java 17: parallel upstream 6m 36s + required image-producing modules 1m 47s = 8m 23s
   - Java 21: parallel upstream 5m 33s + required image-producing modules 1m 31s = 7m 04s
   
   The workflow wall-clock time, measured from the start of `compute-partitions` to the end of the slowest matrix job, was approximately **1h 32m 16s**. The matrix jobs started approximately five seconds after `compute-partitions` finished.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "yesamer (via GitHub)" <gi...@apache.org>.
yesamer commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5450148997

   @tkobayas Very nice work!! It's curious that JDK21 is slower than JDK17 :o


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5349393687

   @tkobayas 34% is a HUGE gain! That combined with the parallelization this PR brings will put our PR checks into another level of speed. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794130339


##########
.github/workflows/ci.yaml:
##########
@@ -178,32 +152,90 @@ jobs:
       #   Affected pass  (-pl affected):             builds exactly the affected modules (changed +
       #                                              transitive downstream), running tests.
 
-      - name: "PR CHECK :: BUILD :: Upstream modules${{ github.event_name == 'push' && ' (skipped)' || '' }}"
-        if: github.event_name == 'pull_request'
+      - name: "PR CHECK :: BUILD :: Upstream modules"
         shell: bash
         run: |
+          [ ! -s "$MAVEN_PL_AFFECTED_DROOLS_FILE" ] && echo "No affected drools modules. Skipping upstream build." && exit 0
           pl=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE")
           [ -z "$pl" ] && echo "No upstream modules. Skipping." && exit 0
-          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+          mvn --batch-mode --no-transfer-progress -T 1C -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install

Review Comment:
   I added `-Dquarkus.build.skip=true` to solve the quarkus build ordering issue with `-T 1C`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5312113690

   # Split PR CI into 4 parallel test jobs
   
   ## Problem
   
   The monorepo PR build ran all ~850 modules sequentially in a single job, taking ~2-3h.
   
   ## Solution
   
   Split the PR test step into 4 concurrent jobs by project category: **drools**, **optaplanner**, **kogito-runtimes**, **kogito-apps**. Wall-clock time drops to ~1h15m (limited by the longest job, kogito-apps).
   
   ## Key changes
   
   **`script/ci/CiComputeBuildScopes.java`** -- Added `parseModuleCategories()` which reads `<!-- BEGIN/END xxx modules (auto) -->` markers in the root `pom.xml` to categorize modules. Writes per-category `affected-*.txt` files (e.g., `affected-drools.txt`, `affected-kogito-runtimes.txt`) alongside the existing combined output.
   
   **`pom.xml`** -- Added `<!-- BEGIN/END drools/optaplanner/kogito-runtimes/kogito-apps modules (auto) -->` markers in the `<modules>` section.
   
   **`.github/actions/ci-setup/action.yaml`** -- New composite action extracting shared CI setup: free disk space, checkout-pr, Java, JBang, Maven settings, changed-file collection, and build scope computation.
   
   **`.github/workflows/ci.yaml`** -- Push-to-main remains a single full-build job. PRs fan out to 4 parallel test jobs. Each job:
   1. Checks if its category has affected modules -- if not, skips entirely
   2. Installs upstream dependencies without tests (`-T 1C -Dquarkus.build.skip=true` for speed)
   3. Runs tests only for its own category's affected modules
   
   **`.rat-excludes`** -- Replaced 48 individual golden file entries with a single glob `script/ci/tests/scenarios-compute-build-scopes/**`.
   
   **Golden files** -- 48 new per-category expected files added across 12 test scenarios. Existing golden files updated for new modules on main.
   
   ## Cross-category dependency handling
   
   Each test job installs all upstream categories' affected modules (without tests) before running its own:
   
   | Job | Upstream install (no tests) |
   |---|---|
   | test-drools | upstream only |
   | test-optaplanner | upstream + affected-drools |
   | test-kogito-runtimes | upstream + affected-drools + affected-optaplanner |
   | test-kogito-apps | upstream + affected-drools + affected-optaplanner + affected-kogito-runtimes |
   
   ## Build time comparison
   
   Sequential CI (run `85920644738`):
   
   | Job | Duration |
   |---|---:|
   | Java 17 | 3h 05m 04s |
   | Java 21 | 2h 14m 10s |
   
   Parallel CI with `-T 1C` (run `86233087403`):
   
   | Job | Java 17 | Java 21 |
   |---|---:|---:|
   | Drools | 44m 01s | 41m 55s |
   | OptaPlanner | 15m 27s | 19m 06s |
   | Kogito runtimes | 1h 12m 45s | 1h 06m 30s |
   | Kogito apps | 1h 16m 13s | 1h 05m 33s |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794188282


##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->
+    <!-- BEGIN drools modules (auto) -->

Review Comment:
   `CiComputeBuildScopes` depends on these `BEGIN` `END` markers for 4 categories split. It's a little fragile, but when broken, `CiComputeBuildScopes` makes sure to exit(1) with an error, so we will be able to detect.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892372068


##########
.github/workflows/ci.yaml:
##########
@@ -61,110 +63,82 @@ jobs:
             java: 17
           - os: macos-latest
             java: 21
-
     steps:
-      - name: 'SETUP :: Set paths for temporary files'
-        shell: bash
-        run: |
-          echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
-          echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
-          touch "${{ runner.temp }}/changed-files.txt"
-          touch "${{ runner.temp }}/maven-pl-affected.txt"
-          touch "${{ runner.temp }}/maven-pl-upstream.txt"
-          touch "${{ runner.temp }}/maven-pl-changed.txt"
-
-      - name: 'SETUP :: Free disk space (Ubuntu)'
-        if: runner.os == 'Linux'
-        shell: bash
-        run: |
-          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
-          df -h
-
-      - name: 'SETUP :: Enable long file paths (Windows)'
-        if: runner.os == 'Windows'
-        shell: pwsh
-        run: |
-          git config --system core.longpaths true
-          reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
-
       - name: "SETUP :: Checkout to load local actions"
         uses: actions/checkout@v7
 
-      - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
-        id: checkout_pr
-        uses: ./.github/actions/checkout-pr
-        with:
-          ref: ${{ github.base_ref }}
-
-      - uses: actions/setup-java@v5
-        name: 'SETUP :: Java ${{ matrix.java }}'
+      - uses: ./.github/actions/ci-setup
         with:
+          ref: ${{ github.ref }}
           java-version: ${{ matrix.java }}
-          distribution: temurin
-          cache: maven
 
-      # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
-      # See https://github.com/apache/infrastructure-actions/pull/806
-      - name: 'SETUP :: Install JBang'
+      - name: "CI :: BUILD :: Full"
         shell: bash
-        run: |
-          curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
-          echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
-          unzip -q jbang.zip
-          echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+        run: mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible install
 
-      - name: 'SETUP :: Block apache.snapshots Maven repository'
-        shell: bash
-        run: |
-          mkdir -p "$HOME/.m2"
-          cat > "$HOME/.m2/settings.xml" <<'EOF'
-          <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
-                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
-            <mirrors>
-              <mirror>
-                <id>block-apache-snapshots</id>
-                <mirrorOf>apache.snapshots,apache-snapshot-repository</mirrorOf>
-                <url>https://repository.apache.org/snapshots/</url>
-                <blocked>true</blocked>
-              </mirror>
-            </mirrors>
-          </settings>
-          EOF
-
-      # Three-dot diff (A...B = diff B against the merge-base of A and B)
-      # gives exactly the files changed in this PR branch.
-      - name: 'SETUP :: Collect changed files'
-        if: github.event_name == 'pull_request'
+      - name: 'SUMMARY :: Publish'
+        if: always()
         shell: bash
         env:
-          BASE_REF: origin/${{ github.base_ref }}
+          MERMAID_EXPANDED: ${{ matrix.os == 'ubuntu-latest' && matrix.java == 21 }}
+          MATRIX_OS: ${{ matrix.os }}
+          MATRIX_JAVA: ${{ matrix.java }}
         run: |
-          git diff --name-only "${BASE_REF}...HEAD" > "$CHANGED_FILES_FILE"
-          echo "Changed files:"
-          cat "$CHANGED_FILES_FILE"
+          MAVEN_PL_AFFECTED=$(paste -sd, "$MAVEN_PL_AFFECTED_FILE" 2>/dev/null || true) \
+          MAVEN_PL_UPSTREAM=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE" 2>/dev/null || true) \
+          MAVEN_PL_CHANGED=$(paste -sd, "$MAVEN_PL_CHANGED_FILE" 2>/dev/null || true) \
+          jbang script/ci/CiSummary.java
 
-      - name: 'SETUP :: Compute build scopes'
-        if: github.event_name == 'pull_request'
-        shell: bash
-        run: |
-          jbang script/ci/CiComputeBuildScopes.java \
-            "$CHANGED_FILES_FILE" \
-            "$MAVEN_PL_UPSTREAM_FILE" \
-            "$MAVEN_PL_AFFECTED_FILE" \
-            "$MAVEN_PL_CHANGED_FILE"
+      - name: Upload Build logs
+        uses: actions/upload-artifact@v7
+        if: ${{ always() }}
+        with:
+          name: build-logs_${{ matrix.os }}_java-${{ matrix.java }}
+          path: '**/build.log'
+
+      - name: Upload Build Compare
+        uses: actions/upload-artifact@v7
+        if: ${{ always() }}
+        with:
+          name: build-compare_${{ matrix.os }}_java-${{ matrix.java }}
+          path: |
+            **/*.buildcompare
+            **/*.buildinfo
+
+  # PR builds split affected modules into 4 parallel test jobs by category:
+  #   test-drools, test-optaplanner, test-kogito-runtimes, test-kogito-apps
+  # Categories are derived from <!-- BEGIN/END xxx modules (auto) --> markers in
+  # the root pom.xml (see CiComputeBuildScopes.parseModuleCategories).
+  # Each job installs its upstream dependencies without tests, then runs tests
+  # for its own category only. Jobs with no affected modules skip entirely.
+
+  test-drools:
+    if: github.event.action != 'closed' && github.event_name == 'pull_request'
+    name: 'drools :: ${{ matrix.os }}, Java ${{ matrix.java }}'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os:   [ubuntu-latest]
+        java: [17, 21]

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892483521


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -166,13 +167,30 @@ public static void main(String[] args) throws Exception {
         writeLines(affectedOut, affected);
         writeLines(changedOut, changed);
 
+        Map<String, Set<Path>> categories = parseModuleCategories(cwd.resolve("pom.xml"), cwd);
+
+        for (String cat : categories.keySet()) {
+            Set<String> catAffected = affected.stream()
+                    .filter(ga -> categorizeGa(ga, gaToDir, categories).equals(cat))
+                    .collect(Collectors.toCollection(LinkedHashSet::new));
+            writeLines(partitionedPath(affectedOut, cat), catAffected);
+        }

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5457539210

   @tkobayas I wonder if those partitions are the most optimal. It seems we have a big opportunity to break down `kogito-apps` and the `default` partition as well. 
   
   One thing that crossed my mind too: Are we sure that the sum of these partitions result in all the modules being built? In KIE Tools we added a guard clause for it that helped be confident that no module was being forgotten by bugs or misconfiguration.
   
   If we can extract the time each test takes from the logs, we can heuristically determine what's the best partition allocation by number of partitions and members of each partition.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892396882


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -202,6 +220,102 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static final List<String> EXPECTED_CATEGORIES = List.of("optaplanner", "kogito-runtimes", "kogito-apps");
+
+    static Map<String, Set<Path>> parseModuleCategories(Path rootPom, Path cwd) throws IOException {
+        Map<String, Set<Path>> categories = new LinkedHashMap<>();
+        categories.put("drools", new LinkedHashSet<>());
+        for (String cat : EXPECTED_CATEGORIES) {
+            categories.put(cat, new LinkedHashSet<>());
+        }
+
+        String currentCategory = "drools";
+        boolean inModules = false;
+        Set<String> seenBegins = new HashSet<>();
+        Set<String> seenEnds = new HashSet<>();
+
+        Pattern beginPattern = Pattern.compile("<!--\\s*BEGIN\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern endPattern = Pattern.compile("<!--\\s*END\\s+(\\S+)\\s+modules\\s+\\(auto\\)\\s*-->");
+        Pattern modulePattern = Pattern.compile("<module>(.+)</module>");

Review Comment:
   Thanks. Applied the partition approach.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892375504


##########
.github/workflows/ci.yaml:
##########
@@ -178,32 +152,90 @@ jobs:
       #   Affected pass  (-pl affected):             builds exactly the affected modules (changed +
       #                                              transitive downstream), running tests.
 
-      - name: "PR CHECK :: BUILD :: Upstream modules${{ github.event_name == 'push' && ' (skipped)' || '' }}"
-        if: github.event_name == 'pull_request'
+      - name: "PR CHECK :: BUILD :: Upstream modules"
         shell: bash
         run: |
+          [ ! -s "$MAVEN_PL_AFFECTED_DROOLS_FILE" ] && echo "No affected drools modules. Skipping upstream build." && exit 0
           pl=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE")
           [ -z "$pl" ] && echo "No upstream modules. Skipping." && exit 0
-          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+          mvn --batch-mode --no-transfer-progress -T 1C -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
 
-      - name: "PR CHECK :: BUILD :: Changed and affected modules${{ github.event_name == 'push' && ' (skipped)' || '' }}"
-        if: github.event_name == 'pull_request'
+      - name: "PR CHECK :: TEST :: drools"
         shell: bash
         run: |
-          pl=$(paste -sd, "$MAVEN_PL_AFFECTED_FILE")
-          [ -z "$pl" ] && echo "No affected modules. Skipping." && exit 0
+          pl=$(paste -sd, "$MAVEN_PL_AFFECTED_DROOLS_FILE")
+          [ -z "$pl" ] && echo "No affected drools modules. Skipping." && exit 0
           mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible -pl "$pl" install

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3893084975


##########
script/ci/CiComputeBuildScopes.java:
##########
@@ -241,6 +277,104 @@ private static void writeLines(Path out, Collection<String> lines) throws IOExce
         Files.write(out, sorted);
     }
 
+    private static Set<String> imageProducersIn(Set<String> modules, Set<String> imageProducers) {
+        Set<String> result = new LinkedHashSet<>(modules);
+        result.retainAll(imageProducers);
+        return result;
+    }
+
+    static class Partition {
+        final String name;
+        final Set<String> entries;
+        Set<String> closure = Set.of();
+        Set<String> assigned = new LinkedHashSet<>();
+        Set<String> upstream = new LinkedHashSet<>();
+        Partition(String name, Set<String> entries) {
+            this.name = name;
+            this.entries = entries;
+        }
+    }
+
+    static List<Partition> readPartitionFiles(Path partitionsDir, Map<Path, String> dirToGa, Path cwd) throws IOException {
+        List<Path> files;
+        try (Stream<Path> s = Files.list(partitionsDir)) {
+            files = s.filter(f -> f.getFileName().toString().startsWith("partition") && f.getFileName().toString().endsWith(".txt"))
+                     .sorted()
+                     .collect(Collectors.toList());
+        }
+        List<Partition> result = new ArrayList<>();
+        for (Path file : files) {
+            String partName = file.getFileName().toString().replaceFirst("\\.txt$", "");
+            result.add(new Partition(partName, readModuleFile(file, dirToGa, cwd, partName)));
+        }
+        return result;
+    }
+
+    static Set<String> readModuleFile(Path file, Map<Path, String> dirToGa, Path cwd, String listName) throws IOException {
+        Set<String> modules = new LinkedHashSet<>();
+        for (String line : Files.readAllLines(file)) {
+            String trimmed = line.trim();
+            if (trimmed.isEmpty() || trimmed.startsWith("#")) continue;
+            Path modDir = cwd.resolve(trimmed).toAbsolutePath().normalize();
+            String ga = dirToGa.get(modDir);
+            if (ga == null) {
+                System.err.println("ERROR: " + listName + ": '" + trimmed + "' does not resolve to a reactor module");
+                System.exit(1);
+            }
+            modules.add(ga);
+        }
+        return modules;
+    }
+
+    private static void computePartitionClosures(List<Partition> partitions, DepGraph graph) {
+        for (Partition p : partitions) {
+            p.closure = DepGraph.traverse(p.entries, graph.upstreamOf);
+        }
+    }
+
+    private static void assignToPartitionsExclusive(Set<String> affected, List<Partition> partitions,
+                                                      Partition defaultPartition) {
+        List<Partition> explicit = partitions.stream()
+                .filter(p -> p != defaultPartition)
+                .collect(Collectors.toList());
+        for (String ga : affected) {
+            Partition sole = null;
+            int count = 0;
+            for (Partition p : explicit) {
+                if (p.closure.contains(ga)) {
+                    sole = p;
+                    count++;
+                    if (count > 1) break;
+                }
+            }
+            if (count == 1) {
+                sole.assigned.add(ga);
+            } else {
+                defaultPartition.assigned.add(ga);
+            }
+        }
+    }
+
+    // The upstream set intentionally includes the partition's own affected modules.
+    // Without them, an upstream module from another partition could fail to resolve
+    // dependencies on this partition's affected modules (e.g., shared module U depends
+    // on affected module V — if V is removed from upstream, building U fails).
+    private static void computePerPartitionUpstream(List<Partition> partitions, DepGraph graph) {
+        for (Partition p : partitions) {
+            if (p.assigned.isEmpty()) continue;
+            p.upstream = DepGraph.traverse(p.assigned, graph.upstreamOf);

Review Comment:
   The overlap is intentional: phase 1 compiles affected modules in parallel with tests and Quarkus skipped, so the serial test pass largely reuses those outputs. Removing them would shift compilation into the slower serial pass and could also break upstream or image-producer builds whose snapshot dependencies are assigned to the same partition. Since phase 1 takes only 2–7 minutes versus 9–79 minutes for testing, the duplicated overhead is small.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794126706


##########
.github/workflows/ci.yaml:
##########
@@ -61,110 +63,82 @@ jobs:
             java: 17
           - os: macos-latest
             java: 21
-
     steps:
-      - name: 'SETUP :: Set paths for temporary files'
-        shell: bash
-        run: |
-          echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
-          echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
-          touch "${{ runner.temp }}/changed-files.txt"
-          touch "${{ runner.temp }}/maven-pl-affected.txt"
-          touch "${{ runner.temp }}/maven-pl-upstream.txt"
-          touch "${{ runner.temp }}/maven-pl-changed.txt"
-
-      - name: 'SETUP :: Free disk space (Ubuntu)'
-        if: runner.os == 'Linux'
-        shell: bash
-        run: |
-          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
-          df -h
-
-      - name: 'SETUP :: Enable long file paths (Windows)'
-        if: runner.os == 'Windows'
-        shell: pwsh
-        run: |
-          git config --system core.longpaths true
-          reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
-
       - name: "SETUP :: Checkout to load local actions"
         uses: actions/checkout@v7
 
-      - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
-        id: checkout_pr
-        uses: ./.github/actions/checkout-pr
-        with:
-          ref: ${{ github.base_ref }}
-
-      - uses: actions/setup-java@v5
-        name: 'SETUP :: Java ${{ matrix.java }}'
+      - uses: ./.github/actions/ci-setup
         with:
+          ref: ${{ github.ref }}
           java-version: ${{ matrix.java }}
-          distribution: temurin
-          cache: maven
 
-      # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
-      # See https://github.com/apache/infrastructure-actions/pull/806
-      - name: 'SETUP :: Install JBang'
+      - name: "CI :: BUILD :: Full"
         shell: bash
-        run: |
-          curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
-          echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
-          unzip -q jbang.zip
-          echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+        run: mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible install
 
-      - name: 'SETUP :: Block apache.snapshots Maven repository'
-        shell: bash
-        run: |
-          mkdir -p "$HOME/.m2"
-          cat > "$HOME/.m2/settings.xml" <<'EOF'
-          <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
-                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
-            <mirrors>
-              <mirror>
-                <id>block-apache-snapshots</id>
-                <mirrorOf>apache.snapshots,apache-snapshot-repository</mirrorOf>
-                <url>https://repository.apache.org/snapshots/</url>
-                <blocked>true</blocked>
-              </mirror>
-            </mirrors>
-          </settings>
-          EOF
-
-      # Three-dot diff (A...B = diff B against the merge-base of A and B)
-      # gives exactly the files changed in this PR branch.
-      - name: 'SETUP :: Collect changed files'
-        if: github.event_name == 'pull_request'
+      - name: 'SUMMARY :: Publish'
+        if: always()
         shell: bash
         env:
-          BASE_REF: origin/${{ github.base_ref }}
+          MERMAID_EXPANDED: ${{ matrix.os == 'ubuntu-latest' && matrix.java == 21 }}
+          MATRIX_OS: ${{ matrix.os }}
+          MATRIX_JAVA: ${{ matrix.java }}
         run: |
-          git diff --name-only "${BASE_REF}...HEAD" > "$CHANGED_FILES_FILE"
-          echo "Changed files:"
-          cat "$CHANGED_FILES_FILE"
+          MAVEN_PL_AFFECTED=$(paste -sd, "$MAVEN_PL_AFFECTED_FILE" 2>/dev/null || true) \
+          MAVEN_PL_UPSTREAM=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE" 2>/dev/null || true) \
+          MAVEN_PL_CHANGED=$(paste -sd, "$MAVEN_PL_CHANGED_FILE" 2>/dev/null || true) \
+          jbang script/ci/CiSummary.java
 
-      - name: 'SETUP :: Compute build scopes'
-        if: github.event_name == 'pull_request'
-        shell: bash
-        run: |
-          jbang script/ci/CiComputeBuildScopes.java \
-            "$CHANGED_FILES_FILE" \
-            "$MAVEN_PL_UPSTREAM_FILE" \
-            "$MAVEN_PL_AFFECTED_FILE" \
-            "$MAVEN_PL_CHANGED_FILE"
+      - name: Upload Build logs
+        uses: actions/upload-artifact@v7
+        if: ${{ always() }}
+        with:
+          name: build-logs_${{ matrix.os }}_java-${{ matrix.java }}
+          path: '**/build.log'
+
+      - name: Upload Build Compare
+        uses: actions/upload-artifact@v7
+        if: ${{ always() }}
+        with:
+          name: build-compare_${{ matrix.os }}_java-${{ matrix.java }}
+          path: |
+            **/*.buildcompare
+            **/*.buildinfo
+
+  # PR builds split affected modules into 4 parallel test jobs by category:
+  #   test-drools, test-optaplanner, test-kogito-runtimes, test-kogito-apps
+  # Categories are derived from <!-- BEGIN/END xxx modules (auto) --> markers in
+  # the root pom.xml (see CiComputeBuildScopes.parseModuleCategories).
+  # Each job installs its upstream dependencies without tests, then runs tests
+  # for its own category only. Jobs with no affected modules skip entirely.
+
+  test-drools:
+    if: github.event.action != 'closed' && github.event_name == 'pull_request'
+    name: 'drools :: ${{ matrix.os }}, Java ${{ matrix.java }}'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os:   [ubuntu-latest]
+        java: [17, 21]

Review Comment:
   In each parallel job, I don't use `exclude`, but exact `ubuntu-latest` and java `17` `21` for conciseness. This should be enhanced when we accept mac and windows.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5313018007

   @tiagobento  @yesamer @Rikkola @athirakm94 @kbowers-ibm 
   
   Hi, this PR splits the PR check CI into four parallel jobs to reduce the overall CI time.
   
   Please have a look at the above summary.
   
   The Build time comparison is the "big impact" case where almost all modules are built (e.g., root pom.xml change, drools-core change, etc.). But other use cases like only kogito-runtimes change would also benefit from the parallel CI.
   
   The CI logic (`CiComputeBuildScopes`, `ci.yaml`) gets a little more complicated, but I think the gain is larger
   
   Please review, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5489621533

   Hi @tiagobento 
   
   > I wonder if those partitions are the most optimal. It seems we have a big opportunity to break down kogito-apps and the default partition as well.
   
   The partition files are just a starting point. Certainly, we can break down kogito-apps and the default partition further, and that flexibility is one of the advantages of the partition approach. However, the current partitions look reasonably balanced (three of them take around one hour). So, could we do further tuning in a separate PR?
   
   > One thing that crossed my mind too: Are we sure that the sum of these partitions result in all the modules being built? In KIE Tools we added a guard clause for it that helped be confident that no module was being forgotten by bugs or misconfiguration.
   
   Thanks, I added the check following the kie-tools approach.
   
   > If we can extract the time each test takes from the logs, we can heuristically determine what's the best partition allocation by number of partitions and members of each partition.
   
   Yes, we can, and I think it would be an interesting exercise. Could we do that in a separate PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3893417721


##########
.github/workflows/ci-parallel.yaml:
##########
@@ -0,0 +1,178 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: 'CI :: Build - Parallel'
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened, closed, labeled]

Review Comment:
   Rather I'm removing `labeled` from `types`, so `labeled`/`unlabeled` doesn't trigger CI. Just to decide sequential or parallel. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5489141998

   ## PR update: Partition files approach
   
   Thanks for the review @tiagobento. I've reworked the PR based on your feedback. Here's a summary of the changes.
   
   ### Label-based switching
   
   The parallel CI workflow (`ci-parallel.yaml`) is activated by attaching the **`parallel ci`** label to a PR. Without the label, the original sequential `ci.yaml` runs as before. This lets us opt in per-PR and makes it easy to revert if Apache Infra raises concerns about GHA runner quota — each partition job rebuilds upstream modules independently, so total runner-minutes increase even though wall-clock time decreases.
   
   Keeping both `ci.yaml` and `ci-parallel.yaml` would be a maintenance burden. We may finally combine them, but keep them separated for a while as `ci.yaml` is the stable CI and `ci-parallel.yaml` is the opt-in experimental CI. WDYT?
   
   ### Partition files
   
   Replaced the pom.xml `BEGIN/END` markers with partition files in `.github/supporting-files/ci/partitions/`:
   
   - `partition0.txt` — optaplanner (14 leaf modules)
   - `partition1.txt` — kogito-runtimes (87 leaf modules)
   - `partition2.txt` — kogito-apps (39 leaf modules)
   - Implicit default — drools + shared modules (no file needed)
   
   Adding or removing a partition is just adding or removing a file. The GHA workflow uses a dynamic matrix (`compute-partitions` job discovers partition files and outputs a JSON array, `test` job uses `partition × java × os` cross-product), so no YAML changes are needed.
   
   **Exclusive assignment**: each affected module goes to a partition only if it's in exactly one partition's transitive closure. Shared modules (like `kie-api`, `kogito-api`) go to the implicit default. This avoids redundant tests — each module is tested in exactly one job.
   
   The current 4 partitions are just a starting point. We can split further (e.g., `kogito-data-index`, `kogito-jobs-service`) by adding more partition files.
   
   ### 2-phase upstream build (image-producer modules)
   
   The upstream build uses `-T 1C` for parallelism, but Quarkus runtime extensions have an implicit dependency on their `-deployment` counterpart that Maven doesn't capture. To avoid race conditions:
   
   **Phase 1** — Build all upstream modules in parallel with Quarkus disabled:
   ```
   -T 1C -Dquarkus.build.skip=true -Ddisable.quarkus.plugin=true -Dskip.quarkus.image.assembly=true
   ```
   
   **Phase 2** — Rebuild image-producing modules normally (without the skip flags). These modules need Quarkus augmentation to produce `target/quarkus-app` and container image assemblies required by integration tests. The module list is maintained in `image-producers.txt`.
   
   This 2-phase approach would also benefit `ci.yaml`, which currently uses `-T 1C` in its upstream build and has the same latent Quarkus race condition.
   
   The five image-producing modules that use `maven-assembly-plugin` to package `target/quarkus-app` require a small POM change: a `skip.quarkus.image.assembly` property to skip the assembly when Quarkus is disabled (otherwise the archive fails as empty).
   
   ### What this PR does NOT do
   
   - **`-T 1C` for the test phase** — parallel test execution with surefire/failsafe is risky (port conflicts, flaky tests). This could be explored in a separate PR.
   
   ### CI results
   
   All checks green (run `89788266903`). Wall-clock time comparison (all modules affected):
   
   | Job | Java 17 ||| Java 21 |||
   |---|---:|---:|---:|---:|---:|---:|
   | | upstream | test | **total** | upstream | test | **total** |
   | compute-partitions | — | — | **3m 06s** | — | — | — |
   | partition0 (optaplanner) | 1m 52s | 9m 42s | **14m 18s** | 1m 50s | 9m 13s | **13m 36s** |
   | partition1 (kogito-runtimes) | 5m 09s | 42m 09s | **51m 56s** | 6m 21s | 49m 36s | **58m 50s** |
   | partition2 (kogito-apps) | 8m 23s | 1h 03m | **1h 14m 30s** | 7m 04s | 1h 18m | **1h 29m 02s** |
   | default (drools + shared) | 5m 29s | 52m 50s | **1h 00m 33s** | 5m 35s | 54m 54s | **1h 02m 50s** |
   
   Wall-clock: **~1h 32m** (vs ~3h sequential).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5495947499

   @tkobayas That's awesome! Thanks a lot for all the work here. Let me spend a few hours digesting the code changes, so that I can do a more in-depth code review.
   
   In the mean time, I think we can establish ci.yaml to be used for commits to main, while the new partitioned CI can be used for PR checks. This way we have a self regulating mechanism to make sure our builds are stable across PR checks and commits to main, while keeping fast execution for PR checks, and guaranteed stability for commits to main.
   
   If either fails when the other succeeds, that's a signal something is wrong between them that we need to address.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5491636062

   @yesamer 
   > It's curious that JDK21 is slower than JDK17 :o
   
   Job elapsed times are not very stable, so JDK 21 is sometimes slower. However, from what I've seen, JDK 21 is faster on average. :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794109009


##########
.github/workflows/ci.yaml:
##########
@@ -61,110 +63,82 @@ jobs:
             java: 17
           - os: macos-latest
             java: 21
-
     steps:
-      - name: 'SETUP :: Set paths for temporary files'
-        shell: bash
-        run: |
-          echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
-          echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
-          touch "${{ runner.temp }}/changed-files.txt"
-          touch "${{ runner.temp }}/maven-pl-affected.txt"
-          touch "${{ runner.temp }}/maven-pl-upstream.txt"
-          touch "${{ runner.temp }}/maven-pl-changed.txt"
-
-      - name: 'SETUP :: Free disk space (Ubuntu)'
-        if: runner.os == 'Linux'
-        shell: bash
-        run: |
-          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
-          df -h
-
-      - name: 'SETUP :: Enable long file paths (Windows)'
-        if: runner.os == 'Windows'
-        shell: pwsh
-        run: |
-          git config --system core.longpaths true
-          reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
-
       - name: "SETUP :: Checkout to load local actions"
         uses: actions/checkout@v7
 
-      - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
-        id: checkout_pr
-        uses: ./.github/actions/checkout-pr
-        with:
-          ref: ${{ github.base_ref }}
-
-      - uses: actions/setup-java@v5
-        name: 'SETUP :: Java ${{ matrix.java }}'
+      - uses: ./.github/actions/ci-setup
         with:
+          ref: ${{ github.ref }}
           java-version: ${{ matrix.java }}
-          distribution: temurin
-          cache: maven
 
-      # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
-      # See https://github.com/apache/infrastructure-actions/pull/806
-      - name: 'SETUP :: Install JBang'
+      - name: "CI :: BUILD :: Full"
         shell: bash
-        run: |
-          curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
-          echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
-          unzip -q jbang.zip
-          echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+        run: mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible install

Review Comment:
   On push, we still use the non-parallel full build.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5339961934

   @tiagobento  Thank you for the feedback. I'll work on the suggestions.
   
   One thing:
   
   > Lastly, but not least important: maybe we should try to combine partitioning and a more aggressive -T configuration? Taking advantage of multi-core builds will probably help even more, now that we're aiming to have less scope to build on each partition.
   
   I experimented with the `-T 4` approach in https://github.com/apache/incubator-kie/pull/6864 and achieved a 34% speedup, but at the cost of disabling 10 flaky tests, with one hang issue still unresolved. We should fix these issues anyway, but I'm afraid it could take a long time. Also, it would be hard to keep all tests reliable under parallel Maven builds.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5276273177

   GitHub Actions run `85880655483`, with `-T 1C` removed from the upstream Maven builds, completed successfully for all eight matrix jobs.
   
   | Job | Java 17 | Java 21 |
   |---|---:|---:|
   | Drools | 42m 23s | 40m 36s |
   | OptaPlanner | 20m 26s | 19m 17s |
   | Kogito runtimes | 1h 14m 25s | 1h 05m 57s |
   | Kogito apps | 1h 25m 09s | 1h 21m 37s |
   
   The durations are job wall-clock times measured from the first to the last GitHub Actions timestamp. They include checkout, setup, Maven builds and tests, summary generation, and artifact upload.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#issuecomment-5630941627

   @tiagobento 
   > In the mean time, I think we can establish ci.yaml to be used for commits to main, while the new partitioned CI can be used for PR checks. This way we have a self regulating mechanism to make sure our builds are stable across PR checks and commits to main, while keeping fast execution for PR checks, and guaranteed stability for commits to main.
   
   Sure, it sounds good.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3794188282


##########
pom.xml:
##########
@@ -152,6 +152,9 @@
   </build>
 
   <modules>
+    <!-- DO NOT remove the BEGIN/END comments. They are used by CiComputeBuildScopes for parallel CI job split
+         When you add a new module, put it in one of the 4 categories (drools, optaplanner, kogito-runtimes, kogito-apps) -->
+    <!-- BEGIN drools modules (auto) -->

Review Comment:
   `CiComputeBuildScopes` depends on these `BEGIN` `END` markers for 4 categories split. It's a little fragile, but `CiComputeBuildScopes` makes sure to exit(1) with an error, so we will be able to detect.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3893417721


##########
.github/workflows/ci-parallel.yaml:
##########
@@ -0,0 +1,178 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: 'CI :: Build - Parallel'
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened, closed, labeled]

Review Comment:
   Rather I'm removing `labeled` from `types`, so `labeled`/`unlabeled` doesn't trigger CI. CI will be triggered by usual ways (opening a PR, push a new commit etc.) Label is just to decide sequential or parallel. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892366232


##########
.github/workflows/ci.yaml:
##########
@@ -61,110 +63,82 @@ jobs:
             java: 17
           - os: macos-latest
             java: 21
-
     steps:
-      - name: 'SETUP :: Set paths for temporary files'
-        shell: bash
-        run: |
-          echo "CHANGED_FILES_FILE=${{ runner.temp }}/changed-files.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_AFFECTED_FILE=${{ runner.temp }}/maven-pl-affected.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_UPSTREAM_FILE=${{ runner.temp }}/maven-pl-upstream.txt" >> "$GITHUB_ENV"
-          echo "MAVEN_PL_CHANGED_FILE=${{ runner.temp }}/maven-pl-changed.txt" >> "$GITHUB_ENV"
-          echo "DEP_GRAPH_EXTRACTOR__OUTPUT_FILE=${{ runner.temp }}/dep-graph.tsv" >> "$GITHUB_ENV"
-          touch "${{ runner.temp }}/changed-files.txt"
-          touch "${{ runner.temp }}/maven-pl-affected.txt"
-          touch "${{ runner.temp }}/maven-pl-upstream.txt"
-          touch "${{ runner.temp }}/maven-pl-changed.txt"
-
-      - name: 'SETUP :: Free disk space (Ubuntu)'
-        if: runner.os == 'Linux'
-        shell: bash
-        run: |
-          sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
-          df -h
-
-      - name: 'SETUP :: Enable long file paths (Windows)'
-        if: runner.os == 'Windows'
-        shell: pwsh
-        run: |
-          git config --system core.longpaths true
-          reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
-
       - name: "SETUP :: Checkout to load local actions"
         uses: actions/checkout@v7
 
-      - name: "SETUP :: Checkout @ Simulated squashed-merge if PR, else checkout current commit"
-        id: checkout_pr
-        uses: ./.github/actions/checkout-pr
-        with:
-          ref: ${{ github.base_ref }}
-
-      - uses: actions/setup-java@v5
-        name: 'SETUP :: Java ${{ matrix.java }}'
+      - uses: ./.github/actions/ci-setup
         with:
+          ref: ${{ github.ref }}
           java-version: ${{ matrix.java }}
-          distribution: temurin
-          cache: maven
 
-      # Temporary workaround while jbangdev/setup-jbang action doesn't include checksum verification.
-      # See https://github.com/apache/infrastructure-actions/pull/806
-      - name: 'SETUP :: Install JBang'
+      - name: "CI :: BUILD :: Full"
         shell: bash
-        run: |
-          curl -sL https://github.com/jbangdev/jbang/releases/download/v0.138.0/jbang-0.138.0.zip -o jbang.zip
-          echo "3c9fb9ac5823ae5ab9d136dec08b896e2a0f6f6b313689b21f43c511b7c34b85  jbang.zip" | sha256sum -c -
-          unzip -q jbang.zip
-          echo "${{ github.workspace }}/jbang-0.138.0/bin" >> $GITHUB_PATH
+        run: mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible install

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3892373196


##########
.github/workflows/ci.yaml:
##########
@@ -178,32 +152,90 @@ jobs:
       #   Affected pass  (-pl affected):             builds exactly the affected modules (changed +
       #                                              transitive downstream), running tests.
 
-      - name: "PR CHECK :: BUILD :: Upstream modules${{ github.event_name == 'push' && ' (skipped)' || '' }}"
-        if: github.event_name == 'pull_request'
+      - name: "PR CHECK :: BUILD :: Upstream modules"
         shell: bash
         run: |
+          [ ! -s "$MAVEN_PL_AFFECTED_DROOLS_FILE" ] && echo "No affected drools modules. Skipping upstream build." && exit 0
           pl=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE")
           [ -z "$pl" ] && echo "No upstream modules. Skipping." && exit 0
-          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+          mvn --batch-mode --no-transfer-progress -T 1C -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install

Review Comment:
   outdated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO-NOT-MERGE] [incubator-kie-6854] Parallel CI Jobs [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6860:
URL: https://github.com/apache/incubator-kie/pull/6860#discussion_r3900915512


##########
.github/workflows/ci-parallel.yaml:
##########
@@ -0,0 +1,178 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: 'CI :: Build - Parallel'
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened, closed, labeled]
+    branches: [main]
+    paths-ignore:
+      - 'LICENSE'
+      - '**/.gitignore'
+      - '**.md'
+      - '**.adoc'
+      - '*.txt'
+      - 'docsimg/**'
+      - '.ci/jenkins/**'
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
+jobs:
+
+  # Compute build scopes and partition affected modules.
+  # Uploads per-partition files as artifact and outputs a JSON array of
+  # partition names that have affected modules.
+  compute-partitions:
+    if: >-
+      github.event.action != 'closed'
+      && github.event_name == 'pull_request'
+      && contains(github.event.pull_request.labels.*.name, 'parallel ci')
+    runs-on: ubuntu-latest
+    outputs:
+      partitions: ${{ steps.partitions.outputs.partitions }}
+    steps:
+      - name: "SETUP :: Checkout to load local actions"
+        uses: actions/checkout@v7
+
+      - uses: ./.github/actions/ci-setup
+        with:
+          ref: ${{ github.base_ref }}
+          java-version: 17
+          partitions-dir: .github/supporting-files/ci/partitions
+
+      - id: partitions
+        name: "SETUP :: Build partition matrix"
+        shell: bash
+        run: |
+          json='['
+          first=true
+          for f in "${{ runner.temp }}"/maven-pl-affected-partition*.txt "${{ runner.temp }}"/maven-pl-affected-default.txt; do
+            [ ! -s "$f" ] && continue
+            name=$(basename "$f" .txt | sed 's/^maven-pl-affected-//')
+            $first || json+=','
+            first=false
+            json+="\"$name\""
+          done
+          json+=']'
+          echo "partitions=$json" >> "$GITHUB_OUTPUT"
+          echo "Partitions with affected modules: $json"
+
+      - uses: actions/upload-artifact@v7
+        with:
+          name: partition-files
+          path: |
+            ${{ runner.temp }}/maven-pl-affected-partition*.txt
+            ${{ runner.temp }}/maven-pl-affected-default.txt
+            ${{ runner.temp }}/maven-pl-upstream-partition*.txt
+            ${{ runner.temp }}/maven-pl-upstream-default.txt
+            ${{ runner.temp }}/maven-pl-image-producers-partition*.txt
+            ${{ runner.temp }}/maven-pl-image-producers-default.txt
+
+  # Each partition runs as an independent job via the dynamic matrix.
+  # GHA computes the cross-product of partition × java × os.
+  test:
+    needs: compute-partitions
+    if: needs.compute-partitions.outputs.partitions != '[]'
+    name: '${{ matrix.partition }} :: ${{ matrix.os }}, Java ${{ matrix.java }}'
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        partition: ${{ fromJSON(needs.compute-partitions.outputs.partitions) }}
+        java: [17, 21]
+        os: [ubuntu-latest]
+    steps:
+      - name: "SETUP :: Checkout to load local actions"
+        uses: actions/checkout@v7
+
+      - uses: ./.github/actions/ci-setup
+        with:
+          ref: ${{ github.base_ref }}
+          java-version: ${{ matrix.java }}
+          skip-build-scopes: true
+
+      - uses: actions/download-artifact@v7
+        with:
+          name: partition-files
+          path: ${{ runner.temp }}
+
+      # Flag glossary:
+      #   --no-transfer-progress                    silence download progress bars (critical for 800+ modules)
+      #   -fae / --fail-at-end                      continue past failures so all broken modules are reported
+      #   -Dsurefire.redirectTestOutputToFile=true  redirect test JVM stdout/stderr to surefire-reports files
+      #   -Denforcer.skip=true                      skip Enforcer plugin
+      #   -Dcheckstyle.skip=true                    skip Checkstyle plugin
+      #   -Dformatter.skip=true                     skip formatter plugin
+      #   -Darchunit.skip=true                      skip ArchUnit plugin
+      #   -Dquarkus.build.skip=true                 skip Quarkus application build
+      #   -Ddisable.quarkus.plugin=true             skip compile-time Quarkus bootstrap
+      #   -Dskip.quarkus.image.assembly=true        skip assemblies that package target/quarkus-app
+
+      - name: "PR CHECK :: BUILD :: Upstream modules (tests skipped)"
+        shell: bash
+        run: |
+          pl=$(paste -sd, "${{ runner.temp }}/maven-pl-upstream-${{ matrix.partition }}.txt")
+          [ -z "$pl" ] && echo "No upstream modules. Skipping." && exit 0
+          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Dquarkus.build.skip=true -Ddisable.quarkus.plugin=true -Dskip.quarkus.image.assembly=true -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+
+      - name: "PR CHECK :: BUILD :: Required image-producing modules"
+        shell: bash
+        run: |
+          pl=$(paste -sd, "${{ runner.temp }}/maven-pl-image-producers-${{ matrix.partition }}.txt")
+          [ -z "$pl" ] && echo "No required image-producing modules. Skipping." && exit 0
+          mvn -T 1C --batch-mode --no-transfer-progress -fae -DskipTests -DskipITs -Denforcer.skip=true -Dcheckstyle.skip=true -Dformatter.skip=true -Darchunit.skip=true -Dsurefire.redirectTestOutputToFile=true -pl "$pl" install
+
+      - name: "PR CHECK :: TEST :: ${{ matrix.partition }}"
+        shell: bash
+        run: |
+          pl=$(paste -sd, "${{ runner.temp }}/maven-pl-affected-${{ matrix.partition }}.txt")
+          [ -z "$pl" ] && echo "No affected modules. Skipping." && exit 0
+          mvn --batch-mode --no-transfer-progress -fae -Dsurefire.redirectTestOutputToFile=true -Dfull -Dreproducible -pl "$pl" install
+
+      - name: 'SUMMARY :: Publish'
+        if: always()
+        shell: bash
+        env:
+          MERMAID_EXPANDED: ${{ matrix.java == 21 }}
+          MATRIX_OS: ${{ matrix.os }}
+          MATRIX_JAVA: ${{ matrix.java }}
+        run: |
+          MAVEN_PL_AFFECTED=$(paste -sd, "$MAVEN_PL_AFFECTED_FILE" 2>/dev/null || true) \
+          MAVEN_PL_UPSTREAM=$(paste -sd, "$MAVEN_PL_UPSTREAM_FILE" 2>/dev/null || true) \
+          MAVEN_PL_CHANGED=$(paste -sd, "$MAVEN_PL_CHANGED_FILE" 2>/dev/null || true) \

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org