From a4019ca3b5d32a31d47e17fbf84557b9fe8d5f3a Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Tue, 24 Sep 2024 09:32:57 -0400 Subject: [PATCH] Build for linux arm64 (#382) --- .github/workflows/rust.yml | 43 ++++++++++++++++++++++++++++++++++++++ js/install.js | 1 + 2 files changed, 44 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cf172786..187c3ea5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,6 +60,49 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-linux-arm64: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/') + + name: Linux arm64 + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Apt + run: sudo apt-get install gcc-aarch64-linux-gnu + + - name: Install Toolchain + uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master + with: + toolchain: stable + target: aarch64-unknown-linux-gnu + profile: minimal + override: true + + - name: Cache + uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # pin@v2 + + - name: Build + run: RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" cargo build --target aarch64-unknown-linux-gnu --release && mv target/aarch64-unknown-linux-gnu/release/squawk target/release/squawk-linux-arm64 + + - name: Artifact + uses: actions/upload-artifact@v3 + with: + name: release + path: target/release/squawk-linux-arm64 + + - name: Release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/squawk-linux-arm64 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-windows: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/') diff --git a/js/install.js b/js/install.js index c8c9b2a6..560acb25 100644 --- a/js/install.js +++ b/js/install.js @@ -50,6 +50,7 @@ const SUPPORTED_PLATFORMS = new Set([ "darwin-x64", "darwin-arm64", "linux-x64", + "linux-arm64", "win32-x64", ]) const BINARY_NAME_OVERRIDE = new Map([["win32-x64", "squawk-windows-x64.exe"]])