mirror of
https://github.com/zkonduit/ezkl.git
synced 2026-01-14 08:48:01 -05:00
251 lines
8.4 KiB
YAML
251 lines
8.4 KiB
YAML
name: Create Release with Compiled Binaries
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "The tag to release"
|
|
required: true
|
|
push:
|
|
tags:
|
|
- "*"
|
|
jobs:
|
|
create-release:
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
name: create-release
|
|
runs-on: ubuntu-22.04
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
outputs:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url}}
|
|
ezkl_version: ${{ env.EZKL_VERSION }}
|
|
|
|
steps:
|
|
- name: Get release version from tag
|
|
shell: bash
|
|
run: |
|
|
echo "EZKL_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Create Github Release
|
|
id: create-release
|
|
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2.2.1
|
|
with:
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|
|
tag_name: ${{ env.EZKL_VERSION }}
|
|
|
|
build-release-gpu:
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
name: build-release-gpu
|
|
needs: ["create-release"]
|
|
runs-on: GPU
|
|
env:
|
|
CARGO: cargo
|
|
TARGET_FLAGS: ""
|
|
TARGET_DIR: ./target
|
|
RUST_BACKTRACE: 1
|
|
PCRE2_SYS_STATIC: 1
|
|
RUSTFLAGS: "-C linker=gcc"
|
|
OPENSSL_NO_VENDOR: 1
|
|
steps:
|
|
- uses: actions-rust-lang/setup-rust-toolchain@fb51252c7ba57d633bc668f941da052e410add48 #v1.0.6
|
|
with:
|
|
toolchain: nightly-2025-05-01
|
|
override: true
|
|
components: rustfmt, clippy
|
|
cache: false
|
|
- name: Checkout repo
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential g++ gcc cmake libclang-dev llvm-dev libstdc++-12-dev libc6 libc6-dev libssl-dev pkg-config
|
|
|
|
- name: Force rebuild icicle dependencies
|
|
run: cargo clean -p icicle-runtime -p icicle-core -p icicle-hash -p icicle-bn254
|
|
|
|
- name: Get release version from tag
|
|
shell: bash
|
|
run: |
|
|
echo "EZKL_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Set Cargo.toml version to match github tag
|
|
shell: bash
|
|
run: |
|
|
mv Cargo.toml Cargo.toml.orig
|
|
sed "s/0\\.0\\.0/${EZKL_VERSION//v}/" Cargo.toml.orig >Cargo.toml
|
|
mv Cargo.lock Cargo.lock.orig
|
|
sed "s/0\\.0\\.0/${EZKL_VERSION//v}/" Cargo.lock.orig >Cargo.lock
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release -Z sparse-registry --features gpu-accelerated
|
|
|
|
- name: Build archive
|
|
shell: bash
|
|
run: |
|
|
mkdir -p build-artifacts
|
|
tar czvf build-artifacts/ezkl-linux-gpu.tar.gz -C "target/release" ezkl
|
|
echo "ASSET=build-artifacts/ezkl-linux-gpu.tar.gz" >> $GITHUB_ENV
|
|
|
|
- name: Upload release archive
|
|
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 #v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
|
asset_path: ${{ env.ASSET }}
|
|
asset_name: ${{ env.ASSET }}
|
|
asset_content_type: application/octet-stream
|
|
|
|
build-release:
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
issues: write
|
|
name: build-release
|
|
needs: ["create-release"]
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
CARGO: cargo
|
|
TARGET_FLAGS: ""
|
|
TARGET_DIR: ./target
|
|
RUST_BACKTRACE: 1
|
|
PCRE2_SYS_STATIC: 1
|
|
strategy:
|
|
matrix:
|
|
build: [windows-msvc, macos, macos-aarch64, linux-musl, linux-gnu, linux-aarch64]
|
|
include:
|
|
- build: windows-msvc
|
|
os: windows-latest
|
|
rust: nightly-2025-05-01
|
|
target: x86_64-pc-windows-msvc
|
|
- build: macos
|
|
os: macos-13
|
|
rust: nightly-2025-05-01
|
|
target: x86_64-apple-darwin
|
|
- build: macos-aarch64
|
|
os: macos-13
|
|
rust: nightly-2025-05-01
|
|
target: aarch64-apple-darwin
|
|
- build: linux-musl
|
|
os: ubuntu-22.04
|
|
rust: nightly-2025-05-01
|
|
target: x86_64-unknown-linux-musl
|
|
- build: linux-gnu
|
|
os: ubuntu-22.04
|
|
rust: nightly-2025-05-01
|
|
target: x86_64-unknown-linux-gnu
|
|
- build: linux-aarch64
|
|
os: ubuntu-22.04
|
|
rust: nightly-2025-05-01
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Get release version from tag
|
|
shell: bash
|
|
run: |
|
|
echo "EZKL_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Set Cargo.toml version to match github tag
|
|
shell: bash
|
|
run: |
|
|
mv Cargo.toml Cargo.toml.orig
|
|
sed "s/0\\.0\\.0/${EZKL_VERSION//v}/" Cargo.toml.orig >Cargo.toml
|
|
mv Cargo.lock Cargo.lock.orig
|
|
sed "s/0\\.0\\.0/${EZKL_VERSION//v}/" Cargo.lock.orig >Cargo.lock
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
|
sudo apt-get update && sudo apt-get install -y musl-tools
|
|
fi
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@4f94fbe7e03939b0e674bcc9ca609a16088f63ff #nightly branch, TODO: update when required
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Install Rust targets
|
|
run: rustup target add ${{ matrix.target }}
|
|
|
|
- name: Use Cross
|
|
shell: bash
|
|
run: |
|
|
cargo install cross -Z sparse-registry
|
|
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
|
|
echo "CC=clang" >> $GITHUB_ENV
|
|
elif [[ "${{ matrix.os }}" == "ubuntu-22.04" ]]; then
|
|
echo "CC=gcc" >> $GITHUB_ENV
|
|
fi
|
|
echo "CARGO=cross" >> $GITHUB_ENV
|
|
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
|
|
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
|
|
|
|
- name: Show command used for Cargo
|
|
run: |
|
|
echo "cargo command is: ${{ env.CARGO }}"
|
|
echo "target flag is: ${{ env.TARGET_FLAGS }}"
|
|
echo "target dir is: ${{ env.TARGET_DIR }}"
|
|
|
|
- name: Build release binary (no asm or metal)
|
|
if: matrix.build != 'linux-gnu' && matrix.build != 'macos-aarch64'
|
|
run: ${{ env.CARGO }} build --release ${{ env.TARGET_FLAGS }} -Z sparse-registry --features mimalloc
|
|
|
|
- name: Build release binary (asm)
|
|
if: matrix.build == 'linux-gnu'
|
|
run: ${{ env.CARGO }} build --release ${{ env.TARGET_FLAGS }} -Z sparse-registry --features mimalloc
|
|
|
|
- name: Build release binary (metal)
|
|
if: matrix.build == 'macos-aarch64'
|
|
run: ${{ env.CARGO }} build --release ${{ env.TARGET_FLAGS }} -Z sparse-registry --features macos-metal,mimalloc
|
|
|
|
- name: Strip release binary
|
|
if: matrix.build != 'windows-msvc' && matrix.build != 'linux-aarch64'
|
|
run: strip "target/${{ matrix.target }}/release/ezkl"
|
|
|
|
- name: Strip release binary (Windows)
|
|
if: matrix.build == 'windows-msvc'
|
|
run: strip "target/${{ matrix.target }}/release/ezkl.exe"
|
|
|
|
- name: Build archive
|
|
if: matrix.build != 'win-msvc'
|
|
shell: bash
|
|
run: |
|
|
mkdir -p build-artifacts
|
|
tar czvf build-artifacts/ezkl-${{ matrix.build }}.tar.gz -C "target/${{ matrix.target }}/release" ezkl
|
|
echo "ASSET=build-artifacts/ezkl-${{ matrix.build }}.tar.gz" >> $GITHUB_ENV
|
|
|
|
- name: Build archive (Windows)
|
|
if: matrix.build == 'win-msvc'
|
|
shell: bash
|
|
run: |
|
|
mkdir -p build-artifacts
|
|
powershell.exe -Command "Compress-Archive -Path 'target/${{ matrix.target }}/release/ezkl.exe' -DestinationPath 'build-artifacts/ezkl-win.zip'"
|
|
echo "ASSET=build-artifacts/ezkl-win.zip" >> $GITHUB_ENV
|
|
|
|
- name: Upload release archive
|
|
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 #v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
|
asset_path: ${{ env.ASSET }}
|
|
asset_name: ${{ env.ASSET }}
|
|
asset_content_type: application/octet-stream
|