Skip to content

ci: multi-arch-test-build: split matrix build into two stages#128

Draft
BKPepe wants to merge 1 commit into
openwrt:mainfrom
BKPepe:optional-matrix
Draft

ci: multi-arch-test-build: split matrix build into two stages#128
BKPepe wants to merge 1 commit into
openwrt:mainfrom
BKPepe:optional-matrix

Conversation

@BKPepe

@BKPepe BKPepe commented Jun 30, 2026

Copy link
Copy Markdown
Member

This tries to implement the idea from @champtar and @hauke in this pull request openwrt/packages#29410 (comment). It first runs on 3 architectures, and if they succeed, it proceeds with the rest. This selection covers aarch64 (where fPIC was most affected in the past), armv7 (as a 32-bit ARM representative), and powerpc (where Go packages are not supported).

The main benefit is that instead of triggering the whole heavy machinery for all packages at once, we initially limit it to a few architectures. If those pass, the rest are triggered. For users on architectures other than the first three, the total build time might increase by dozens of minutes or even hours, but it will significantly save runner capacity and time if the build fails early.

It will certainly be interesting to see how this impacts the main OpenWrt repository. Note that I am still keeping a custom matrix for certain repositories such as LuCI, where packages are compiled only for x86_64.

For now, I want to test this first to verify it works as expected. This PR is currently meant more as a discussion starter on whether this approach makes sense.

I also recall that @hnyman was looking for or requesting something similar.

Refactor the `multi-arch-test-build.yml` workflow to execute the architecture build matrix in two sequential stages to optimize CI resource usage.

- Create a new sub-reusable workflow `reusable_test_build_single.yml` to encapsulate the build, packaging, metadata generation, and Docker runtime test steps for a single architecture.
- Modify `multi-arch-test-build.yml` to replace the single `build` job with three distinct jobs:
  - `build_custom`: Runs if a custom matrix is supplied by the caller (keeping full backward compatibility).
  - `build_early`: Acts as a smoke test by running three initial architectures (aarch64_generic, arm_cortex-a9_vfpv3-d16, powerpc_8548).
  - `build_remaining`: Runs the remaining 7 architectures only if the early stage builds successfully (`needs: build_early`).

This ensures that if any of the core architectures fail to build or pass tests, the remaining jobs in the matrix are not scheduled, saving workflow runners.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
@github-actions

Copy link
Copy Markdown

Warning

Some formality checks failed.

Consider (re)reading submissions guidelines.

Failed checks

Issues marked with an ❌ are failing checks.

Commit ec58837

  • 🔶 Commit subject length: recommended max 60, required max 80 characters
  • 🔶 Commit body line 1 is longer than 100 characters (is 146):
    Refactor the multi-arch-test-build.yml workflow to execute the architecture build matrix in two sequential stages to optimize CI resource usage.
  • 🔶 Commit body line 3 is longer than 100 characters (is 184):
    • Create a new sub-reusable workflow reusable_test_build_single.yml to encapsulate the build, packaging, metadata generation, and Docker runtime test steps for a single architecture.
  • 🔶 Commit body line 5 is longer than 100 characters (is 108):
    - build_custom: Runs if a custom matrix is supplied by the caller (keeping full backward compatibility).
  • 🔶 Commit body line 6 is longer than 100 characters (is 136):
    - build_early: Acts as a smoke test by running three initial architectures (aarch64_generic, arm_cortex-a9_vfpv3-d16, powerpc_8548).
  • 🔶 Commit body line 7 is longer than 100 characters (is 125):
    - build_remaining: Runs the remaining 7 architectures only if the early stage builds successfully (needs: build_early).
  • 🔶 Commit body line 9 is longer than 100 characters (is 156):
    This ensures that if any of the core architectures fail to build or pass tests, the remaining jobs in the matrix are not scheduled, saving workflow runners.

For more details, see the full job log.

Something broken? Consider providing feedback.

@danielfdickinson

Copy link
Copy Markdown

FWIW I think this is a good idea. I've not worked enough with GHA to comment on the actual workflows until I can spend a good amount of time on it, but the have three 'canary' archs in parallel that gate the rest of the archs looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants