Skip to content

Release FFI

Release FFI #1

Workflow file for this run

name: Release FFI
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 0.2.0)'
required: true
type: string
jobs:
build-ffi:
strategy:
matrix:
include:
- os: linux-ubuntu-latest
target: x86_64-unknown-linux-gnu
static_lib: libzerobus_ffi.a
dynamic_lib: libzerobus_ffi.so
artifact_dir: linux-x86-64
- os: macos-13
target: x86_64-apple-darwin
static_lib: libzerobus_ffi.a
dynamic_lib: libzerobus_ffi.dylib
artifact_dir: darwin-x86-64
- os: macos-14
target: aarch64-apple-darwin
static_lib: libzerobus_ffi.a
dynamic_lib: libzerobus_ffi.dylib
artifact_dir: darwin-aarch64
- os: windows-server-latest
target: x86_64-pc-windows-msvc
static_lib: zerobus_ffi.lib
dynamic_lib: zerobus_ffi.dll
artifact_dir: windows-x86-64
runs-on:
group: databricks-protected-runner-group
labels: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build FFI library
run: cargo build --release -p zerobus-ffi --target ${{ matrix.target }}
- name: Create artifact directory
run: mkdir -p artifacts/${{ matrix.artifact_dir }}
- name: Copy artifacts (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/${{ matrix.static_lib }} artifacts/${{ matrix.artifact_dir }}/
cp target/${{ matrix.target }}/release/${{ matrix.dynamic_lib }} artifacts/${{ matrix.artifact_dir }}/
cp ffi/zerobus.h artifacts/${{ matrix.artifact_dir }}/
- name: Copy artifacts (Windows)
if: runner.os == 'Windows'
run: |
copy target\${{ matrix.target }}\release\${{ matrix.static_lib }} artifacts\${{ matrix.artifact_dir }}\
copy target\${{ matrix.target }}\release\${{ matrix.dynamic_lib }} artifacts\${{ matrix.artifact_dir }}\
copy ffi\zerobus.h artifacts\${{ matrix.artifact_dir }}\
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ffi-${{ matrix.artifact_dir }}
path: artifacts/${{ matrix.artifact_dir }}
package:
needs: build-ffi
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: native
pattern: ffi-*
merge-multiple: false
- name: Organize artifacts
run: |
mkdir -p release/native
for dir in native/ffi-*/; do
platform=$(basename "$dir" | sed 's/ffi-//')
mkdir -p "release/native/$platform"
cp "$dir"/* "release/native/$platform/"
done
ls -laR release/
- name: Create release archive
run: |
cd release
tar -czvf ../zerobus-ffi-${{ inputs.version }}.tar.gz native/
cd ..
ls -la
- name: Upload release archive
uses: actions/upload-artifact@v4
with:
name: zerobus-ffi-${{ inputs.version }}
path: zerobus-ffi-${{ inputs.version }}.tar.gz
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ffi-v${{ inputs.version }}
name: FFI Libraries v${{ inputs.version }}
body: |
Native C FFI libraries for zerobus-sdk-rs v${{ inputs.version }}
Use these libraries to build language bindings (Go, C#, C++, etc.)
Platforms included:
- linux-x86-64 (.a, .so)
- darwin-x86-64 (.a, .dylib)
- darwin-aarch64 (.a, .dylib)
- windows-x86-64 (.lib, .dll)
Each platform includes:
- Static library for Go/C++ (libzerobus_ffi.a / zerobus_ffi.lib)
- Dynamic library for C#/others (libzerobus_ffi.so / .dylib / .dll)
- C header file (zerobus.h)
files: zerobus-ffi-${{ inputs.version }}.tar.gz