ci: add rust-core GitHub Actions workflow (fmt + build + test, advisory clippy)#6
ci: add rust-core GitHub Actions workflow (fmt + build + test, advisory clippy)#6Sanjays2402 wants to merge 1 commit into
Conversation
Adds the first CI for the Rust core crate. The repo currently has no
.github/workflows, so every PR (and main push) merges without any
automated check.
New workflow (.github/workflows/rust-core.yml) runs on changes under
Rust/ and to the workflow itself, with three jobs:
- fmt: cargo fmt --check, gated on the MSRV (1.94).
- build-test: cargo build --lib + cargo test --lib on
ubuntu-latest and macos-15. macOS is included because the iOS
static-library output ships from a macOS host in practice.
- clippy: cargo clippy --lib --no-deps -- -D warnings, advisory
(continue-on-error: true) because the crate currently emits
~120 pre-existing clippy warnings. The job still surfaces them
in the checks tab so they can be cleaned up incrementally; flip
continue-on-error to false once the backlog is clear.
Also fixes one pre-existing rustfmt diff in export.rs that was
blocking 'cargo fmt --check' from going green on main.
| run: cargo build --lib --verbose | ||
| - name: cargo test --lib | ||
| run: cargo test --lib --verbose | ||
|
|
There was a problem hiding this comment.
cargo test --lib skips the integration test suite.
--lib runs only unit tests inside src/. The 40+ integration test files under Rust/core/tests/ (which PR #13 is actively fixing for Windows) are not exercised by this job.
Consider changing to cargo test (without --lib) so the full suite runs. If the integration tests are too slow for a required gate, at minimum run them in an allowed-to-fail job so regressions are visible:
- name: cargo test (full)
run: cargo test --locked --verbose
continue-on-error: true # remove once integration tests are stable on CI| # This job surfaces them in the PR checks tab without blocking merges. | ||
| # Flip `continue-on-error` to `false` once the existing warnings are cleared. | ||
| continue-on-error: true | ||
| steps: |
There was a problem hiding this comment.
Advisory clippy is the right call here — well executed.
continue-on-error: true at the job level with -D warnings in the step means warnings are surfaced in the checks tab without blocking merges. The inline comment documenting the path to flip it to blocking is exactly the right pattern for a codebase with a pre-existing warning backlog.
One note: this workflow will conflict with .github/workflows/rust-core.yml proposed in PR #16 (same filename). The maintainer should designate one of them as the canonical source and close or rebase the other.
What
Adds the first CI workflow for the Rust core crate, plus one tiny
cargo fmtcleanup that was blocking it from going green.The repo currently has no
.github/workflows/— every PR (and direct push tomain) merges without any automated check on the Rust core. This adds a baseline so future PRs (including the FFI safety docs in #3, future dependabot bumps, etc.) get gated on at least build + test + formatting.The workflow
.github/workflows/rust-core.ymltriggers on push tomainand on PRs that touchRust/**or the workflow itself. Three jobs:fmtcargo fmt --all -- --checkbuild-testcargo build --lib+cargo test --libonubuntu-latestandmacos-15clippycargo clippy --lib --no-deps -- -D warningscontinue-on-error: true)Rust toolchain is pinned to the MSRV declared in
Rust/core/Cargo.toml(rust-version = "1.94"), installed viarustupper job. Caching is viaSwatinem/rust-cache@v2. Per-workflow concurrency cancels stale runs on force-push.Why clippy is advisory
The crate currently emits ~120 pre-existing clippy warnings — none introduced by this PR, but enough that flipping
-D warningsimmediately would fail every PR on day one. The job still runs and surfaces them in the checks tab so they can be cleaned up incrementally. Once the backlog is clear, flipcontinue-on-error: false(one-line change) and it becomes a hard gate.Happy to follow up with a separate clippy-sweep PR if you want.
Why include macOS
The iOS static library is built from a macOS host in practice (
Scripts/build_ios_rust.sh), so it's worth catching macOS-specific build regressions on the Rust core, not just on Linux.The other change
Rust/core/src/export.rshad one pre-existing rustfmt diff (a function call that exceeded the line width). Without fixing it,fmtwould have failed on its very first run onmain. One-hunk change, no behavior impact.Verification
cargo build --lib— clean on macOS (1m 23s)cargo test --lib --no-run— compilescargo fmt --all -- --check— clean after the export.rs fixcargo clippy --lib --no-deps— ~120 warnings (pre-existing, unchanged by this PR)Notes
Rust/**changes, so README-only or docs-only PRs won't burn CI minutes.