Skip to content

ci: add rust-core GitHub Actions workflow (fmt + build + test, advisory clippy)#6

Open
Sanjays2402 wants to merge 1 commit into
b-nnett:mainfrom
Sanjays2402:ci/rust-core
Open

ci: add rust-core GitHub Actions workflow (fmt + build + test, advisory clippy)#6
Sanjays2402 wants to merge 1 commit into
b-nnett:mainfrom
Sanjays2402:ci/rust-core

Conversation

@Sanjays2402

Copy link
Copy Markdown

What

Adds the first CI workflow for the Rust core crate, plus one tiny cargo fmt cleanup that was blocking it from going green.

The repo currently has no .github/workflows/ — every PR (and direct push to main) 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.yml triggers on push to main and on PRs that touch Rust/** or the workflow itself. Three jobs:

Job What it runs Gate
fmt cargo fmt --all -- --check required
build-test cargo build --lib + cargo test --lib on ubuntu-latest and macos-15 required
clippy cargo clippy --lib --no-deps -- -D warnings advisory (continue-on-error: true)

Rust toolchain is pinned to the MSRV declared in Rust/core/Cargo.toml (rust-version = "1.94"), installed via rustup per job. Caching is via Swatinem/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 warnings immediately 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, flip continue-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.rs had one pre-existing rustfmt diff (a function call that exceeded the line width). Without fixing it, fmt would have failed on its very first run on main. One-hunk change, no behavior impact.

Verification

  • cargo build --lib — clean on macOS (1m 23s)
  • cargo test --lib --no-run — compiles
  • cargo fmt --all -- --check — clean after the export.rs fix
  • cargo clippy --lib --no-deps — ~120 warnings (pre-existing, unchanged by this PR)

Notes

  • Doesn't touch the Swift app, Xcode project, or any iOS-only paths — that needs a macOS runner with Xcode and is a separate scope.
  • Workflow only triggers when Rust/** changes, so README-only or docs-only PRs won't burn CI minutes.

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.

@tigercraft4 tigercraft4 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the strongest of the three CI proposals open for this repo (#6, #10, #16). MSRV-pinned, macOS + Linux matrix, concurrency cancellation — cleanest workflow of the batch. Two inline notes below on minor gaps.

run: cargo build --lib --verbose
- name: cargo test --lib
run: cargo test --lib --verbose

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants