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

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 3b226aec67aaa94edc5ec1d59f74a2d0ff3c4dce
Author: Szymon Janc <[email protected]>
AuthorDate: Tue Oct 13 01:43:06 2026 +0200

    ci: Add support for splitting builds into shards
    
    Blinky, bootloader and applications build scripts build all items
    sequentially in single job. Add support for building only items
    assigned to selected shard (SHARD_INDEX of SHARD_TOTAL) so that build
    can be split between multiple CI jobs. By default everything is built,
    as before.
    
    Assisted-by: Claude:claude-opus-5-5
---
 .github/test_build_apps.sh       | 11 +++++++++++
 .github/test_build_blinky.sh     | 11 +++++++++++
 .github/test_build_bootloader.sh | 11 +++++++++++
 3 files changed, 33 insertions(+)

diff --git a/.github/test_build_apps.sh b/.github/test_build_apps.sh
index bacdecd10..4bd9eb2e2 100755
--- a/.github/test_build_apps.sh
+++ b/.github/test_build_apps.sh
@@ -19,6 +19,12 @@
 
 EXIT_CODE=0
 
+# Build only items assigned to this shard (for splitting build between
+# CI jobs), by default everything is built.
+SHARD_INDEX=${SHARD_INDEX:-0}
+SHARD_TOTAL=${SHARD_TOTAL:-1}
+ITEM_INDEX=0
+
 APPS=$(basename -a `ls -d repos/apache-mynewt-core/apps/*/`)
 
 # Those apps require some special configurations or setup
@@ -39,6 +45,11 @@ for app in ${APPS}; do
         continue
     fi
 
+    ITEM_INDEX=$((ITEM_INDEX + 1))
+    if [ $(( (ITEM_INDEX - 1) % SHARD_TOTAL )) -ne $SHARD_INDEX ]; then
+        continue
+    fi
+
     echo "Testing $app"
 
     # TODO add support for 'custom' app BSP
diff --git a/.github/test_build_blinky.sh b/.github/test_build_blinky.sh
index fdd52a50f..343e9c76d 100755
--- a/.github/test_build_blinky.sh
+++ b/.github/test_build_blinky.sh
@@ -19,6 +19,12 @@
 
 EXIT_CODE=0
 
+# Build only items assigned to this shard (for splitting build between
+# CI jobs), by default everything is built.
+SHARD_INDEX=${SHARD_INDEX:-0}
+SHARD_TOTAL=${SHARD_TOTAL:-1}
+ITEM_INDEX=0
+
 BSPS=$(basename -a `find repos/apache-mynewt-core/hw/bsp/* -maxdepth 0 -type 
d`)
 IGNORED_BSPS="dialog_cmac hifive1 native-armv7\
               olimex-pic32-emz64 olimex-pic32-hmz144 pic32mx470_6lp_clicker\
@@ -39,6 +45,11 @@ for bsp in ${BSPS}; do
         continue
     fi
 
+    ITEM_INDEX=$((ITEM_INDEX + 1))
+    if [ $(( (ITEM_INDEX - 1) % SHARD_TOTAL )) -ne $SHARD_INDEX ]; then
+        continue
+    fi
+
     # Limit build on non-Linux VMs to 10 BSPs
     if [ $RUNNER_OS != "Linux" ]; then
        ((BSP_COUNT++))
diff --git a/.github/test_build_bootloader.sh b/.github/test_build_bootloader.sh
index 3cd1adf75..0fb014da0 100755
--- a/.github/test_build_bootloader.sh
+++ b/.github/test_build_bootloader.sh
@@ -19,6 +19,12 @@
 
 EXIT_CODE=0
 
+# Build only items assigned to this shard (for splitting build between
+# CI jobs), by default everything is built.
+SHARD_INDEX=${SHARD_INDEX:-0}
+SHARD_TOTAL=${SHARD_TOTAL:-1}
+ITEM_INDEX=0
+
 BSPS=$(basename -a `find repos/apache-mynewt-core/hw/bsp/* -maxdepth 0 -type 
d`)
 IGNORED_BSPS="dialog_cmac hifive1 native native-armv7\
               nucleo-f030r8 nucleo-f072rb\
@@ -37,6 +43,11 @@ for bsp in ${BSPS}; do
         continue
     fi
 
+    ITEM_INDEX=$((ITEM_INDEX + 1))
+    if [ $(( (ITEM_INDEX - 1) % SHARD_TOTAL )) -ne $SHARD_INDEX ]; then
+        continue
+    fi
+
     # Limit build on non-Linux VMs to 10 BSPs
     if [ $RUNNER_OS != "Linux" ]; then
        ((BSP_COUNT++))

Reply via email to