Skip to content

chore: full regen #1935

chore: full regen

chore: full regen #1935

Workflow file for this run

name: CI Rust
on:
push:
branches: [main]
paths:
- "crates/**"
- "packages/dart/rust/**"
- "packages/swift/rust/**"
- "packages/elixir/native/**"
- "packages/ruby/ext/xberg_rb/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".github/workflows/ci-rust.yaml"
- "scripts/ci/rust/**"
pull_request:
branches: [main]
paths:
- "crates/**"
- "packages/dart/rust/**"
- "packages/swift/rust/**"
- "packages/elixir/native/**"
- "packages/ruby/ext/xberg_rb/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".github/workflows/ci-rust.yaml"
- "scripts/ci/rust/**"
workflow_dispatch:
concurrency:
group: ci-rust-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
RUST_BACKTRACE: short
RUST_MIN_STACK: 16777216
ORT_VERSION: "1.24.2"
MACOSX_DEPLOYMENT_TARGET: "14.0"
BUILD_PROFILE: "ci"
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
permissions:
contents: read
jobs:
rust:
name: Rust (${{ matrix.os }})
if: github.repository == 'xberg-io/xberg' && github.actor != 'dependabot[bot]'
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04-arm
- os: macos-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Free disk space
if: runner.os == 'Linux'
uses: xberg-io/actions/free-disk-space-linux@v1
with:
show-initial: "false"
show-final: "true"
- name: Setup Rust
uses: xberg-io/actions/setup-rust@v1
with:
cache-key-prefix: rust-${{ matrix.os }}
use-sccache: "true"
- name: Install system dependencies
uses: ./.github/actions/install-system-deps
- name: Setup ONNX Runtime
uses: ./.github/actions/setup-onnx-runtime
with:
ort-version: ${{ env.ORT_VERSION }}
- name: Setup Tesseract cache
uses: ./.github/actions/setup-tesseract-cache
with:
label: ${{ matrix.os }}
- name: Install Task
uses: xberg-io/actions/install-task@v1
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
shell: bash
- name: Run tests
run: task rust:test:ci
shell: bash
env:
LD_LIBRARY_PATH: ${{ env.LD_LIBRARY_PATH || '' }}
DYLD_LIBRARY_PATH: ${{ env.DYLD_LIBRARY_PATH || '' }}
DYLD_FALLBACK_LIBRARY_PATH: ${{ env.DYLD_FALLBACK_LIBRARY_PATH || '' }}
- name: Check no-default-features
run: cargo check --locked -p xberg --no-default-features
shell: bash
- name: Check ocr-wasm backend
run: cargo check --locked -p xberg --no-default-features --features ocr-wasm --lib
shell: bash
live-hf:
name: Live HF preset tests
if: github.repository == 'xberg-io/xberg' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-24.04-arm
timeout-minutes: 45
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Free disk space
uses: xberg-io/actions/free-disk-space-linux@v1
with:
show-initial: "false"
show-final: "true"
- name: Setup Rust
uses: xberg-io/actions/setup-rust@v1
with:
cache-key-prefix: rust-live-hf
use-sccache: "true"
- name: Install system dependencies
uses: ./.github/actions/install-system-deps
- name: Setup ONNX Runtime
uses: ./.github/actions/setup-onnx-runtime
with:
ort-version: ${{ env.ORT_VERSION }}
- name: Cache HuggingFace fastembed models
uses: ./.github/actions/cache-hf-fastembed
with:
cache-key-suffix: retrieval-presets
- name: Run live HF retrieval preset tests
run: |
# Live tests download real ONNX models from HuggingFace. HF can be slow or briefly
# unreachable, tripping the model-download watchdog. Give the watchdog generous headroom
# (well within the 45-min job budget) and retry the whole run so a transient HF hiccup
# self-heals -- models already fetched persist in the runner's HF cache across attempts,
# so a retry only re-downloads whatever failed and re-runs the (fast) test logic.
# Same 3-attempt / exponential-backoff shape as the setup-*-models download actions.
for attempt in 1 2 3; do
if [ $attempt -gt 1 ]; then
backoff=$((15 * 3 ** (attempt - 2)))
echo "::warning::live HF preset tests failed; retry attempt $attempt/3 after ${backoff}s backoff..."
sleep $backoff
fi
if cargo test --locked \
-p xberg \
--features "reranker,reranker-presets,embeddings,sparse-embeddings,late-interaction,tokio-runtime" \
--test reranker_live \
--test embedding_preset_live \
--test sparse_embedding_preset_live \
--test late_interaction_preset_live \
-- --nocapture; then
exit 0
fi
done
echo "::error::live HF preset tests failed after 3 attempts"
exit 1
shell: bash
env:
LD_LIBRARY_PATH: ${{ env.LD_LIBRARY_PATH || '' }}
DYLD_LIBRARY_PATH: ${{ env.DYLD_LIBRARY_PATH || '' }}
DYLD_FALLBACK_LIBRARY_PATH: ${{ env.DYLD_FALLBACK_LIBRARY_PATH || '' }}
RUST_LOG: warn
# Cold downloads of large ONNX models on a slow HF day exceed the 300s production default;
# raise the watchdog for CI only (still bounded well under the 45-min job timeout).
XBERG_MODEL_DOWNLOAD_TIMEOUT_SECS: "900"