Skip to content

Conversation

@MrDwarf7
Copy link
Contributor

Summary

This PR introduces enhanced tooling and code formatting utilities to improve the development and CI/CD workflow.

The new Makefile.toml in the project root leverages cargo-make to bring Makefile-like functionality to Rust projects with enhanced features and clearer syntax.
Additionally, this PR integrates Taplo, a TOML formatter designed to work alongside cargo fmt to maintain consistent style and syntax across the project.

Changes

Cargo-make Scripts

  • Added Makefile.toml with predefined tasks for common development operations
  • Implemented automated testing workflows with consistent command interfaces
  • Created build and test automation scripts to streamline CI/CD processes

Formatting Tools

  • Integrated code formatting standards via .rustfmt.toml and .taplo.toml configuration files
  • Configured Rust's native formatter and Taplo CLI tool to enforce standardized styling across the project

Benefits

  • Improved DX: Standardized commands for building, testing, and formatting
  • Consistency: Enforced code formatting and style guidelines across the codebase
  • Automation: Reduced manual work for common tasks such as build, build --release, test, and test --all
  • CI/CD Ready: Scripts can be easily integrated into CI/CD workflows by installing cargo-make and calling the appropriate aliases defined in Makefile.toml

Usage

After installing cargo-make (via package manager or Cargo),
developers can use the various aliases (defined as task.<name> in Makefile.toml) to execute project-wide commands.

Most commands automatically run cargo fmt and Taplo formatting before execution.
This creates a "fail-fast" approach for local development-formatting failures will produce errors before building,
providing quicker developer feedback.

Command Overview

The below commands can also be invoked via makers instead of cargo make if preferred.

Build & Run:

  • cargo make b - Build debug version
  • cargo make br - Build release version
  • cargo make r - Run debug version
  • cargo make rr - Run release version

Note: These commands run formatting checks before building and tests after completion.

Development Tools:

  • cargo make c - Run cargo check
  • cargo make cp - Run cargo clippy (stricter analysis than check)
  • cargo make cl - Clean project (removes /target directory)
  • cargo make reset - Clean project, then rebuild with both debug and release configurations

Distribution:

  • cargo make dist - Create distribution package and compress using the OS's native zip implementation

Implementation details can be found in ./build/dist-tasks.toml

Testing

  • Verified all cargo-make tasks execute successfully
  • Confirmed formatting tools integrate properly with existing workflows
  • Tested cross-platform compatibility for build and distribution tasks

Note

I can see there's also additional files being included (e.g.,vcruntime140.dll for Windows) + generation of a .desktop file for Linux.
These are currently not included as a part of the dist task.

If you'd like these added, let me know and I can look at adding them in as a part of the build & dist creation task/process (Will effectively just be copying one of the various copy block tasks).
Alternatively - There's the option of embedding them into the binary, and unpacking on first run; which may make CI easier, e.g., handling as a part of Rust or a build.rs.

@MrDwarf7 MrDwarf7 force-pushed the tests/improved-tooling branch from 3534455 to 4df0e1a Compare August 24, 2025 06:47
@MrDwarf7
Copy link
Contributor Author

Not entirely sure what's failing with formatting wise unless it's the fact it's attempting to format using non-nightly toolchain formatter, but I've updated that to reflect and everything still builds fine.
Will test enforcing toolchain via args (Though there are certainly better ways to do it).

@MrDwarf7 MrDwarf7 force-pushed the tests/improved-tooling branch 2 times, most recently from 9e37d0d to c48848b Compare August 24, 2025 06:58
@MrDwarf7
Copy link
Contributor Author

Oh - You're wanting to call a check against the current formatting.
Going to leave this for review first as everything apart from the fmt check is passing currently. Iif I were to run the formatter then it will run project wide and format everything and create tons of diff noise.

After review and when deciding to merge I'll format the project and push a single change that will have all the formatting done so it's a single commit on its own, should make it easier to review.

@MrDwarf7
Copy link
Contributor Author

This also closes out #316 with mostly the same changes - however, this opts to use nightly as the default build toolchain.
This also introduces the usage of taplo via the use of taplo format which is what's used to handle .toml files such as the Cargo.toml and any other user-side config files that may also be in the repository at the time of running commands.

@MordechaiHadad - When time permits; I'd love to see this merged to ease the development flow.
I'm also happy to assist/contribute with the CI/CD.yaml files plus clean them up in the process, should help to make them more maintainable.

Important note regarding CI/CD builds! (GitHub workflows/actions)

  • Taplo will have to be added as a package install for the CI environment.

& A choice needs to be made on which handles the toolchain when building in CI -

  1. If using the GitHub action - You will need to configure it to build with nightly + relevant profile (either default or complete (both default and complete bundle clippy with them). Note this may also impact build times though I doubt by much.
    If you're opting to use the action - you may also want to run a quick shell cmd during the build - rm ./rust-toolchain.toml as this has caused clashes in my own testing with it.

  2. The easier way, given it's already built and is a primary part of the build system for local development - is simply to install taplo and cargo-make and invoke the various recipes/commands in CI/CD via either cargo make <recipe> or makers <recipe>. This will keep local development and CI/CD in sync as needed.
    There's also a dist recipe that will package things (including docs) for a release binary (on GitHub), it's likely to simplify certain parts of CI/CD.

Some existing parts will need to remain part of CI/CD due to specific tools that wouldn't make sense being added to the Makefile.toml. if reasonable and needed, I can extend things within reason.

Small note

My own version of this Makefile.toml has changed (slightly) to allow for easier cross-platform building; this will either be added to the existing PR, or a new PR opened to update them.

@MrDwarf7 MrDwarf7 force-pushed the tests/improved-tooling branch 6 times, most recently from b66d50f to 79a488c Compare October 13, 2025 12:26
@MrDwarf7
Copy link
Contributor Author

This DeepSource thing failing might genuinely be a bug. I've written a sort of 'sanity test' and it passes just fine.
If you're able to identify what exactly it's throwing about; maybe there's something I'm just not seeing, then I'll fix it up but I'm pretty sure it's bugged.

@MrDwarf7 MrDwarf7 force-pushed the tests/improved-tooling branch from 79a488c to a9a71b8 Compare October 19, 2025 17:17
@MrDwarf7 MrDwarf7 force-pushed the tests/improved-tooling branch from a9a71b8 to 1540223 Compare November 9, 2025 01:41
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.

1 participant