-
Notifications
You must be signed in to change notification settings - Fork 131
Align rust version with CI image's Rust version #3105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Align rust version with CI image's Rust version #3105
Conversation
rust-toolchain.toml
Outdated
@@ -0,0 +1,3 @@ | |||
[toolchain] | |||
channel = "1.81.0" | |||
components = ["rust-src", "rust-analyzer"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need rust-analyzer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rust-analyzer is not downloaded for any other version by default.
If this settings is not enabled, rust-analyzer wont work locally, as editor will try to load rust-analyzer for currently enabled rust version (if configured to use it).
Those who need it locally will need to run this command once in this repository:
rustup component add rust-analyzer
So, if larger population of devs dont need rust-analyzer locally, I can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I think I have never used rustup component add rust-analyzer
, so now I think more we should not push local settings/setups to the git
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only applicable if you are using version other than stable.
Even for nightly it will be required locally.
I will remove both component from this config, as both will be only required on local.
Only that, every developer working on this repository will need to add this line to satisfy IDE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I think I have never used
rustup component add rust-analyzer
, so now I think more we should not push local settings/setups to the git
After thinking a bit, setting channel is also required for local setting only. as github CI, takes care of the version for git build.
So, basically these settings will help user with consistent build experience. What happens on CI can be reproduced locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also remove rust-analyzer
from here if it's not needed in the CI. And I think we need to add rustfmt
and clippy
.
Also, to ensure that the CI image uses the same version as the one provided in our rust-toolchain.toml
override, I think it would be good to have a test that checks if they are the same. We can get the override with rustup show active-toolchain |& tail -n 1 | cut -d " " -f1
and the CI default with rustup default | cut -d " " -f1
current CI Image is paritytech/ci-unified:bullseye-1.81.0-2024-09-11-v202409111034
7af5a6b
to
cb73e92
Compare
added required targets
updated as per suggestion by serban
Current CI Image is paritytech/ci-unified:bullseye-1.81.0-2024-09-11-v202409111034
This also helps with Cargo.lock version issue:
Version of rust < 1.83 uses version "3" in Cargo.lock while version >= 1.83 uses version "4" in Cargo.lock.
This PR also solves this issue while keeping aligned with rust version used in github CI image. Which will eliminate back-and-forth build failures caused due to rust version mismatches.