mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
- Add twemoji as npm dependency instead of build download - Package build assets with a Vite plugin instead of scripts - Keep the eslint and prettier caches in one directory
80 lines
2.6 KiB
YAML
80 lines
2.6 KiB
YAML
# CI for the Rust workspace (crates/radicle-httpd, crates/radicle-search).
|
|
#
|
|
# Each step gets its own named cache volume. Clippy, test, and doc each produce a
|
|
# different target directory, and a shared volume would let whichever step
|
|
# commits last discard the other two, 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: "🦀 test"
|
|
key: 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: "📚 doc"
|
|
key: doc
|
|
timeout_in_minutes: 30
|
|
cache:
|
|
name: rust-doc
|
|
paths: *cargo_cache
|
|
commands:
|
|
- *install_rust
|
|
- RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features
|
|
|
|
- label: "🦀 lint"
|
|
key: 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
|
|
- cargo fmt --all -- --check
|