From 10c2b37a723a8afe0a4ed3f286247e37a76df58d Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Mon, 30 Sep 2024 12:28:51 +0300 Subject: [PATCH 1/2] Update the binaries GitHub workflow to add support for ARM builds --- .github/workflows/binaries.yml | 81 ++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 0bc0f73db..55f07e556 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -7,34 +7,69 @@ on: env: CARGO_TERM_COLOR: always +permissions: + contents: write + jobs: build-and-publish: - name: Publish for ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }} + runs-on: ${{ matrix.platform.os }} strategy: + fail-fast: false matrix: - include: - - os: ubuntu-latest - artifact_name: circom - asset_name: circom-linux-amd64 - - os: windows-latest - artifact_name: circom.exe - asset_name: circom-windows-amd64.exe - - os: macos-latest - artifact_name: circom - asset_name: circom-macos-amd64 - + platform: + - os_name: Linux-aarch64 + os: ubuntu-20.04 + target: aarch64-unknown-linux-musl + bin: circom-linux-arm64 + - os_name: Linux-x86_64 + os: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + bin: circom-linux-amd64 + - os_name: Windows-x86_64 + os: windows-latest + target: x86_64-pc-windows-msvc + bin: circom-amd64.exe + - os_name: Windows-aarch64 + os: windows-latest + target: aarch64-pc-windows-msvc + bin: circom-arm64.exe + - os_name: macOS-x86_64 + os: macOS-latest + target: x86_64-apple-darwin + bin: circom-darwin-amd64 + - os_name: macOS-aarch64 + os: macOS-latest + target: aarch64-apple-darwin + bin: circom-darwin-arm64 + toolchain: + - stable steps: - - name: Checkout project - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 + with: + command: "build" + target: ${{ matrix.platform.target }} + toolchain: ${{ matrix.toolchain }} + args: "--locked --release" + strip: true + + - name: Rename binary (linux and macos) + run: mv target/${{ matrix.platform.target }}/release/circom target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} + if: matrix.platform.os_name != 'Windows-x86_64' && matrix.platform.os_name != 'Windows-aarch64' + + - name: Rename binary (windows) + run: mv target/${{ matrix.platform.target }}/release/circom.exe target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} + if: matrix.platform.os_name == 'Windows-x86_64' || matrix.platform.os_name == 'Windows-aarch64' - - name: Build - run: cargo build --verbose --release + - name: Generate SHA-256 + run: shasum -a 256 target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} | cut -d ' ' -f 1 > target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.sha256 - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 + - name: Release binary and SHA-256 checksum to GitHub + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') with: - file: target/release/${{ matrix.artifact_name }} - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref }} - asset_name: ${{ matrix.asset_name }} + files: | + target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} + target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.sha256 From 90fe8bb20f37bc11067b11b54ceb4a9db505a5a4 Mon Sep 17 00:00:00 2001 From: Kyryl Riabov Date: Mon, 30 Sep 2024 13:01:54 +0300 Subject: [PATCH 2/2] Made names backwards compatible --- .github/workflows/binaries.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 55f07e556..80486422e 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -22,26 +22,32 @@ jobs: os: ubuntu-20.04 target: aarch64-unknown-linux-musl bin: circom-linux-arm64 + - os_name: Linux-x86_64 os: ubuntu-20.04 target: x86_64-unknown-linux-gnu bin: circom-linux-amd64 + - os_name: Windows-x86_64 os: windows-latest target: x86_64-pc-windows-msvc - bin: circom-amd64.exe + bin: circom-windows-amd64.exe + - os_name: Windows-aarch64 os: windows-latest target: aarch64-pc-windows-msvc - bin: circom-arm64.exe + bin: circom-windows-arm64.exe + - os_name: macOS-x86_64 os: macOS-latest target: x86_64-apple-darwin - bin: circom-darwin-amd64 + bin: circom-macos-amd64 + - os_name: macOS-aarch64 os: macOS-latest target: aarch64-apple-darwin - bin: circom-darwin-arm64 + bin: circom-macos-arm64 + toolchain: - stable steps: