From 2080ac30dfc192c9e86edb20080ab4f861e5416a 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 +++++++++ Cargo.lock | 2 +- crates/cargo-test-support/Cargo.toml | 2 +- crates/cargo-test-support/src/cross_compile.rs | 6 ++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 19b920a2d..953b9bd34 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' # cross-compile tests are disabled on ARM machines - 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/Cargo.lock b/Cargo.lock index f2245b8d2..be4a02694 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -450,7 +450,7 @@ version = "0.4.2" [[package]] name = "cargo-test-support" -version = "0.7.3" +version = "0.7.4" dependencies = [ "anstream", "anstyle", diff --git a/crates/cargo-test-support/Cargo.toml b/crates/cargo-test-support/Cargo.toml index a61934a8b..8d60571a7 100644 --- a/crates/cargo-test-support/Cargo.toml +++ b/crates/cargo-test-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-test-support" -version = "0.7.3" +version = "0.7.4" edition.workspace = true rust-version = "1.85" # MSRV:1 license.workspace = true diff --git a/crates/cargo-test-support/src/cross_compile.rs b/crates/cargo-test-support/src/cross_compile.rs index d9e61cb2f..f52dfcc06 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;