Skip to content

Build Rust binaries

Build Rust binaries #4

name: Build Rust binaries
on:
workflow_dispatch:
jobs:
build-and-upload:
name: Build + Upload Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
#linux x86
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
output: libyggdrasilffi.so
name: libyggdrasilffi_x86_64.so
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
output: libyggdrasilffi.so
name: libyggdrasilffi_x86_64-musl.so
#linux arm64
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
output: libyggdrasilffi.so
name: libyggdrasilffi_arm64.so
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
output: libyggdrasilffi.so
name: libyggdrasilffi_arm64-musl.so
#win x86
- os: windows-latest
target: x86_64-pc-windows-gnu
output: yggdrasilffi.dll
name: yggdrasilffi_x86_64.dll
#win arm64
- os: windows-11-arm
target: aarch64-pc-windows-msvc
output: yggdrasilffi.dll
name: yggdrasilffi_arm64.dll
- os: windows-latest
target: i686-pc-windows-msvc
output: yggdrasilffi.dll
name: yggdrasilffi_i686.dll
cross: true
- os: macos-13
target: x86_64-apple-darwin
output: libyggdrasilffi.dylib
name: libyggdrasilffi_x86_64.dylib
- os: macos-latest
target: aarch64-apple-darwin
output: libyggdrasilffi.dylib
name: libyggdrasilffi_arm64.dylib
steps:
- uses: actions/checkout@v5
- name: Install zig
uses: mlugg/setup-zig@v2
- name: Install rust
run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile default
rustup target add ${{ matrix.target }}
rustup show
- name: Rust cache
uses: Swatinem/rust-cache@v2
# Linux MUSL toolchain (native, not cross)
- name: Install musl tools (Linux)
if: startsWith(matrix.target, 'x86_64-unknown-linux-musl') || startsWith(matrix.target, 'aarch64-unknown-linux-musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools pkg-config build-essential
- name: Build Rust Library (Cargo)
if: startsWith(matrix.os, 'macos')
run: cargo build -p yggdrasilffi --release --target ${{ matrix.target }};