fail CI on rustc and clippy warnings without breakage

Overview

Mado Rust Library CI Template

A crate + github actions template that fails CI on rustc and clippy warnings without breakage. (The not rocket science rule)

For binaries you can do the same but skip step 4.

Setup Steps

  1. Fail CI on clippy warnings (which includes rustc warnings) in your github actions workflow
  2. Specify a specific rust release in your rust-toolchain.toml
    • clippy and rustc warnings are not stable so we need to pin to a specific rust version to avoid breakage.
  3. Commit your Cargo.lock
    • Rust libraries can rely on features that are not in your pinned rust release, so we also need to pin dependency versions.
  4. Configure a github actions nightly build that does something like cargo update; cargo test, if a failure occurs it raises an issue.
    • Committing the Cargo.lock discourages developers from using the latest patch releases of dependencies so without this automated testing issues would go unnoticed.
  5. Whenever a new rust version is released manually update the rust version in the rust-toolchain.toml
    • New rust releases include speed and diagnostic improvements not to mention new features!

Advantages

  • Keep your codebase clear of warnings!
  • Keeps development environments uniform between developers (both rust and dependency versions)
    • Experienced rust developers know to always run the latest version of rust and that cargo update can resolve strange dependency issues, but this isn't always obvious to newbies.
    • Even among experienced rust developers it eliminates entire classes of problems to know that we are all running the same rust and dependency versions when investigating a particularly gnarly "works on my machine" problem.
    • Associating each commit with rust and dependency versions gives more consistent results when benchmarking.
      • Especially powerful if you have your CI setup to benchmark PRs.
  • Bad dependency updates don't bring development to a halt.
    • Developers can continue their regular work, while one person investigates the dependency issue.

Disadvantages

  • Manually updating the rust release is a lot of extra effort.
    • Because of this I wouldn't recommend using the template unless your project is merging at least one PR a day. Additionally if development slows down or goes into maintenence mode then going back to a regular CI setup is a good idea.
  • Its easier to ignore an issue about broken dependencies than if you cant merge any PRs.
  • Have to manually delete old toolchains in rustup once they are unused.

Used by

I don't actually have a large scale library to try this on. πŸ˜… So for now I'm just trying it on Winit Input Helper even though it is not even close to the scale of development at which I would recommend this approach. I would like to hear if there are any libraries doing something similar and I'll mention them here.

Inspired by

Name

It pairs well with Homu in providing a robust "not rocket science" rule abiding CI ✨ (... although I think everyone actually uses bors-ng these days)

License

Licensed under either of

at your option.

You might also like...
Padding/aligning values without heap allocation

zero-copy-pads Padding/aligning values without heap allocation. Cargo Features std (default feature): Disable #![no_std]. Enable features that require

a Rust library implementing safe, lightweight context switches, without relying on kernel services

libfringe libfringe is a library implementing safe, lightweight context switches, without relying on kernel services. It can be used in hosted environ

πŸ•Ί Run React code snippets/components from your command-line without config

Run React code snippets/components from your command-line without config.

Donate To Charity (A.K.A. Public Goods) Without Lossing Anything
Donate To Charity (A.K.A. Public Goods) Without Lossing Anything

Donate To Charity (A.K.A. Public Goods) Without Lossing Anything

Remote-Archive is a utility for exploring remote archive files without downloading the entire contents of the archive.

[WIP] REMOTE-ARCHIVE Remote-Archive is a utility for exploring remote archive files without downloading the entire contents of the archive. The idea b

Run adb in Termux without root permissions!

termux-adb Run adb in Termux without root permissions! Description This is a launcher for adb which enables debugging of one Android device from anoth

Cargo subcommand for running cargo without dev-dependencies.

cargo-no-dev-deps Cargo subcommand for running cargo without dev-dependencies. This is an extraction of the --no-dev-deps flag of cargo-hack to be use

Tight Model format is a lossy 3D model format focused on reducing file size as much as posible without decreasing visual quality of the viewed model or read speeds.
Tight Model format is a lossy 3D model format focused on reducing file size as much as posible without decreasing visual quality of the viewed model or read speeds.

What is Tight Model Format The main goal of the tmf project is to provide a way to save 3D game assets compressed in such a way, that there are no not

A Python package written in Rust for email verification without sending any emails.

PyRustify PyRustify is a Python package written in Rust that verifies the email addresses. Features Feature Description Syntax validation Checks if th

Comments
  • Nightly deps check failed.

    Nightly deps check failed.

    Check the Nightly Deps Check workflow results for more information.

    This issue was raised by the workflow at .github/workflows/nightly_deps_check.yml

    opened by github-actions[bot] 0
Owner
Lucas Kent
Building experimental platform fighter tools and games with rust
Lucas Kent
Rust-clippy - A bunch of lints to catch common mistakes and improve your Rust code

Clippy A collection of lints to catch common mistakes and improve your Rust code. There are over 450 lints included in this crate! Lints are divided i

The Rust Programming Language 8.7k Dec 31, 2022
A rustc plugin to check for numerical instability

Herbie lint for Rust What This plugin can add warnings or errors to your crate when using a numerically unstable floating point expression. Quick exam

Martin Carton 172 Oct 31, 2022
A mini paste bin and url shortener written in rust without databases.

pb Build $ cargo build --release Environment Variables PB_DATA: /some/path (Default: ./pb_data) PB_SITE: Url of your site. (Default: http://localhost:

Edward P 5 Jul 26, 2022
A simple program that provides DBus interface to control display temperature and brightness under wayland without flickering

wl-gammarelay-rs Like wl-gammarelay, but written in rust, runs on a single thread, has three times less SLOC and uses DBus (for simplicity). Dbus inte

Max Verevkin 33 Nov 23, 2022
Workflows make it easy to browse, search, execute and share commands (or a series of commands)--without needing to leave your terminal.

Workflows The repo for all public Workflows that appear within Warp and within commands.dev. To learn how to create local or repository workflows, see

Warp 369 Jan 2, 2023
A library for loading and executing PE (Portable Executable) from memory without ever touching the disk

memexec A library for loading and executing PE (Portable Executable) from memory without ever touching the disk This is my own version for specific pr

FssAy 5 Aug 27, 2022
Workflows make it easy to browse, search, execute and share commands (or a series of commands)--without needing to leave your terminal.

Workflows The repo for all public Workflows that appear within Warp and within commands.dev. To learn how to create local or repository workflows, see

Warp 227 Jun 1, 2022
a FREE and MODERN split-screen tetris game WITHOUT ADS

tetr:: A ✨ modern ✨ Tetris game made in OpenGL and Rust Gameplay tetr:: is an implementaion of modern Tetris, and essentially a clone of tetr.io. This

Adam Harmansky 3 Sep 10, 2022
Catch Tailwindcss Errors at Compile-Time Before They Catch You, without making any change to your code! Supports overriding, extending, custom classes, custom modifiers, Plugins and many more πŸš€πŸ”₯πŸ¦€

twust Twust is a powerful static checker in rust for TailwindCSS class names at compile-time. Table of Contents Overview Installation Usage Statement

null 15 Nov 8, 2023
Like HashSet but retaining INSERTION order and without `Hash` requirement on the Element type.

identified_vec A collection of unique identifiable elements which retains insertion order, inspired by Pointfree's Swift Identified Collections. Simil

Alexander Cyon 4 Dec 11, 2023