ci(rust): add cargo build/test/clippy/fmt/doc workflow#12
Merged
Conversation
Pre-existing rustfmt drift across 38 files (+440/-209 lines) — multi-line parameter lists collapsed where they fit on one line, long chained method calls reflowed, etc. No semantic changes; verified with: * cargo test --all-features → 177 tests pass * cargo clippy --all-features --all-targets -- -D warnings → clean Done in its own commit so the upcoming rust-ci workflow can enable `cargo fmt --all -- --check` as a blocking gate from day one, and so `git blame` on reformatted lines points here instead of a CI-config commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds .github/workflows/rust-ci.yml covering the gap surfaced when PR #11 merged with only the CLA check (no Rust verification on GitHub). Triggers: push to main, pull_request to main, manual dispatch. Path-filtered so changes to .straymark/, governance .md files, or auxiliary tooling do not spin up Rust compilation. Concurrency group cancels in-progress runs on the same ref to avoid wasted runner minutes during PR iteration. Jobs: * test (matrix: ubuntu-latest, macos-latest, windows-latest) — runs `cargo build --all-features` then `cargo test --all-features`. fail-fast is disabled so a Windows-only regression does not mask a macOS failure. * build-minimal (ubuntu) — `cargo build --no-default-features` to catch code that implicitly depends on a language feature being enabled. * clippy (ubuntu) — `cargo clippy --all-features --all-targets -- -D warnings`. * fmt (ubuntu) — `cargo fmt --all -- --check`. The preceding commit reformatted the codebase so this gate is satisfiable from day one. * doc (ubuntu) — `cargo doc --all-features --no-deps` with `RUSTDOCFLAGS=-D warnings` so broken intra-doc links fail the build. Important because the crate is published to crates.io and docs.rs will re-run this against the published version. All jobs use actions/checkout@v5, dtolnay/rust-toolchain@stable, and Swatinem/rust-cache@v2 (separate cache keys per job to avoid contention). Verified locally before commit: * cargo build --no-default-features → ok (emits 2 unused-variable warnings in src/languages/mod.rs:170 when all language gates are off; non-fatal, follow-up in a separate PR) * cargo build --all-features → ok * cargo test --all-features → 177 tests pass * cargo clippy --all-features --all-targets -- -D warnings → clean * cargo fmt --all -- --check → clean (after the preceding commit) * RUSTDOCFLAGS=-D warnings cargo doc --all-features --no-deps → ok Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e3fadeb to
d43871d
Compare
The CI's `cargo test --all-features` runs in the dev (debug) profile. On shared GitHub-hosted ubuntu and windows runners, the `large_file_analysis_under_100ms` median for the 1000-line fixture exceeds 100ms in debug — not because of a real regression, but because debug builds are 5-10× slower than release and shared VMs add variance. macOS runners (M-class arm) happen to be fast enough and were passing. The 100ms target in SC-002 is a release-profile guarantee. Marking the test `#[cfg_attr(debug_assertions, ignore = "...")]` keeps it gated on release runs, where its assertion is meaningful: * `cargo test --release` → runs, passes in ~0.2s locally * `cargo test` (debug) → ignored with explanatory message Verified: * `cargo test --test performance_bench --all-features` → 0 passed, 1 ignored * `cargo test --release --test performance_bench --all-features` → 1 passed * `cargo fmt --all -- --check` → clean Follow-up candidate: add a separate `cargo test --release --test performance_bench` job to the CI matrix to retain release-profile coverage without doubling overall PR time. Not in this PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Adds
.github/workflows/rust-ci.ymlto close the gap surfaced after PR #11 merged with only the CLA check running — no Rust verification on GitHub at all. Locally I rancargo test,cargo clippy, etc., but none of that was recorded in the PR status. For a library published to crates.io this was a weak link.Two commits, intentionally split:
style: apply cargo fmt --all— pre-existing rustfmt drift across 38 files (+440/-209). No semantic changes. Done in its own commit so the upcoming fmt gate can land green from day one, and sogit blameon reformatted lines points to a style commit instead of a CI-config commit.ci(rust): add cargo build/test/clippy/fmt/doc workflow— the new workflow itself (+124 lines).Workflow design
Triggers: push to
main, pull_request tomain, manualworkflow_dispatch. Path-filtered to**/*.rs,Cargo.toml,Cargo.lock,README.md(embedded insrc/lib.rsvia#![doc = include_str!]), and the workflow file itself. Changes under.straymark/,CLAUDE.md,STRAYMARK.md, etc. do not trigger Rust CI.Concurrency: cancels in-progress runs on the same ref to save runner minutes during PR iteration.
Jobs:
test(matrix)cargo build --all-features+cargo test --all-features.fail-fast: falseso a Windows-only regression doesn't mask macOS failures.build-minimalcargo build --no-default-featuresto catch code that implicitly depends on a language feature.clippycargo clippy --all-features --all-targets -- -D warningsfmtcargo fmt --all -- --check(blocking)doccargo doc --all-features --no-depswithRUSTDOCFLAGS=-D warnings. Important: docs.rs will re-run this against the published crate; if it fails here it'll fail there.All jobs cache via
Swatinem/rust-cache@v2with separate keys per job.On using
ubuntu-latestfor LinuxFor pure Rust code (or Rust + C deps compiled from source like tree-sitter), Ubuntu CI is a reliable proxy for any glibc-based Linux distro (Fedora, Debian, Arch, openSUSE, etc.). The ABI is shared via glibc; build-from-source insulates from glibc version differences. The one real divergence — musl libc (Alpine, distroless Docker) — would warrant a separate Alpine job in the future but is out of scope for v1.
Test plan
cargo build --no-default-features→ ok (with 2 pre-existingunused_variablewarnings insrc/languages/mod.rs:170when all language gates are off; non-fatal, candidate for a follow-up PR) (local)cargo build --all-features→ ok (local)cargo test --all-features→ 177 tests pass (local)cargo clippy --all-features --all-targets -- -D warnings→ clean (local)cargo fmt --all -- --check→ clean after the preceding commit (local)RUSTDOCFLAGS=-D warnings cargo doc --all-features --no-deps→ ok (local)Follow-ups (not in this PR)
src/languages/mod.rs:170when no language features are enabled, then tightenbuild-minimalwithRUSTFLAGS=-D warnings.rust-versioninCargo.toml(MSRV) and adding a CI job that verifies it.🤖 Generated with Claude Code