Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rosarp
Copy link
Member

@rosarp rosarp commented Feb 4, 2025

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.

@rosarp rosarp requested a review from bkontur February 4, 2025 13:56
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.81.0"
components = ["rust-src", "rust-analyzer"]
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Collaborator

@serban300 serban300 Apr 10, 2025

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
@rosarp rosarp force-pushed the rs-align-rust-version-with-ci-image branch from 7af5a6b to cb73e92 Compare February 14, 2025 18:48
updated as per suggestion by serban
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.

3 participants