From 68703e3e4708b255ec7bdab3a365532cc5122617 Mon Sep 17 00:00:00 2001 From: Khalil Estell Date: Sun, 18 Oct 2026 14:02:29 -0700 Subject: [PATCH] :zap: (patch) Split Cortex-M LLVM deploys into three jobs A libhal-util 6.0.0-alpha.1 deploy hit the 45 minute Cortex-M timeout: each of its two LLVM jobs built 18-24 packages at about 110 seconds each. Half of that time was the test_package, which rebuilds every imported C++ module (mp-units, libhal, libhal-util) to link one program. - The deploy's LLVM cores are built in three jobs instead of two, with each job's cores listed in the Plan job: M0-M4, M4F-M23 and M33-M85. - baremetal_package.sh only runs the test_package for the first package it builds. Later packages pass --test-folder "". --- .github/scripts/baremetal_package.sh | 9 +++++++-- .github/workflows/package_and_upload_all.yml | 15 ++++++++------- README.md | 7 ++++++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/scripts/baremetal_package.sh b/.github/scripts/baremetal_package.sh index 74f3fd5..efe67a4 100644 --- a/.github/scripts/baremetal_package.sh +++ b/.github/scripts/baremetal_package.sh @@ -82,11 +82,16 @@ pipx install conan>=$CONAN_VERSION conan config install https://github.com/libhal/conan-config2.git conan hal setup -# Loop over architectures and build types +# Loop over architectures and build types. Only the first package runs the +# test_package: it rebuilds every imported C++ module just to link one small +# program, which roughly doubles the cost of each package, and linking against +# the other architectures adds little. +TEST_FOLDER_ARGS=() for ARCH in "${ARCH_LIST[@]}"; do echo "Building for architecture: $ARCH" for BUILD_TYPE in "${BUILD_TYPES[@]}"; do - conan create $DIR -s:h build_type=$BUILD_TYPE -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing $EXTRA_CONAN_ARGS + conan create $DIR -s:h build_type=$BUILD_TYPE -s:h os=baremetal -s:h arch=$ARCH --version $VERSION -pr:h $COMPILER_PROFILE --build=missing "${TEST_FOLDER_ARGS[@]}" $EXTRA_CONAN_ARGS + TEST_FOLDER_ARGS=(--test-folder "") done done diff --git a/.github/workflows/package_and_upload_all.yml b/.github/workflows/package_and_upload_all.yml index 5a61fcf..8be8b5d 100644 --- a/.github/workflows/package_and_upload_all.yml +++ b/.github/workflows/package_and_upload_all.yml @@ -102,14 +102,15 @@ jobs: '[{name: "M sample", archs: $archs}]') cortex_m_gcc="cortex-m0plus,$sample" else - # Deploy: every build type and Cortex-M core. LLVM splits the - # cores across two jobs because one job for all of them is slow. + # Deploy: every build type and Cortex-M core. Building every core in + # one job is slow, so LLVM builds them in three parallel jobs. build_types="Debug,MinSizeRel,Release" - older="cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d" - newer="cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85" - cortex_m_llvm=$(jq -nc --arg older "$armv6m$older" --arg newer "$newer" \ - '[{name: "M0-M7", archs: $older}, {name: "M23-M85", archs: $newer}]') - cortex_m_gcc="cortex-m0,cortex-m0plus,cortex-m1,$older,$newer" + cortex_m_llvm=$(jq -nc --arg armv6m "$armv6m" '[ + { name: "M0-M4", archs: ($armv6m + "cortex-m3,cortex-m4") }, + { name: "M4F-M23", archs: "cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23" }, + { name: "M33-M85", archs: "cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85" } + ]') + cortex_m_gcc="cortex-m0,cortex-m0plus,cortex-m1,cortex-m3,cortex-m4,cortex-m4f,cortex-m7f,cortex-m7d,cortex-m23,cortex-m33,cortex-m33f,cortex-m35pf,cortex-m55,cortex-m85" fi { diff --git a/README.md b/README.md index 749ea06..c32df77 100644 --- a/README.md +++ b/README.md @@ -409,7 +409,7 @@ It runs in one of two modes, picked by `version`: | --- | --- | --- | | Build types | `MinSizeRel` | `Debug`, `MinSizeRel`, `Release` | | Linux x86_64, Linux armv8, macOS armv8 (LLVM) | ✅ | ✅ | -| Cortex-M (LLVM) | M0+, M3, M4F, M33F in one job | M0, M0+, M1, M3, M4, M4F, M7F, M7D and M23, M33, M33F, M35PF, M55, M85 in two jobs | +| Cortex-M (LLVM) | M0+, M3, M4F, M33F in one job | M0, M0+, M1, M3, M4, M4F, M7F, M7D, M23, M33, M33F, M35PF, M55, M85, split evenly across three jobs | | Cortex-M (GCC, when `modules_support_needed` is false) | M0+, M3, M4F, M33F | every Cortex-M architecture | Check mode keeps pull requests and pushes to main cheap. Deploys still build @@ -420,6 +420,11 @@ place and the build jobs read its outputs. ARMv6-M (M0, M0+, M1) is left out of Host jobs time out after 30 minutes and Cortex-M jobs after 45, so a hung runner can't run for hours. +Within each Cortex-M job, only the first package runs its `test_package`. A +test_package rebuilds every imported C++ module (mp-units, libhal, ...) just to +link one program, so running it for every architecture and build type roughly +doubled the job's time. + **Usage:** ```yaml