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
29 changes: 25 additions & 4 deletions .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
- 'crates/adapters/el-engine-candle/**'
- '.cargo/config.toml'
- 'Makefile'
- 'scripts/install-cargo-tool.sh'
- 'scripts/retry-command.sh'
- 'tests/check_ci_workflows.py'
- 'tests/test-install-cargo-tool.sh'
- 'tests/test-retry-command.sh'
- '.github/workflows/bindings.yml'
pull_request:
paths:
Expand All @@ -21,6 +26,11 @@ on:
- 'Cargo.lock'
- 'Cargo.toml'
- 'Makefile'
- 'scripts/install-cargo-tool.sh'
- 'scripts/retry-command.sh'
- 'tests/check_ci_workflows.py'
- 'tests/test-install-cargo-tool.sh'
- 'tests/test-retry-command.sh'
- '.github/workflows/bindings.yml'

jobs:
Expand All @@ -34,6 +44,12 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Test el-ffi (host target)
run: cargo test -p el-ffi
- name: Test cargo tool installer
run: bash tests/test-install-cargo-tool.sh
- name: Test command retry wrapper
run: bash tests/test-retry-command.sh
- name: Check CI workflow tool dependencies
run: python3 tests/check_ci_workflows.py

# ── Android: aarch64-linux-android cross-compile ──────────────────────────
android:
Expand Down Expand Up @@ -77,7 +93,7 @@ jobs:
${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
RANLIB_aarch64_linux_android: >-
${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
run: make codegen-rn
run: bash scripts/retry-command.sh make codegen-rn
- uses: actions/upload-artifact@v4
with:
name: rn-bindings
Expand Down Expand Up @@ -113,7 +129,7 @@ jobs:
set -euo pipefail
tmp="$(mktemp -d)"
archive="wasm-pack-${WASM_PACK_VERSION}-x86_64-unknown-linux-musl.tar.gz"
curl -fsSL \
bash scripts/retry-command.sh curl -fsSL \
"https://github.com/wasm-bindgen/wasm-pack/releases/download/${WASM_PACK_VERSION}/${archive}" \
-o "${tmp}/${archive}"
tar -xzf "${tmp}/${archive}" -C "${tmp}"
Expand All @@ -132,13 +148,18 @@ jobs:
flutter:
name: Flutter/Dart codegen
runs-on: ubuntu-latest
env:
FRB_CODEGEN_VERSION: 2.12.0
CARGO_EXPAND_VERSION: 1.0.123
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: dart-lang/setup-dart@v1
- name: Install flutter_rust_bridge_codegen
run: cargo install flutter_rust_bridge_codegen --version 2.12.0 --locked
- name: Install Flutter codegen cargo tools
run: |
bash scripts/install-cargo-tool.sh flutter_rust_bridge_codegen flutter_rust_bridge_codegen "$FRB_CODEGEN_VERSION"
bash scripts/install-cargo-tool.sh cargo-expand cargo-expand "$CARGO_EXPAND_VERSION"
- name: Codegen — Flutter/Dart
run: make codegen-flutter
- uses: actions/upload-artifact@v4
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ jobs:
- name: cargo test --locked --workspace
run: cargo test --locked --workspace

- name: Test cargo tool installer
run: bash tests/test-install-cargo-tool.sh

- name: Test command retry wrapper
run: bash tests/test-retry-command.sh

- name: Check CI workflow tool dependencies
run: python3 tests/check_ci_workflows.py

- name: cargo fmt --check
run: cargo fmt --check

Expand Down Expand Up @@ -122,7 +131,7 @@ jobs:
${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
RANLIB_aarch64_linux_android: >-
${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
run: make codegen-rn
run: bash scripts/retry-command.sh make codegen-rn
- name: Upload RN bindings (TypeScript + JSI)
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -168,7 +177,7 @@ jobs:
set -euo pipefail
tmp="$(mktemp -d)"
archive="wasm-pack-${WASM_PACK_VERSION}-x86_64-unknown-linux-musl.tar.gz"
curl -fsSL \
bash scripts/retry-command.sh curl -fsSL \
"https://github.com/wasm-bindgen/wasm-pack/releases/download/${WASM_PACK_VERSION}/${archive}" \
-o "${tmp}/${archive}"
tar -xzf "${tmp}/${archive}" -C "${tmp}"
Expand All @@ -190,13 +199,17 @@ jobs:
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.verify.outputs.version }}
FRB_CODEGEN_VERSION: 2.12.0
CARGO_EXPAND_VERSION: 1.0.123
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: dart-lang/setup-dart@v1
- name: Install flutter_rust_bridge_codegen
run: cargo install flutter_rust_bridge_codegen --version 2.12.0 --locked
- name: Install Flutter codegen cargo tools
run: |
bash scripts/install-cargo-tool.sh flutter_rust_bridge_codegen flutter_rust_bridge_codegen "$FRB_CODEGEN_VERSION"
bash scripts/install-cargo-tool.sh cargo-expand cargo-expand "$CARGO_EXPAND_VERSION"
- name: Codegen — Flutter/Dart
run: make codegen-flutter
- name: Stamp pub.dev version from tag
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exclude = [

[workspace.package]
edition = "2021"
version = "0.3.8"
version = "0.3.9"
license = "Apache-2.0"
rust-version = "1.96"
repository = "Edge-Native LLM SDK"
Expand All @@ -48,16 +48,16 @@ repository = "Edge-Native LLM SDK"
# This is the single source of truth for internal dep version requirements;
# member crates reference them with `{ workspace = true }` and add no inline
# version fields. `cargo set-version --workspace <ver>` updates every entry.
el-core = { path = "crates/el-core", version = "0.3.8" }
el-memory = { path = "crates/el-memory", version = "0.3.8" }
el-telemetry = { path = "crates/el-telemetry", version = "0.3.8" }
el-provenance = { path = "crates/el-provenance", version = "0.3.8" }
el-safety = { path = "crates/el-safety", version = "0.3.8" }
el-runtime = { path = "crates/el-runtime", version = "0.3.8" }
el-grammar = { path = "crates/el-grammar", version = "0.3.8" }
el-provenance-ed25519 = { path = "crates/adapters/el-provenance-ed25519", version = "0.3.8" }
el-engine-candle = { path = "crates/adapters/el-engine-candle", version = "0.3.8" }
el-cloud = { path = "crates/adapters/el-cloud", version = "0.3.8" }
el-core = { path = "crates/el-core", version = "0.3.9" }
el-memory = { path = "crates/el-memory", version = "0.3.9" }
el-telemetry = { path = "crates/el-telemetry", version = "0.3.9" }
el-provenance = { path = "crates/el-provenance", version = "0.3.9" }
el-safety = { path = "crates/el-safety", version = "0.3.9" }
el-runtime = { path = "crates/el-runtime", version = "0.3.9" }
el-grammar = { path = "crates/el-grammar", version = "0.3.9" }
el-provenance-ed25519 = { path = "crates/adapters/el-provenance-ed25519", version = "0.3.9" }
el-engine-candle = { path = "crates/adapters/el-engine-candle", version = "0.3.9" }
el-cloud = { path = "crates/adapters/el-cloud", version = "0.3.9" }

[profile.release]
opt-level = 3
Expand Down
50 changes: 50 additions & 0 deletions scripts/install-cargo-tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -euo pipefail

if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
echo "Usage: $0 <crate> <binary> [version]" >&2
exit 64
fi

crate="$1"
binary="$2"
version="${3:-}"
attempts="${CARGO_INSTALL_ATTEMPTS:-3}"
retry_seconds="${CARGO_INSTALL_RETRY_SECONDS:-15}"

installed_version_matches() {
command -v "$binary" >/dev/null 2>&1 || return 1

if [ -z "$version" ]; then
return 0
fi

"$binary" --version 2>/dev/null | grep -F -- "$version" >/dev/null
}

if installed_version_matches; then
"$binary" --version
exit 0
fi

for attempt in $(seq 1 "$attempts"); do
echo "Installing ${crate}${version:+ ${version}} (attempt ${attempt}/${attempts})..."

args=(install "$crate" --locked --force)
if [ -n "$version" ]; then
args=(install "$crate" --version "$version" --locked --force)
fi

if cargo "${args[@]}"; then
"$binary" --version
exit 0
fi

if [ "$attempt" -lt "$attempts" ]; then
echo "Retrying ${crate} install in ${retry_seconds}s..."
sleep "$retry_seconds"
fi
done

echo "ERROR: failed to install ${crate}${version:+ ${version}} after ${attempts} attempts" >&2
exit 1
32 changes: 32 additions & 0 deletions scripts/retry-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail

if [ "$#" -lt 1 ]; then
echo "Usage: $0 <command> [args...]" >&2
exit 64
fi

attempts="${COMMAND_ATTEMPTS:-3}"
retry_seconds="${COMMAND_RETRY_SECONDS:-15}"
status=0

for attempt in $(seq 1 "$attempts"); do
echo "Running command (attempt ${attempt}/${attempts}): $*"

set +e
"$@"
status="$?"
set -e

if [ "$status" -eq 0 ]; then
exit 0
fi

if [ "$attempt" -lt "$attempts" ]; then
echo "Command failed with status ${status}; retrying in ${retry_seconds}s..."
sleep "$retry_seconds"
fi
done

echo "ERROR: command failed after ${attempts} attempts: $*" >&2
exit "$status"
Loading
Loading