Skip to content

Commit

Permalink
chore: add arm builds for Ruby (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
sighphyre authored Sep 26, 2024
1 parent 5482543 commit 4f0c50d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[target.x86_64-unknown-linux-musl]
rustflags = [
"-C", "target-feature=-crt-static",
]

[target.aarch64-unknown-linux-musl]
rustflags = [
"-C", "target-feature=-crt-static",
]
34 changes: 31 additions & 3 deletions .github/workflows/publish-ruby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,40 @@ jobs:
target: x86_64-unknown-linux-gnu
output: libyggdrasilffi.so
name: libyggdrasilffi_x86_64.so
cross: false
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
output: libyggdrasilffi.so
name: libyggdrasilffi_arm64.so
cross: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
output: libyggdrasilffi.so
name: libyggdrasilffi_aarch64.so
cross: true
- os: windows-latest
target: x86_64-pc-windows-gnu
output: yggdrasilffi.dll
name: libyggdrasilffi_x86_64.dll
cross: false
- os: macos-13
target: x86_64-apple-darwin
output: libyggdrasilffi.dylib
name: libyggdrasilffi_x86_64.dylib
cross: false
- os: macos-latest
target: aarch64-apple-darwin
output: libyggdrasilffi.dylib
name: libyggdrasilffi_arm64.dylib
cross: false

steps:
- uses: actions/checkout@v4

- name: Install cross (if needed)
if: ${{ matrix.cross == true }}
run: cargo install cross

- name: Install rust
run: |
rustup set auto-self-update disable
Expand All @@ -37,9 +55,13 @@ jobs:
- name: Rust cache
uses: Swatinem/rust-cache@v2

- name: Build Rust Library
run: |
cargo build -p yggdrasilffi --release --target ${{ matrix.target }}
- name: Build Rust Library (Cross)
if: ${{ matrix.cross == true }}
run: cross build -p yggdrasilffi --release --target ${{ matrix.target }};

- name: Build Rust Library (Cargo)
if: ${{ matrix.cross == false }}
run: cargo build -p yggdrasilffi --release --target ${{ matrix.target }};

- name: Rename Output Binary
run: |
Expand All @@ -58,6 +80,12 @@ jobs:
include:
- os: ubuntu-latest
binary: libyggdrasilffi_x86_64.so
- os: ubuntu-latest
binary: libyggdrasilffi_arm64.so
platform: arm-linux
- os: ubuntu-latest
binary: libyggdrasilffi_aarch64.so
platform: aarch64-linux
- os: windows-latest
binary: libyggdrasilffi_x86_64.dll
- os: macos-13
Expand Down
4 changes: 3 additions & 1 deletion ruby-engine/lib/yggdrasil_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def platform_specific_lib
arch_suffix = case cpu
when /x86_64/
'x86_64'
when /arm|aarch64/
when /arm/
'arm64'
when /aarch64/
'aarch64'
else
raise "unsupported architecture #{cpu}"
end
Expand Down
2 changes: 1 addition & 1 deletion ruby-engine/yggdrasil-engine.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Gem::Specification.new do |s|
target_platform = -> { ENV['YGG_BUILD_PLATFORM'] || Gem::Platform::CURRENT }

s.name = 'yggdrasil-engine'
s.version = '0.0.5'
s.version = '0.0.6'
s.date = '2023-06-28'
s.summary = 'Unleash engine for evaluating feature toggles'
s.description = '...'
Expand Down

0 comments on commit 4f0c50d

Please sign in to comment.