fix(ci): extract reusable workflow for the native cross-compilation matrix - #2115
Conversation
…atrix build-native.yml and publish.yml each maintained their own copy of the same 6-target cross-compilation matrix and toolchain setup, with only a one-step difference (Cargo.toml version sync). Extract build-native-matrix.yml as a workflow_call reusable workflow, parameterized by an optional version input, so both callers share one definition instead of two that can silently drift.
Greptile SummaryThis PR extracts the shared 6-target cross-compilation matrix into a new
Confidence Score: 5/5Safe to merge — this is a mechanical extraction of two near-identical inline job definitions into a single reusable workflow, with no logic changes to the build steps themselves. All six matrix targets, toolchain setup steps, cross-compilation tooling, the macOS cargo-shim workaround, and artifact upload names are faithfully reproduced in the reusable workflow. No files require special attention; the new build-native-matrix.yml is the only substantive change and faithfully mirrors the logic that was previously duplicated. Important Files Changed
Reviews (1): Last reviewed commit: "Merge branch 'main' into fix/consolidate..." | Re-trigger Greptile |
Summary
build-native.yml'sbuildjob andpublish.yml'sbuild-nativejob each defined the same 6-target cross-compilation matrix (linux-x64, linux-arm64 cross, linux-x64-musl cross, macos-latest, macos-14, windows-latest) with near-identical steps — publish.yml's copy just adds a "Sync Cargo.toml version" step.github/workflows/build-native-matrix.ymlas aworkflow_callreusable workflow with an optionalversioninput (the Cargo.toml sync step is skipped when unset)build-native.ymlandpublish.yml'sbuild-nativejob now both call it instead of maintaining two copiesWhy
Part of the broader CI/CD cost-reduction effort (#2108). Beyond the duplicated compute, the two copies had already started drifting (
windows-latesthere vs the pinnedwindows-2022used inci.yml's separate host-build matrix) — a single source of truth removes that risk for the target list, toolchain setup, and the macOS cargo-shim workaround.Note:
ci.yml'snative-host-build/parityjobs are intentionally not folded into this — they build a different thing (3-OS host-native build +cargo test, no cross-compilation/musl/arm64 variants) for a different purpose (JS test + WASM/native parity validation), not distributable platform binaries.Closes #2110
Test plan
actionlint— no new findings (pre-existing shellcheck notes only, all outside the touched regions)crates/**should confirmbuild-native.ymlstill produces artifacts namednative-<platform>as beforebuild-nativejob still produces the same artifacts with the version-synced Cargo.toml