Skip to content

Incremental engine for long horizon agents 🌟 Star if you like it!

ci: run the Rust SDK checks daily, not on pull requests (#2737)

Jiangzhouc5829423cd28
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index bed54e17..06b89ee2 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -51,7 +51,6 @@ jobs:
full: ${{ steps.mode.outputs.full }}
build-test: ${{ steps.filter.outputs.build-test }}
type-check: ${{ steps.filter.outputs.type-check }}
- rust-sdk: ${{ steps.filter.outputs.rust-sdk }}
steps:
# Pushes and merge groups are diffed with git; a pull request through
# the API.
@@ -73,10 +72,9 @@ jobs:
id: filter
with:
# Each list covers every input of the hooks its job runs, so no
- # change skips a check that applies to it. The exception is
- # rust-sdk: the Rust SDK isn't launched yet, so a change to the
- # code it builds on (rust/core, Cargo.lock, ...) skips its checks,
- # and rust_sdk_daily.yml runs them on main every day.
+ # change skips a check that applies to it. The Rust SDK's own hooks
+ # aren't in any job here: rust_sdk_daily.yml runs them on main every
+ # day.
filters: |
build-test:
- 'rust/**'
@@ -96,14 +94,6 @@ jobs:
- 'uv.lock'
- '.github/workflows/CI.yml'
- '.github/workflows/e2e_type_check.yml'
- rust-sdk:
- - 'rust/sdk/**'
- - 'rust/cli/**'
- - 'examples/rust/**'
- - 'benchmarks/*/rust/**'
- - '.github/workflows/CI.yml'
- - '.github/workflows/_rust_sdk.yml'
- - '.github/actions/**'
build-test:
name: Build & Test
@@ -117,23 +107,13 @@ jobs:
if: needs.changes.outputs.full == 'true' && needs.changes.outputs.type-check != 'false'
uses: ./.github/workflows/e2e_type_check.yml
- rust-sdk:
- name: Rust SDK
- needs: changes
- # The nightly run leaves the Rust SDK to rust_sdk_daily.yml.
- if: >-
- needs.changes.outputs.full == 'true'
- && needs.changes.outputs.rust-sdk != 'false'
- && github.event_name != 'schedule'
- uses: ./.github/workflows/_rust_sdk.yml
-
# Passes when every job above passed, or was skipped by the tier or because
# the change doesn't touch its inputs. Fails on a failed or cancelled job,
# and when `changes` itself didn't succeed (its skipped dependents would
# otherwise look like a pass).
ci-gate:
if: always() && github.event.pull_request.draft != true
- needs: [changes, build-test, type-check, rust-sdk]
+ needs: [changes, build-test, type-check]
runs-on: ubuntu-latest
steps:
- env:
diff --git a/.github/workflows/_rust_sdk.yml b/.github/workflows/_rust_sdk.yml
deleted file mode 100644
index b8f7f247..00000000
--- a/.github/workflows/_rust_sdk.yml
+++ /dev/null
@@ -1,80 +0,0 @@
-name: Rust SDK (INTERNAL)
-
-on:
- workflow_call:
-
-permissions:
- contents: read
-
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- # The Rust SDK's hooks: its tests under the optional features that need no
- # external server, its clippy, and the `cargo check` of the external example
- # and benchmark workspaces that build on it. CI.yml runs them for a change
- # to the SDK or to those workspaces, and rust_sdk_daily.yml on main every
- # day. The SDK doesn't depend on pyo3, so no leg needs Python.
- #
- # Clippy and the external-workspace check run on Linux x86_64 only. The
- # lints are the same on every platform bar a few `cfg(not(unix))` lines,
- # and the external check costs 13-28 min on a cold Rust cache (every leg
- # is cold after a rustc release), which pushed the macOS Intel and Windows
- # legs past `timeout-minutes` when it ran there. The SDK tests skip macOS
- # Intel, the slowest runner: x86_64 is covered by Linux and Darwin by the
- # arm64 leg.
- rust-sdk:
- # The default name would list the matrix's hook list.
- name: rust-sdk (${{ matrix.platform.runner }})
- strategy:
- # A failing leg cancels the rest on a PR or in the merge queue, to stop
- # a broken change early. A scheduled run reports every leg.
- fail-fast: ${{ contains(fromJSON('["pull_request", "merge_group"]'), github.event_name) }}
- matrix:
- platform:
- - runner: ubuntu-latest
- hooks: cargo-test-sdk cargo-clippy-sdk cargo-test-rust-externs
- - runner: ubuntu-24.04-arm
- hooks: cargo-test-sdk
- - runner: macos-latest
- extra_rustflags: "-C split-debuginfo=off"
- hooks: cargo-test-sdk
- - runner: windows-latest
- hooks: cargo-test-sdk
- runs-on: ${{ matrix.platform.runner }}
- timeout-minutes: 60
- env:
- RUSTFLAGS: "-C debuginfo=0 ${{ matrix.platform.extra_rustflags }}"
- CARGO_INCREMENTAL: "0"
- RUSTC_WRAPPER: "sccache"
-
- steps:
- # Before checkout, which writes the files with the line endings this sets.
- - name: Disable Git autocrlf on Windows
- if: runner.os == 'Windows'
- shell: bash
- run: git config --global core.autocrlf false
-
- - uses: actions/checkout@v7
- with:
- fetch-depth: 1
-
- - uses: ./.github/actions/setup-ci
- with:
- rust-cache-key: rust-sdk-${{ matrix.platform.runner }}
- # Peak use on a 14 GiB runner, measured when these hooks ran in
- # `_test.yml` together with the workspace's clippy: about 18 GiB
- # (`target/` is 16 GiB), plus 2.7 GiB when it saves a missed Rust
- # cache.
- min-free-disk-gib: 30
- clippy: ${{ contains(matrix.platform.hooks, 'cargo-clippy-sdk') }}
-
- - name: Run Rust SDK hooks
- uses: ./.github/actions/run-prek
- with:
- hooks: ${{ matrix.platform.hooks }}
-
- # Last, so it sees every object the job's hooks compiled.
- - name: Save sccache's local cache
- if: ${{ !cancelled() }}
- uses: ./.github/actions/save-sccache
diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml
index e2013f38..cf5ef5ac 100644
--- a/.github/workflows/_test.yml
+++ b/.github/workflows/_test.yml
@@ -78,7 +78,7 @@ jobs:
# mypy-check runs in the e2e_type_check workflow, and
# update-rust-extern-locks in the fast_check one. cargo-clippy and
# cargo-tree-sdk-no-pyo3 run in `rust-checks`. The rest are the
- # Rust SDK hooks, which `_rust_sdk.yml` runs.
+ # Rust SDK hooks, which `rust_sdk_daily.yml` runs.
skip: mypy-check,update-rust-extern-locks,cargo-clippy,cargo-tree-sdk-no-pyo3,cargo-test-sdk,cargo-clippy-sdk,cargo-test-rust-externs
# Last, so it sees every object the job's hooks compiled.
@@ -91,7 +91,7 @@ jobs:
# Rust SDK doesn't depend on pyo3. Linux x86_64 covers every platform for
# both: the lints are the same on every platform bar a few
# `cfg(not(unix))` lines, and the pyo3 check reads the dependencies of
- # every platform. The Rust SDK's own hooks run in `_rust_sdk.yml`.
+ # every platform. The Rust SDK's own hooks run in `rust_sdk_daily.yml`.
rust-checks:
runs-on: ubuntu-latest
timeout-minutes: 60
diff --git a/.github/workflows/rust_sdk_daily.yml b/.github/workflows/rust_sdk_daily.yml
index 55a3e47c..60a2f5e2 100644
--- a/.github/workflows/rust_sdk_daily.yml
+++ b/.github/workflows/rust_sdk_daily.yml
@@ -1,9 +1,10 @@
name: Rust SDK Daily
-# The Rust SDK isn't launched yet, so CI runs its checks only for a change to
-# the SDK or to the Rust examples and benchmarks that build on it. This runs
-# them on main every day, to catch a change elsewhere (rust/core, a
-# dependency bump, ...) that breaks the SDK, and files an issue when they fail.
+# The Rust SDK isn't launched yet and its checks are slow, so CI runs them on
+# no pull request and in no merge group, even for a change to the SDK: the
+# local hooks are the check before a change lands. This runs them on main every
+# day, to catch whatever broke the SDK, and files an issue when they fail.
+# `gh workflow run rust_sdk_daily.yml --ref <branch>` runs them on a branch.
on:
schedule:
# An hour after CI's nightly run, so the two don't compete for runners.
@@ -13,10 +14,76 @@ on:
permissions:
contents: read
+env:
+ CARGO_TERM_COLOR: always
+
jobs:
+ # The Rust SDK's hooks: its tests under the optional features that need no
+ # external server, its clippy, and the `cargo check` of the external example
+ # and benchmark workspaces that build on it. The SDK doesn't depend on pyo3,
+ # so no leg needs Python.
+ #
+ # Clippy and the external-workspace check run on Linux x86_64 only. The
+ # lints are the same on every platform bar a few `cfg(not(unix))` lines,
+ # and the external check costs 13-28 min on a cold Rust cache (every leg
+ # is cold after a rustc release), which pushed the macOS Intel and Windows
+ # legs past `timeout-minutes` when it ran there. The SDK tests skip macOS
+ # Intel, the slowest runner: x86_64 is covered by Linux and Darwin by the
+ # arm64 leg.
rust-sdk:
- name: Rust SDK
- uses: ./.github/workflows/_rust_sdk.yml
+ # The default name would list the matrix's hook list.
+ name: rust-sdk (${{ matrix.platform.runner }})
+ strategy:
+ # Report every leg, not only the first to fail.
+ fail-fast: false
+ matrix:
+ platform:
+ - runner: ubuntu-latest
+ hooks: cargo-test-sdk cargo-clippy-sdk cargo-test-rust-externs
+ - runner: ubuntu-24.04-arm
+ hooks: cargo-test-sdk
+ - runner: macos-latest
+ extra_rustflags: "-C split-debuginfo=off"
+ hooks: cargo-test-sdk
+ - runner: windows-latest
+ hooks: cargo-test-sdk
+ runs-on: ${{ matrix.platform.runner }}
+ timeout-minutes: 60
+ env:
+ RUSTFLAGS: "-C debuginfo=0 ${{ matrix.platform.extra_rustflags }}"
+ CARGO_INCREMENTAL: "0"
+ RUSTC_WRAPPER: "sccache"
+
+ steps:
+ # Before checkout, which writes the files with the line endings this sets.
+ - name: Disable Git autocrlf on Windows
+ if: runner.os == 'Windows'
+ shell: bash
+ run: git config --global core.autocrlf false
+
+ - uses: actions/checkout@v7
+ with:
+ fetch-depth: 1
+
+ - uses: ./.github/actions/setup-ci
+ with:
+ rust-cache-key: rust-sdk-${{ matrix.platform.runner }}
+ # Peak use on a 14 GiB runner, measured when these hooks ran in
+ # `_test.yml` together with the workspace's clippy: about 18 GiB
+ # (`target/` is 16 GiB), plus 2.7 GiB when it saves a missed Rust
+ # cache.
+ min-free-disk-gib: 30
+ clippy: ${{ contains(matrix.platform.hooks, 'cargo-clippy-sdk') }}
+
+ - name: Run Rust SDK hooks
+ uses: ./.github/actions/run-prek
+ with:
+ hooks: ${{ matrix.platform.hooks }}
+
+ # Last, so it sees every object the job's hooks compiled.
+ - name: Save sccache's local cache
+ if: ${{ !cancelled() }}
+ uses: ./.github/actions/save-sccache
# Files an issue when a run on main fails, or comments on the issue if one
# is still open. A leg that runs past its timeout counts as a failure; a
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0e6b3bb0..069a6d5c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -94,7 +94,9 @@ repos:
# SDK itself, to the `cocoindex` CLI for Rust projects (rust/cli) and
# to the Rust examples and benchmarks that build on the SDK.
# A change to the code the SDK builds on (rust/core, Cargo.lock, ...)
- # skips them; the daily Rust SDK workflow runs them on all of main.
+ # skips them. CI runs them on no pull request and in no merge group,
+ # so a local run is the check before a change lands; the daily Rust SDK
+ # workflow runs them on all of main.
- id: cargo-test-sdk
name: cargo test (Rust SDK)
entry: ./dev/run_cargo_test_sdk.sh
diff --git a/AGENTS.md b/AGENTS.md
index 2263945e..0fb25575 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -33,15 +33,16 @@ uv tool install prek # one-time; some hooks also need `p
prek run ruff-check ruff-format --all-files # Lint (applying safe fixes), then format Python code (same as CI)
cargo fmt # Format Rust code
./dev/run_cargo_clippy.sh # Lint Rust code other than the Rust SDK and its CLI (same as CI)
-./dev/run_cargo_clippy_sdk.sh # Lint the Rust SDK and its CLI, `rust/cli` (same as CI)
+./dev/run_cargo_clippy_sdk.sh # Lint the Rust SDK and its CLI, `rust/cli` (same as the daily CI)
```
### Pre-submission Checks
-CI enforces the full pre-commit hook suite from `.pre-commit-config.yaml`, which
-covers more than the commands above β€” notably regenerating the CLI docs
-(`docs/src/content/docs/cli.mdx`) whenever `cli.py` changes. Before pushing, run
-the hooks whose inputs your branch changed, as PR CI does:
+CI enforces the pre-commit hook suite from `.pre-commit-config.yaml`, which covers
+more than the commands above β€” notably regenerating the CLI docs
+(`docs/src/content/docs/cli.mdx`) whenever `cli.py` changes. The Rust SDK hooks,
+described below, are the exception. Before pushing, run the hooks whose inputs
+your branch changed, as PR CI does:
```bash
prek run --from-ref origin/main --to-ref HEAD
@@ -51,8 +52,11 @@ prek run --from-ref origin/main --to-ref HEAD
(`cargo-test-sdk`, `cargo-clippy-sdk`, `cargo-test-rust-externs`) included. The
Rust SDK isn't launched yet, so those hooks run only for a change under
`rust/sdk/`, `rust/cli/`, `examples/rust/` or `benchmarks/*/rust/`, not for a change to the
-code the SDK builds on. The `Rust SDK Daily` workflow runs them on `main` every
-day and files an issue when they fail.
+code the SDK builds on. CI runs them on no pull request and in no merge group,
+even for a change to the SDK, because they are slow, so the local run is the only
+check before such a change lands. The `Rust SDK Daily` workflow runs them on
+`main` every day and files an issue when they fail;
+`gh workflow run rust_sdk_daily.yml --ref <branch>` runs them on a branch.
### Pull Requests and CI
diff --git a/dev/run_cargo_test_rust_externs.sh b/dev/run_cargo_test_rust_externs.sh
index c6abc19e..605a2074 100755
--- a/dev/run_cargo_test_rust_externs.sh
+++ b/dev/run_cargo_test_rust_externs.sh
@@ -5,8 +5,8 @@
# workspaces (each has its own [workspace] in Cargo.toml) so they mimic
# downstream user projects.
#
-# Why `cargo check` and not `cargo test`: the goal on every PR is to catch SDK
-# API breakage in the examples, which type-checking already does. Full
+# Why `cargo check` and not `cargo test`: the goal is to catch SDK API
+# breakage in the examples, which type-checking already does. Full
# build+test of the examples is far heavier (codegen, linking, running) and is
# left to a scheduled/nightly job. With ~30 example crates each pulling a large,
# distinct dependency tree (surrealdb, arrow/lancedb, candle, aws-sdk, …),