Files
radicle-explorer/.buildkite/explorer-rust.yml
T
Rūdolfs Ošiņš c516cfa9fa Prefix explorer CI with explorer-
Desktop's GitHub workflows are already prefixed `desktop-`. With both
projects in one repo, the prefix shows which project a workflow or
Buildkite step belongs to.
2026-10-13 17:23:20 +02:00

74 lines
2.7 KiB
YAML

# CI for the Rust workspace (crates/radicle-httpd, crates/radicle-search).
#
# Each step gets its own named cache volume. Clippy and test each produce a
# different target directory, and a shared volume would let whichever step
# commits last discard the other, forcing a near-full rebuild every build.
#
# These steps run on the agent rather than in a container, so ~-rooted cache
# paths work. The toolchain version is not pinned here: rustup reads
# ./rust-toolchain.
#
# Every step needs network access to seed.radicle.dev as well as crates.io — the
# workspace patches radicle-job to a git dependency served from a Radicle seed.
env:
CI: "true"
CARGO_TERM_COLOR: "always"
__defs:
install_rust: &install_rust |
export PATH="$$HOME/.cargo/bin:$$PATH"
export CARGO_TARGET_DIR="$$HOME/.cache/cargo-target"
if ! command -v rustup >/dev/null 2>&1; then
curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal
fi
rustc --version
# Only the parts of ~/.cargo that are expensive to fetch again. registry/src
# and git/checkouts are left out on purpose: cargo re-creates both from the
# cache and the git db, so caching them would double the size of the volume
# for no gain.
#
# Nothing prunes the target directory, so it keeps the artifacts of every
# dependency version the branch has ever built. Deleting the volume is the
# only cleanup, and it costs one full rebuild.
cargo_cache: &cargo_cache
- "~/.cargo/bin"
- "~/.cargo/registry/index"
- "~/.cargo/registry/cache"
- "~/.cargo/git/db"
- "~/.rustup"
- "~/.cache/cargo-target"
steps:
# RUSTFLAGS is set on the build only, not on the test run.
- label: "🦀 explorer test"
key: explorer-rust-test
timeout_in_minutes: 30
cache:
name: rust-test
paths: *cargo_cache
commands:
- *install_rust
- RUSTFLAGS="-D warnings" cargo build --workspace --all-features
- cargo test --workspace --all-features
- cargo test -p radicle-httpd
- label: "🦀 explorer lint"
key: explorer-rust-lint
timeout_in_minutes: 30
cache:
name: rust-lint
paths: *cargo_cache
commands:
- *install_rust
# The minimal profile ships neither, and rust-toolchain names no
# components. Only this step needs them.
- rustup component add rustfmt clippy
- RUSTFLAGS="-D warnings" cargo clippy --workspace --all-features --tests
# Run clippy with default features disabled (artifacts)
# TODO: If more features are added explore adding `cargo hack --feature-powerset`
# to cover every feature combination
- RUSTFLAGS="-D warnings" cargo clippy -p radicle-httpd --no-default-features --tests
- cargo fmt --all -- --check