CI: build only affected target for single-target PRs#11450
Merged
sensei-hacker merged 2 commits intoiNavFlight:maintenance-9.xfrom Mar 22, 2026
Merged
CI: build only affected target for single-target PRs#11450sensei-hacker merged 2 commits intoiNavFlight:maintenance-9.xfrom
sensei-hacker merged 2 commits intoiNavFlight:maintenance-9.xfrom
Conversation
Maintenance 9.x to master
When a pull request only modifies files within one directory under src/main/target/, there is no need to rebuild all ~150 targets. A new `detect` job inspects the changed files. If every changed file is inside exactly one src/main/target/<DIR>/ sub-directory, the target names are read from that directory's CMakeLists.txt and passed to a new `build-single-target` job which runs `ninja <targets>` on a single runner instead of the usual 15-job matrix. Any PR that touches files outside a single target directory falls through to the existing full matrix build unchanged. The `upload-artifacts` job is updated to accept output from either build path.
|
Test firmware build ready — commit Download firmware for PR #11450 228 targets built. Find your board's
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Many pull requests only add or modify a single flight controller target — all changed files are within one
src/main/target/<TARGET>/directory. In those cases it is wasteful to spin up 15 CI runners and rebuild all ~150 targets.This adds a fast
detectjob that runs before the build. If every changed file in the PR is inside exactly onesrc/main/target/<DIR>/sub-directory, the target names are read directly from that directory'sCMakeLists.txtand a singlebuild-single-targetjob runsninja <targets>on one runner instead of the usual 15-job matrix.Any PR that touches files outside a single target directory falls through to the existing full matrix build unchanged. Push events and
workflow_call(nightly builds) always do a full build.Changes
detectjob: diffs PR against base branch, outputssingle_target=true/falseandtarget_namesbuildmatrix job: skipped whensingle_target == 'true'build-single-targetjob: runsninja <target_names>on a single runnerupload-artifactsupdated to accept output from either build pathTesting
target_stm32xxx(NAME)extracts correctly)if: needs.detect.outputs.single_target != 'true'condition passes through for all non-PR and multi-target scenariossrc/main/target/BLUEBERRYH743/), this would build onlyBLUEBERRYH743instead of all targetsRelated Issues
Reduces CI time and runner cost for the common case of single-target additions/fixes.