1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: CI
on:
push:
branches:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Install Rust toolchain
# installs the channel pinned in rust-toolchain.toml (the crate's MSRV)
run: rustup show && rustup component add rustfmt
- run: cargo fmt --all --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Install protoc
# lance-encoding (via lancedb) runs a build script that needs protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install Rust toolchain
run: rustup show && rustup component add clippy
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Clippy
run: cargo clippy --locked --all-targets --all-features -- -D warnings
build-test-matrix:
name: build & test (${{ matrix.os }})
# Unix only: the crate is unix-only (libc path handling won't compile on
# Windows — tracked in #48).
strategy:
fail-fast: false
matrix:
os:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Install protoc
# cross-platform protoc (apt-get is Linux-only); lancedb needs it
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Cache Hugging Face tokenizer downloads
# DaemonState::open hard-loads the HF tokenizer (chunking needs it
# regardless of embedding mode), so non-ignored tests fetch it from
# huggingface.co on a cold cache. Persist the hub cache across runs so
# the tokenizer is downloaded at most once per key.
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/huggingface
key: hf-hub-${{ runner.os }}-arctic-embed-s
- name: Build
run: cargo build --locked --all-targets
- name: Warm tokenizer cache
# Fetch the tokenizer once, serially, with backoff. Without this the
# parallel test threads each call huggingface.co at startup and trip
# its rate limiter (HTTP 429) — the failure that reddened the ubuntu leg.
run: |
set -euo pipefail
printf '[embeddings]\nenabled = false\n' > "${RUNNER_TEMP}/hf-warm.toml"
for attempt in 1 2 3 4 5; do
if cargo run --locked --quiet -- config download --config "${RUNNER_TEMP}/hf-warm.toml"; then
exit 0
fi
echo "tokenizer warm attempt ${attempt} failed; retrying after backoff"
sleep $(( attempt * 20 ))
done
echo "::error::could not warm the tokenizer cache after 5 attempts"
exit 1
- name: Test
# Offline so the warmed cache is served locally and the parallel test
# burst makes zero network calls. Safe: every model-downloading test is
# #[ignore]-gated and is not run here.
env:
HF_HUB_OFFLINE: "1"
run: cargo test --locked
# Aggregation gate: the branch ruleset requires a single status check named
# "build & test", but the matrix expands to "build & test (ubuntu-latest)" etc.
# This job collapses the matrix into one required context and fails unless
# every matrix leg succeeded — so the required check stays stable when the
# matrix gains or loses an OS.
build-test:
name: build & test
needs: build-test-matrix
if: always()
runs-on: ubuntu-latest
steps:
- name: Require all matrix legs to pass
if: needs.build-test-matrix.result != 'success'
run: exit 1