This is an automated email from the ASF dual-hosted git repository.

hgruszecki pushed a commit to branch ci/partition-rust-tests
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 3312f0e866655fff70c5e3e3ad7eac089ae672fb
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Fri Mar 20 18:15:01 2026 +0100

    ci(ci): partition Rust tests across 2 parallel CI machines
    
    Split the single "test" task into "test-1" and "test-2" using nextest
    --partition hash:M/2. Each partition independently builds and runs half
    the test suite in parallel, reducing wall-clock from ~10min to ~6min.
    
    - components.yml: replace "test" with "test-1" and "test-2"
    - pre-merge action: parse partition index from task name, pass
      --partition hash:INDEX/2 to cargo nextest run
    - _test.yml: update Codecov upload condition to match new task names
      (Codecov natively merges partial coverage uploads per commit)
    
    Verified locally: hash:1/2 gets 972 tests, hash:2/2 gets 938 tests,
    sum = 1910 (full suite).
---
 .github/actions/rust/pre-merge/action.yml | 21 +++++++++++++++------
 .github/config/components.yml             |  3 ++-
 .github/workflows/_test.yml               |  2 +-
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/.github/actions/rust/pre-merge/action.yml 
b/.github/actions/rust/pre-merge/action.yml
index 071ce5804..992ef0f0c 100644
--- a/.github/actions/rust/pre-merge/action.yml
+++ b/.github/actions/rust/pre-merge/action.yml
@@ -20,7 +20,7 @@ description: Rust pre-merge testing and linting github iggy 
actions
 
 inputs:
   task:
-    description: "Task to run (check, fmt, clippy, sort, machete, doctest, 
test, compat)"
+    description: "Task to run (check, fmt, clippy, sort, machete, doctest, 
test-1, test-2, compat)"
     required: true
   component:
     description: "Component name (for context)"
@@ -45,7 +45,7 @@ runs:
     - name: Setup Rust with cache
       uses: ./.github/actions/utils/setup-rust-with-cache
       with:
-        print-cache-status: ${{ inputs.task == 'test' }}
+        print-cache-status: ${{ startsWith(inputs.task, 'test-') }}
 
     - name: Install tools for specific tasks
       run: |
@@ -93,20 +93,20 @@ runs:
       shell: bash
 
     - name: Install dependencies for Rust tests
-      if: inputs.task == 'test' && runner.os == 'Linux'
+      if: startsWith(inputs.task, 'test-') && runner.os == 'Linux'
       run: |
         sudo apt-get update --yes && sudo apt-get install --yes musl-tools 
gnome-keyring keyutils dbus-x11 libsecret-tools
         rm -f $HOME/.local/share/keyrings/*
       shell: bash
 
     - name: Install cargo-llvm-cov
-      if: inputs.task == 'test'
+      if: startsWith(inputs.task, 'test-')
       uses: taiki-e/install-action@v2
       with:
         tool: cargo-llvm-cov
 
     - name: Build and test with coverage
-      if: inputs.task == 'test'
+      if: startsWith(inputs.task, 'test-')
       run: |
         # Start D-Bus and unlock keyring in the same shell that runs tests,
         # so daemons are guaranteed alive for the entire test execution.
@@ -117,6 +117,15 @@ runs:
           echo -n "warmup" | secret-tool store --label="ci-warmup" ci-test 
warmup
         fi
 
+        # Parse partition index from task name (test-1 -> hash:1/2, test-2 -> 
hash:2/2)
+        TASK="${{ inputs.task }}"
+        PARTITION_FLAG=""
+        if [[ "$TASK" =~ ^test-([0-9]+)$ ]]; then
+          PARTITION_INDEX="${BASH_REMATCH[1]}"
+          PARTITION_FLAG="--partition hash:${PARTITION_INDEX}/2"
+          echo "::notice::Running test partition ${PARTITION_INDEX}/2"
+        fi
+
         source <(cargo llvm-cov show-env --export-prefix)
 
         bins_start=$(date +%s)
@@ -133,7 +142,7 @@ runs:
 
         test_start=$(date +%s)
         if command -v cargo-nextest &> /dev/null; then
-          cargo nextest run --locked --no-fail-fast
+          cargo nextest run --locked --no-fail-fast $PARTITION_FLAG
         else
           cargo test --locked --no-fail-fast
         fi
diff --git a/.github/config/components.yml b/.github/config/components.yml
index 93bdca5ef..29079bd8f 100644
--- a/.github/config/components.yml
+++ b/.github/config/components.yml
@@ -109,7 +109,8 @@ components:
       - "sort"
       - "doctest"
       - "machete"
-      - "test"
+      - "test-1"
+      - "test-2"
       - "compat"
       - "build-aarch64-gnu"
       - "build-aarch64-musl"
diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml
index bcb37321c..6fd50003e 100644
--- a/.github/workflows/_test.yml
+++ b/.github/workflows/_test.yml
@@ -63,7 +63,7 @@ jobs:
           component: ${{ inputs.component }}
 
       - name: Upload coverage to Codecov
-        if: startsWith(inputs.component, 'rust') && inputs.task == 'test'
+        if: startsWith(inputs.component, 'rust') && startsWith(inputs.task, 
'test-')
         uses: codecov/codecov-action@v5
         with:
           token: ${{ secrets.CODECOV_TOKEN }}

Reply via email to