81 lines
3.5 KiB
Markdown
81 lines
3.5 KiB
Markdown
# Development and CI
|
|
|
|
This page documents contributor and CI workflows for [`rping`](../README.md). Run all commands from the repository root.
|
|
|
|
## Toolchains and dependencies
|
|
|
|
The project declares Rust 1.70 as its minimum supported Rust version (MSRV). Jenkins checks all targets with Rust 1.70.0 and the locked dependency graph. The lockfile uses format version 3 so Cargo 1.70 can read it.
|
|
|
|
The tracked `rust-toolchain.toml` pins Rust 1.98.1 with `rustfmt`, Clippy, and LLVM tools for normal development and coverage. Install the MSRV toolchain separately before running its check:
|
|
|
|
```sh
|
|
rustup toolchain install 1.70.0 --profile minimal
|
|
```
|
|
|
|
The project has four direct runtime dependencies. `clap` is constrained to the Rust-1.70-compatible 4.4 line, and `rand` uses the mature 0.8 line. CI uses locked dependency resolution.
|
|
|
|
There is no `no_std` feature. This is an operating-system CLI whose main path uses sockets, DNS resolution, files, clocks, threads, heap allocation, terminal output, and operating-system randomness. A useful `no_std` API would require designing a separate packet-construction library rather than feature-gating the application.
|
|
|
|
## Quality gates
|
|
|
|
Run the same checks used by CI:
|
|
|
|
```sh
|
|
cargo fmt --all -- --check
|
|
cargo check --locked --all-targets --all-features
|
|
cargo +1.70.0 check --locked --all-targets --all-features
|
|
cargo test --locked --all-targets --all-features
|
|
cargo clippy --locked --all-targets --all-features -- -D warnings
|
|
cargo build --locked --release --all-features
|
|
cargo doc --locked --all-features --no-deps
|
|
```
|
|
|
|
Tests do not require network access. CI intentionally does not run live probes because worker permissions for ICMP sockets are not assumed.
|
|
|
|
## Coverage
|
|
|
|
CI pins `cargo-llvm-cov` 0.9.0 and enforces a 40% line-coverage floor without excluding production code. Run the exact coverage gate locally with:
|
|
|
|
```sh
|
|
cargo llvm-cov \
|
|
--locked \
|
|
--all-features \
|
|
--all-targets \
|
|
--json \
|
|
--summary-only \
|
|
--output-path coverage/coverage-summary.json \
|
|
--fail-under-lines 40
|
|
```
|
|
|
|
`coverage/coverage-summary.json` is temporary. CI validates its overall line percentage, renders the coverage badge, and removes the summary.
|
|
|
|
## CI badges
|
|
|
|
The authoritative version comes from `Cargo.toml` through `cargo metadata`. Jenkins records successful tests and coverage with build-specific markers, then generates version, test, and coverage badges from cleanup so failed builds cannot leave stale passing results.
|
|
|
|
Jenkins validates and archives exactly these ignored files with fingerprints:
|
|
|
|
```text
|
|
coverage/version.svg
|
|
coverage/test.svg
|
|
coverage/coverage.svg
|
|
```
|
|
|
|
In a Jenkins multibranch job, `BRANCH_NAME` restricts publication to the `main` branch. The publisher atomically copies badges to:
|
|
|
|
```text
|
|
/mnt/assets/coverage/Archive/rping/main/
|
|
```
|
|
|
|
The intended public URLs are:
|
|
|
|
```text
|
|
https://assets.dandaedre.com/coverage/Archive/rping/main/version.svg
|
|
https://assets.dandaedre.com/coverage/Archive/rping/main/test.svg
|
|
https://assets.dandaedre.com/coverage/Archive/rping/main/coverage.svg
|
|
```
|
|
|
|
These URLs must not be presented as live status badges until a successful default-branch Jenkins build has published them and each response has been verified as SVG XML. The asset server should mount the publication directory read-only, disable directory listings, use a restrictive content security policy for SVG, and revalidate mutable badge URLs or give them a short cache lifetime.
|
|
|
|
The generic renderer in `scripts/ci-coverage-badges.sh` was copied from the `agent-tasks` source at revision `fb9d8f7d16f100c2d1377f23394a2302eac9ab18`.
|