Compile Rusk Binaries #51
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile Rusk Binaries | |
on: | |
workflow_dispatch: | |
inputs: | |
dusk_blockchain_ref: | |
description: "Git branch, ref, or SHA to checkout" | |
required: true | |
default: "master" | |
runner: | |
description: "Choose runner target to build against (JSON array)" | |
required: true | |
default: "[\"ubuntu-24.04\", \"macos-15\", \"arm-linux\"]" | |
features: | |
description: "Choose features to build (JSON array)" | |
required: true | |
default: "[\"default\", \"archive\", \"prover\"]" | |
jobs: | |
config: | |
runs-on: ubuntu-latest | |
name: Show configuration | |
outputs: | |
archs: ${{steps.final.outputs.archs}} | |
steps: | |
- name: get archs | |
run: | | |
echo "# Parameters" | tee -a $GITHUB_STEP_SUMMARY | |
echo | tee -a $GITHUB_STEP_SUMMARY | |
echo "features = $FEATURES" | tee -a $GITHUB_STEP_SUMMARY | |
echo | tee -a $GITHUB_STEP_SUMMARY | |
echo "runner = $RUNNER" | tee -a $GITHUB_STEP_SUMMARY | |
env: | |
FEATURES: ${{github.event.inputs.features}} | |
RUNNER: ${{github.event.inputs.runner}} | |
build_and_publish: | |
name: Build Rusk binaries for ${{ matrix.os }} (${{ matrix.feature }}) | |
runs-on: ${{ matrix.os }} | |
needs: | |
- config | |
continue-on-error: ${{ !contains(fromJson(github.event.inputs.runner), matrix.os) }} | |
strategy: | |
matrix: | |
feature: ${{ fromJson(github.event.inputs.features) }} | |
compiler: [cargo] | |
os: [ubuntu-24.04, macos-15, arm-linux] | |
include: | |
- os: ubuntu-24.04 | |
target: linux-x64 | |
target_folder: target | |
- os: macos-15 | |
target: macos-arm64 | |
target_folder: target/aarch64-apple-darwin | |
flags: --target=aarch64-apple-darwin | |
- os: arm-linux | |
target: linux-arm64 | |
target_folder: target/aarch64-unknown-linux-gnu | |
flags: --target=aarch64-unknown-linux-gnu | |
fail-fast: false | |
steps: | |
- name: Skip Non-matching Configurations | |
if: | | |
!contains(fromJson(github.event.inputs.runner), matrix.os) || | |
!contains(fromJson(github.event.inputs.features), matrix.feature) | |
run: | | |
echo "Skipping build for ${{ matrix.os }} - ${{ matrix.feature }}" | |
exit 1 | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.dusk_blockchain_ref }} | |
- name: Install Rust toolchain | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Add ARM target for Apple silicon | |
run: rustup target add aarch64-apple-darwin | |
if: ${{ matrix.os == 'macos-15' }} | |
- name: Check for Prover Features | |
id: config | |
run: | | |
echo "Checking feature requirements..." | |
if [[ "${{ matrix.feature }}" == *"prover"* ]]; then | |
echo "NO_DEFAULT_FEATURES=--no-default-features" >> $GITHUB_ENV | |
echo "SKIP_WASM=true" >> $GITHUB_ENV | |
else | |
echo "NO_DEFAULT_FEATURES=" >> $GITHUB_ENV | |
echo "SKIP_WASM=false" >> $GITHUB_ENV | |
fi | |
- name: Build Rusk binary | |
shell: bash | |
working-directory: ./rusk | |
run: cargo build --release ${{ env.NO_DEFAULT_FEATURES }} --features "${{ matrix.feature }}" ${{ matrix.flags }} | |
- name: Extract Version | |
run: | | |
export SEMVER=$(cargo pkgid --manifest-path ./rusk/Cargo.toml | sed -E 's/.*@([0-9]+\.[0-9]+\.[0-9]+).*/\1/') | |
echo "SEMVER=$SEMVER" >> $GITHUB_ENV | |
- name: Package Binaries | |
run: | | |
find . -name "rusk" | |
mkdir rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }} | |
mv ${{ matrix.target_folder }}/release/rusk rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }} | |
tar -czvf rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}.tar.gz \ | |
rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }} | |
- name: Upload Binaries as Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }} | |
path: ./rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}.tar.gz | |
retention-days: 5 |