From 3150f2e8b48376c8df55739dca4e910dd6f492a3 Mon Sep 17 00:00:00 2001 From: "Claus F. Strasburger" <1156864+cfstras@users.noreply.github.com> Date: Tue, 2 Jan 2024 23:44:01 +0100 Subject: [PATCH] Build rust images for ARM64 & use `cargo binstall` for faster build time (#120) * Also build rust on arm64 * rust: use cargo-binstall for performance Since linux/arm64 images are built using QEMU, the compilation of bindgen-cli, cbindgen, cargo-audit & cargo-outdated takes a very long time, especially on Ubuntu 20.04 (more than 6 hours, for the combination of both architectures on one job). This exceeds the github actions time-limit. So, we'll just use pre-built binaries using cargo-binstall where possible. --- .github/workflows/build-ubuntu.yml | 2 +- linux/ubuntu/scripts/rust.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index e9ddd42..b8d1cf8 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -229,7 +229,7 @@ jobs: TYPE: js - PLATFORMS: linux/amd64,linux/arm64 TYPE: pwsh - - PLATFORMS: linux/amd64 + - PLATFORMS: linux/amd64,linux/arm64 TYPE: rust - PLATFORMS: linux/amd64,linux/arm64 TYPE: dotnet diff --git a/linux/ubuntu/scripts/rust.sh b/linux/ubuntu/scripts/rust.sh index 921298e..b489dab 100755 --- a/linux/ubuntu/scripts/rust.sh +++ b/linux/ubuntu/scripts/rust.sh @@ -20,7 +20,11 @@ source "${CARGO_HOME}/env" rustup component add rustfmt clippy -cargo install --locked bindgen-cli cbindgen cargo-audit cargo-outdated +printf "\n\tšŸ‹ Installing cargo-binstall šŸ‹\t\n" +# Pinned to commit-hash for latest release v1.4.7 to prevent accidental problems +curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/f6a95fa733be466c0e66c360f52e1d6998e47f25/install-from-binstall-release.sh | bash + +cargo binstall -y bindgen-cli cbindgen cargo-audit cargo-outdated chmod -R 777 "$(dirname "${RUSTUP_HOME}")"