Add CI support to cargo init / new?

I wonder whether we can either optionally generate some basic CICD pipeline in GitHub Actions/Circle CI/TravisCI as a part of cargo init / new or add a new command to achieve that.

The main benefits include:

  1. Simplify setup of Rust projects.
  2. Introduce almost all Rust users to cargo commands from check, clippy, doc, fmt and test to (optionally) installed ones such as tomlfmt and udeps.
  3. Further improve the quality of the average Rust project.

If we decided not to add them to init / new for now then I will write a new command to do that.

I think the best approach here is to provide a native way to customize what cargo init does. I generally set publish = false in Cargo.toml after creating a new, possibly temporary, project.

1 Like

@jhpratt Sure. So I think we can add ci as an option. Where shall I get started?

This has come up on a number of occasions. There are enough things people want to customize that, rather than adding options for each such detail people want to customize, we'd prefer to have a general mechanism for new template projects, which people can add to and share.

1 Like

That's exactly my thought. While I want publish = false, that doesn't mean others do. I'm fairly certain there's a crate out there that allows custom templates, but I've never used it because cargo init / cargo new is so ingrained in my head.

Having something in ~/.cargo would make sense. A directory that would be cloned, replacing a couple placeholders as appropriate shouldn't be that hard…right?

If you want to investigate template support, I'd suggest starting with and reading the comments there and trying to figure out some solution from there.

There have been a few other discussions. I'll link a few things here:

In the meantime, there are some other template tools you may be interested in:

And a few other non-rust project template tools:

(And probably a few hundred others.)