From fe45ebe5e70d4a9b8103f4c82fbd5b63125ecf4b Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Thu, 1 Aug 2024 22:41:03 +0100 Subject: [PATCH] Add cross compilation --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f597a30..c16e8cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,15 @@ jobs: toolchain: stable profile: minimal override: true + components: rustfmt, clippy + + - name: Add ARM64 target + run: rustup target add aarch64-unknown-linux-gnu + + - name: Install ARM64 toolchain + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu - name: Cache dependencies uses: actions/cache@v3 @@ -29,18 +38,34 @@ jobs: path: | ~/.cargo target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}" restore-keys: | ${{ runner.os }}-cargo- - - name: Build + - name: Build (x86_64) uses: actions-rs/cargo@v1 with: command: build args: --release --all-features + - name: Build (ARM64) + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features --target aarch64-unknown-linux-gnu + env: + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + - name: Run tests uses: actions-rs/cargo@v1 with: command: test args: --all-features + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: binaries + path: | + target/release/${{ github.event.repository.name }} + target/aarch64-unknown-linux-gnu/release/${{ github.event.repository.name }}