From 7ce26d49d5855e88a6c70afa0e72f0ef89a4e6e5 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 23 Jan 2025 17:57:25 -0500 Subject: [PATCH] chore(ci): add aarch64 linux runner Linux arm64 hosted runners is in public preview. Enable and see if is is something we can have now. setting `target.linker` is required for cross-compilation on ARM64, so disable cross compilation tests for it. https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/ --- .github/workflows/main.yml | 9 +++++++++ crates/cargo-test-support/src/cross_compile.rs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04da8bd1688..a499eedbc7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -130,6 +130,14 @@ jobs: os: ubuntu-latest rust: nightly other: i686-unknown-linux-gnu + - name: Linux aarch64 stable + os: ubuntu-24.04-arm + rust: stable + other: TODO # cross-compile tests are disabled, this shouldn't matter. + - name: Linux aarch64 nightly + os: ubuntu-24.04-arm + rust: nightly + other: TODO # cross-compile tests are disabled, this shouldn't matter. - name: macOS aarch64 stable os: macos-14 rust: stable @@ -161,6 +169,7 @@ jobs: - run: rustup update --no-self-update stable - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} - run: rustup target add ${{ matrix.other }} + if: matrix.os != 'ubuntu-24.04-arm' - run: rustup target add wasm32-unknown-unknown - run: rustup target add aarch64-unknown-none # need this for build-std mock tests if: startsWith(matrix.rust, 'nightly') diff --git a/crates/cargo-test-support/src/cross_compile.rs b/crates/cargo-test-support/src/cross_compile.rs index d9e61cb2f7e..f52dfcc0694 100644 --- a/crates/cargo-test-support/src/cross_compile.rs +++ b/crates/cargo-test-support/src/cross_compile.rs @@ -27,6 +27,12 @@ pub fn disabled() -> bool { _ => {} } + // It requires setting `target.linker` for cross-compilation to work on aarch64, + // so not going to bother now. + if cfg!(all(target_arch = "aarch64", target_os = "linux")) { + return true; + } + // Cross tests are only tested to work on macos, linux, and MSVC windows. if !(cfg!(target_os = "macos") || cfg!(target_os = "linux") || cfg!(target_env = "msvc")) { return true;