0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
621 stars 158 forks source link

ci: add rust-toolchain.toml #1361

Closed bitwalker closed 3 months ago

bitwalker commented 3 months ago

This PR adds a rust-toolchain.toml file, which ensures that default Rust toolchain commands use the configured toolchain, rather than whatever the global toolchain on your machine happens to be. In this case, I've configured to use 1.78 explicitly.

So when you run, say, cargo check, this will ensure that the given Rust toolchain is installed, along with the configured targets and components, and will use that toolchain to run the given command. This applies to all Rust toolchain binaries, e.g. rustc, clippy, and so on.

If you wish to compile with nightly, simply run cargo +nightly check or whatever.

This also ensures that when CI runs, it uses the same toolchain as we are using locally (again, unless explicitly overridden, such as when specifying nightly as the toolchain via the GitHub Actions config). The result is less instability in CI as new releases drop.

@phklive I'm cc'ing you on this, since I know you've been making various CI-related changes, in case you have any opinions/thoughts on this.

bitwalker commented 3 months ago

Another question: in other repos we've been using just a simple rust-toolchain file. Is the rust-toolchain.toml approach preferred to this?

Without the file extension, you don't get syntax highlighting, but just rust-toolchain apparently is also valid (just checked the docs). I prefer to be more explicit for that reason alone, but whatever the preference is for this repo is fine.

bobbinth commented 3 months ago

Without the file extension, you don't get syntax highlighting, but just rust-toolchain apparently is also valid (just checked the docs). I prefer to be more explicit for that reason alone, but whatever the preference is for this repo is fine.

Agreed! @phklive let's propagate rust-toolchain.toml approach (as in this PR) to other repos as well.

phklive commented 3 months ago

Without the file extension, you don't get syntax highlighting, but just rust-toolchain apparently is also valid (just checked the docs). I prefer to be more explicit for that reason alone, but whatever the preference is for this repo is fine.

Agreed! @phklive let's propagate rust-toolchain.toml approach (as in this PR) to other repos as well.

Yes I can, will propagate that to other repos.