ci(actions): enabled cross-compilation toolchains across CI native and release builds
- Updated the build-native action to install cargo-zigbuild for non-MSVC targets and cargo-xwin with LLVM tooling for MSVC targets. - Removed the fixed aarch64 linker variable and narrowed Rust test execution to skip duplicate macOS runs. - Reworked CI matrices to build win32-x64 artifacts on ubuntu with x86_64-pc-windows-msvc and simplified smoke testing to skip those Windows binaries via matrix gating.
This commit is contained in:
@@ -75,21 +75,50 @@ runs:
|
||||
bun-version: "1.3"
|
||||
- shell: bash
|
||||
run: bun install --frozen-lockfile
|
||||
- name: Install cross-compilation toolchain
|
||||
if: inputs.target == 'aarch64-unknown-linux-gnu'
|
||||
# Cross-compile toolchain selection: non-MSVC targets (e.g.
|
||||
# `aarch64-unknown-linux-gnu`) build with `cargo-zigbuild`; MSVC targets
|
||||
# (e.g. `x86_64-pc-windows-msvc`) build with `cargo-xwin`. The napi CLI's
|
||||
# `--cross-compile` flag picks the backend; we just install what it needs.
|
||||
- name: Setup zig (non-MSVC cross-compile)
|
||||
if: inputs.target != '' && !endsWith(inputs.target, '-msvc')
|
||||
uses: mlugg/setup-zig@v2
|
||||
with:
|
||||
version: 0.16.0
|
||||
- name: Install cargo-zigbuild (non-MSVC cross-compile)
|
||||
if: inputs.target != '' && !endsWith(inputs.target, '-msvc')
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-zigbuild
|
||||
- name: Install LLVM tooling (MSVC cross-compile)
|
||||
if: endsWith(inputs.target, '-msvc')
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
sudo apt-get install -y clang lld llvm
|
||||
- name: Install cargo-xwin (MSVC cross-compile)
|
||||
if: endsWith(inputs.target, '-msvc')
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-xwin
|
||||
- name: Cache cargo-xwin Windows SDK
|
||||
if: endsWith(inputs.target, '-msvc')
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/cargo-xwin
|
||||
key: cargo-xwin-${{ runner.os }}-v1
|
||||
- name: Accept xwin license
|
||||
if: endsWith(inputs.target, '-msvc')
|
||||
shell: bash
|
||||
run: echo "XWIN_ACCEPT_LICENSE=1" >> "$GITHUB_ENV"
|
||||
- name: Rust checks
|
||||
if: inputs.rust_checks == 'true'
|
||||
shell: bash
|
||||
run: bun run check:rs
|
||||
- name: Test workspace (Rust)
|
||||
# macOS has no `#[cfg(target_os = "macos")]` tests in the workspace —
|
||||
# every test there duplicates the Linux native_linux run. Windows still
|
||||
# needs the pass for `#[cfg(windows)]` modules (pi-shell/windows.rs and
|
||||
# vendored brush-core sys/windows tests).
|
||||
# macOS has no `#[cfg(target_os = "macos")]` tests in the workspace,
|
||||
# and Windows-only tests are no longer exercised in CI (`win32-x64`
|
||||
# cross-builds on Linux). Skipping the duplicate Linux runs on macOS
|
||||
# saves ~10 min of parallel runner time.
|
||||
if: inputs.target == '' && inputs.platform != 'darwin'
|
||||
shell: bash
|
||||
run: bun run test:rs
|
||||
@@ -100,7 +129,6 @@ runs:
|
||||
TARGET_PLATFORM: ${{ inputs.platform }}
|
||||
TARGET_ARCH: ${{ inputs.arch }}
|
||||
TARGET_VARIANTS: ${{ inputs.variant }}
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
run: bun run ci:build:native
|
||||
- name: Upload native addon(s)
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -169,7 +169,7 @@ jobs:
|
||||
- { os: ubuntu-22.04, platform: linux, arch: arm64, target: aarch64-unknown-linux-gnu }
|
||||
- { os: macos-15-intel, platform: darwin, arch: x64, variant: baseline }
|
||||
- { os: macos-14, platform: darwin, arch: arm64 }
|
||||
- { os: windows-latest, platform: win32, arch: x64, variant: baseline }
|
||||
- { os: ubuntu-22.04, platform: win32, arch: x64, target: x86_64-pc-windows-msvc, variant: baseline }
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -316,7 +316,7 @@ jobs:
|
||||
binary_path: packages/coding-agent/binaries/omp-darwin-arm64,
|
||||
}
|
||||
- {
|
||||
os: windows-latest,
|
||||
os: ubuntu-22.04,
|
||||
platform: win32,
|
||||
arch: x64,
|
||||
target_id: win32-x64,
|
||||
@@ -346,22 +346,16 @@ jobs:
|
||||
env:
|
||||
RELEASE_TARGETS: ${{ matrix.target_id }}
|
||||
run: bun run ci:release:build-binaries
|
||||
# Windows binary is cross-built on Linux, so we have no Windows runner
|
||||
# to smoke it on. Cross-build correctness is verified via the napi
|
||||
# entry-point exports (see build-native action) and the bun
|
||||
# `--compile --target=bun-windows-x64-*` cross-compile.
|
||||
- name: Smoke release binary
|
||||
if: runner.os != 'Windows'
|
||||
if: matrix.platform != 'win32'
|
||||
run: |
|
||||
runtime_dir="$(mktemp -d)"
|
||||
HOME="$runtime_dir/home" XDG_DATA_HOME="$runtime_dir/xdg" "${{ matrix.binary_path }}" --version
|
||||
HOME="$runtime_dir/home" XDG_DATA_HOME="$runtime_dir/xdg" "${{ matrix.binary_path }}" --smoke-test
|
||||
- name: Smoke release binary (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$runtimeDir = Join-Path $env:TEMP ("omp-runtime-" + [System.Guid]::NewGuid().ToString("N"))
|
||||
New-Item -ItemType Directory -Force -Path $runtimeDir | Out-Null
|
||||
$env:HOME = Join-Path $runtimeDir "home"
|
||||
$env:XDG_DATA_HOME = Join-Path $runtimeDir "xdg"
|
||||
& "${{ matrix.binary_path }}" --version
|
||||
& "${{ matrix.binary_path }}" --smoke-test
|
||||
- name: Upload release binary artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user