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
name: Rust Examples
# Runs every example under `examples/` to catch regressions that the unit/
# integration test suite doesn't surface (CLI plumbing, demo dual-write
# patterns, multi-backend storage paths). No path filter — examples are a
# user-facing contract and any PR that breaks them should fail this gate.
on:
pull_request:
types:
push:
branches:
- main
jobs:
examples:
name: Run examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Cargo.lock is up to date
run: cargo check --locked
# librocksdb-sys (pulled in by the `rocksdb_storage` feature, which the
# `storage` example needs) requires clang for bindgen and a C++ toolchain
# to compile RocksDB itself.
- name: Install clang + C++ toolchain for librocksdb-sys
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang g++ libc6-dev
# Examples that touch GitVersionedKvStore / GitNamespacedKvStore run
# `git init` against temp dirs and need a configured identity.
- name: Configure git identity
run: |
git config --global user.name "CI Examples"
git config --global user.email "ci-examples@example.com"
git config --global init.defaultBranch main
# Build every example once with the union feature set; each example's
# `required-features` is satisfied as long as it is a subset.
- name: Build all examples
run: |
cargo build --locked --examples \
--features "git sql proximity rocksdb_storage" --verbose
# Run each example by name. Fail fast (`set -e`) so the first failure
# surfaces immediately in the PR check.
- name: Run examples
run: |
set -e
cargo run --locked --example proof
cargo run --locked --example sql --features sql
cargo run --locked --example versioning
cargo run --locked --example worktree --features "git sql"
cargo run --locked --example storage --features rocksdb_storage
cargo run --locked --example namespaced --features git
cargo run --locked --example text_index --features "git proximity"