ci: add cargo fmt + clippy + test workflow#7
Merged
Conversation
jsonic has 118 inline unit tests across the protocol crate (61 + 57) but no CI to gate them. Every PR has relied on the author running cargo test locally; a regression would only be caught at the next manual run. Adds .github/workflows/ci.yml with three jobs: - cargo fmt --all -- --check - cargo clippy --all-targets (no -D warnings — see below) - cargo test --all-targets clippy and test both `needs: fmt` so a fmt drift fails the cheap job rather than four expensive ones. Drive-by hygiene fixes so the first run is green: - cargo fmt applied (whitespace only). - src/core/reputation.rs: doc comment list-item continuation lines re-indented to satisfy clippy::doc_overindented_list_items. - src/core/crypto.rs: replaced `&[h.clone()]` with `std::slice::from_ref(&h)` per clippy::cloned_ref_to_slice_refs (behaviour-equivalent — merkle_root only reads the slice). About the missing `-D warnings`: jsonic-demo (the bin target) carries 26 pre-existing dead_code + naming-convention warnings (unused trait/struct/method names, capitalised acronym `DAO`). Cleaning those up should be a deliberate backlog burn-down, not piggybacked onto the CI-wiring PR. Tighten clippy to `-D warnings` once that backlog is resolved. Verified locally: 118 tests pass, fmt clean, clippy succeeds at default warning level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jsonic has 118 inline unit tests (61 + 57 across the protocol crates) but no CI to gate them. Every PR has relied on the author running `cargo test` locally.
This wires the three standard cargo gates plus the drive-by fixes needed for the first CI run to be green. `-D warnings` is intentionally NOT enforced on clippy — see below.
What landed
`.github/workflows/ci.yml` — three jobs: `cargo fmt --all -- --check`, `cargo clippy --all-targets` (no `-D warnings`), `cargo test --all-targets`. `clippy`/`test` `needs: fmt`. Toolchain stable; cache via `Swatinem/rust-cache@v2`.
Drive-by hygiene so the first run is green:
About the missing
-D warnings`jsonic-demo` (the bin target) carries 26 pre-existing dead_code + naming-convention warnings (unused trait / struct / method names, capitalised acronym `DAO`). Cleaning those up should be a deliberate backlog burn-down, not piggybacked onto the CI-wiring PR. Tighten clippy to `-D warnings` once that backlog is resolved.
Verification
Test plan