Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/actions/install-zigbuild/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Install zig and cargo-zigbuild
description: >
Install pinned zig + cargo-zigbuild for cross-compiling the linux-gnu native
libraries against an glibc 2.17.

Assumes a Linux x86_64/aarch64 runner.

inputs:
rust-target:
description: >
Optional Rust target triple to `rustup target add`.
required: false
default: ""

runs:
using: composite
steps:
- name: Install zig and cargo-zigbuild
shell: bash
env:
ZIG_VERSION: "0.13.0"
CARGO_ZIGBUILD_VERSION: "0.20.1"
RUST_TARGET: ${{ inputs.rust-target }}
run: |
set -euo pipefail
ARCH="$(uname -m)"
curl -fsSL "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz" \
| sudo tar -xJ -C /usr/local
sudo ln -sf "/usr/local/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig
curl -fsSL "https://github.com/rust-cross/cargo-zigbuild/releases/download/v${CARGO_ZIGBUILD_VERSION}/cargo-zigbuild-v${CARGO_ZIGBUILD_VERSION}.${ARCH}-unknown-linux-musl.tar.gz" \
| sudo tar -xz -C /usr/local/bin
if [[ -n "${RUST_TARGET}" ]]; then
rustup target add "${RUST_TARGET}"
fi
zig version
# `cargo zigbuild` dispatches to `cargo-zigbuild zigbuild`, whose
# subcommand has no --version flag; query the binary directly.
cargo-zigbuild --version
11 changes: 10 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ jobs:
linker = "musl-gcc-wrapper"
EOF

- name: Install zig and cargo-zigbuild (linux-gnu)
if: contains(matrix.host.TARGET, 'linux-gnu')
uses: ./.github/actions/install-zigbuild
with:
rust-target: ${{ matrix.host.TARGET }}

- name: Build native library
working-directory: valkey-glide/ffi
env:
Expand All @@ -143,15 +149,18 @@ jobs:
run: |
if [[ "${{ matrix.host.TARGET }}" == *"musl"* ]]; then
cargo build --release --target ${{ matrix.host.TARGET }}
elif [[ "${{ matrix.host.TARGET }}" == *"linux-gnu"* ]]; then
cargo zigbuild --release --target ${{ matrix.host.TARGET }}.2.17
else
# macOS, pins to target MacOS 11+
cargo build --release
fi

- name: Upload native library artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: native-lib-${{ matrix.host.TARGET }}
path: valkey-glide/ffi/target/${{ contains(matrix.host.TARGET, 'musl') && format('{0}/release', matrix.host.TARGET) || 'release' }}/libglide_ffi.${{ matrix.host.OS == 'macos' && 'dylib' || 'so' }}
path: valkey-glide/ffi/target/${{ matrix.host.OS == 'macos' && 'release' || format('{0}/release', matrix.host.TARGET) }}/libglide_ffi.${{ matrix.host.OS == 'macos' && 'dylib' || 'so' }}
if-no-files-found: error

build-and-publish-gem:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,28 @@ jobs:
restore-keys: |
${{ matrix.host.TARGET }}-cargo-

- name: Install zig and cargo-zigbuild (linux-gnu)
if: contains(matrix.host.TARGET, 'linux-gnu')
uses: ./.github/actions/install-zigbuild

- name: Build native library
working-directory: valkey-glide/ffi
env:
GLIDE_NAME: GlideRuby
GLIDE_VERSION: ${{ github.ref_name }}
run: cargo build --release
run: |
if [[ "${{ matrix.host.TARGET }}" == *"linux-gnu"* ]]; then
cargo zigbuild --release --target ${{ matrix.host.TARGET }}.2.17
else
# macOS, pins to target MacOS 11+
cargo build --release
fi

- name: Upload native library
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: native-lib-${{ matrix.host.NAMED_OS }}-${{ matrix.host.ARCH }}
path: valkey-glide/ffi/target/release/libglide_ffi.${{ matrix.host.OS == 'macos' && 'dylib' || 'so' }}
path: valkey-glide/ffi/target/${{ contains(matrix.host.TARGET, 'linux-gnu') && format('{0}/release', matrix.host.TARGET) || 'release' }}/libglide_ffi.${{ matrix.host.OS == 'macos' && 'dylib' || 'so' }}
if-no-files-found: error

test-ruby:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

### Changes

* Ruby: fixed cd workflow to correctly build the ffi with **glibc 2.17** ([#223](https://github.com/valkey-io/valkey-glide-ruby/issues/223))
* Ruby: Add Alpine Linux (musl libc) support for x86_64 and aarch64 — runtime detection of musl libc, CI/CD pipeline for native builds, and prebuilt `libglide_ffi.so` for musl targets ([#143](https://github.com/valkey-io/valkey-glide-ruby/pull/143))
* Ruby: Add distributed tracing support — `Valkey::OpenTelemetry.set_parent_span_context_provider` (and `init(parent_span_context_provider:)`) let an app propagate its current W3C trace context into command/pipeline spans, so they become children of the app's trace instead of independent root spans, matching the Node.js client's `parentSpanContextProvider` behavior.
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# Valkey GLIDE for Ruby

Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official open-source Valkey client library, proudly part of the [Valkey](https://valkey.io) organization. The Ruby gem (`valkey-glide-rb`) wraps [Valkey GLIDE Core](https://github.com/valkey-io/valkey-glide) with an interface similar to [redis-rb](https://github.com/redis/redis-rb)**, delivering GLIDE performance, reliability, and enterprise features.
Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official open-source Valkey client library, proudly part of the [Valkey](https://valkey.io) organization. The Ruby gem (`valkey-glide-rb`) wraps [Valkey GLIDE Core](https://github.com/valkey-io/valkey-glide) with an interface similar to [redis-rb](https://github.com/redis/redis-rb), delivering GLIDE performance, reliability, and enterprise features.

## Why Choose Valkey GLIDE?

Expand Down Expand Up @@ -30,28 +31,21 @@ Valkey General Language Independent Driver for the Enterprise (GLIDE) is the off

### System Requirements

The release of Valkey GLIDE Ruby was tested on the following platforms:

**Linux:**

- Ubuntu 20+ (x86_64/amd64 and arm64/aarch64)
- Amazon Linux 2 (AL2) and 2023 (AL2023) (x86_64)
- Alpine Linux 3.18+ (x86_64 and arm64/aarch64) — musl libc

**macOS:**

- macOS 14.7+ (Apple silicon / aarch64)
- macOS 13.7+ (x86_64 / amd64)
- glibc 2.17+ or musl 1.2.3+
- Ruby 3.0+

### Ruby Supported Versions
#### Supported OS

| Ruby Version | MRI | JRuby |
|--------------|-----|-------|
| 2.6 | ✓ | - |
| 2.7 | ✓ | - |
| 3.0 – 3.4 | ✓ | ✓ |
The following platforms have been tested:
- Ubuntu 24
- Alpine Linux 3
- macOS 14 (Apple silicon / ARM)

Minimum Ruby version: **2.6.0** (see `valkey.gemspec`).
**Notes:**
* Other Linux distributions not mentioned here should work as long as they
meet the glibc 2.17+ / musl 1.2.3+ requirement above.
* Only Apple silicon (ARM) macOS is shipped, with a minimum of macOS 11.
Intel macOS users must build locally — see [build from source](./DEVELOPER.md).

### Installation and Setup

Expand Down
Loading