Skip to content

[FEAT] Add CI/CD pipeline using GitHub Actions #23

Description

@daniil-verba

[FEAT] Add CI/CD pipeline using GitHub Actions

📝 Description

Add an automated Continuous Integration (CI) pipeline using GitHub Actions to automatically test, lint, and format the codebase on every push and Pull Request.

Currently, code quality checks rely on manual local testing. As the project grows and receives external contributions, we need an automated gatekeeper to ensure that new code doesn't break the build or violate our style guidelines.

💡 Motivation

  • Maintain Code Quality: Automatically enforce cargo fmt and cargo clippy rules across all contributions.
  • Prevent Broken Builds: Ensure that cargo test and cargo build pass on supported platforms before a PR can be merged.
  • Save Maintainer Time: Automate the review process for basic code standards, allowing the maintainer to focus on logic and architecture rather than missing semicolons or formatting issues.
  • Boost Contributor Confidence: Give external contributors immediate feedback on their PRs (e.g., green checkmarks) without waiting for a manual review.

⚙️ Technical Details

We will use GitHub Actions to create a workflow file at .github/workflows/rust.yml.

The pipeline should include the following steps:

  1. Checkout: Clone the repository.
  2. Install Rust Toolchain: Use dtolnay/rust-toolchain to install the stable Rust version.
  3. Cache Dependencies: Use Swatinem/rust-cache to drastically speed up subsequent builds.
  4. Format Check: Run cargo fmt --all -- --check.
  5. Linting: Run cargo clippy --all-targets --all-features -- -D warnings (treat warnings as errors).
  6. Testing & Building: Run cargo test and cargo build --release.

Optional (for future CD): Add a separate job or workflow to automatically publish to crates.io or create a GitHub Release when a new tag is pushed.

🔄 Alternatives Considered

  • Travis CI / CircleCI: Rejected. GitHub Actions is natively integrated into the GitHub UI, free for public repositories, and requires no external account setup.
  • Local pre-commit hooks only: Rejected. While useful for local development, they can be bypassed by contributors. Server-side CI is mandatory for open-source projects.

Additional Context

  • Trigger: The workflow should trigger on push to the main/dev branches and on pull_request events.
  • Matrix Builds (Future Scope): Eventually, we should expand this to test across multiple OS targets (Ubuntu, Windows, macOS) to support our cross-platform goals (see related issue on Windows support).
  • Standard Template: We can base our initial setup on the official GitHub Actions for Rust community templates.

✅ Acceptance Criteria

  • .github/workflows/rust.yml file is created.
  • The pipeline successfully triggers on a new PR.
  • The pipeline passes cargo fmt, cargo clippy, and cargo test.
  • The PR status shows a green checkmark in the GitHub UI when all checks pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions