Skip to content
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

Improve msrv CI #17006

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

BenjaminBrienen
Copy link
Contributor

@BenjaminBrienen BenjaminBrienen commented Dec 28, 2024

Objective

Fixes #16330
Fixes #17008

Solution

Have the CI check the msrv for a select list of crates which are intended to be used apart from bevy.
I added a tool to make checking MSRVs easier.
I also removed the needs: build from msrv because it often uses a different toolchain, so the cache probably isn't helpful. Unblocking this makes it complete quicker.

Testing

bevy_ecs's rust-version is already incorrect, so see the showcase for a demonstration of the failure.

https://github.com/bevyengine/bevy/actions/runs/12529512145/job/34945194232

Showcase

image

image

@BenjaminBrienen BenjaminBrienen marked this pull request as ready for review December 28, 2024 18:26
@BenjaminBrienen
Copy link
Contributor Author

BenjaminBrienen commented Dec 28, 2024

Let me know if we should switch to using cargo msrv (directly or via the ci tool). I can reimplement it that way if wanted.

Copy link
Contributor

Your PR increases Bevy Minimum Supported Rust Version. Please update the rust-version field in the root Cargo.toml file.

@BenjaminBrienen
Copy link
Contributor Author

YEEEESSSSS it works

@BenjaminBrienen
Copy link
Contributor Author

BenjaminBrienen commented Dec 28, 2024

It seems to be using the bot comment from main. Hmm...

edit: this is correct behavior

@BenjaminBrienen BenjaminBrienen self-assigned this Dec 28, 2024
@BenjaminBrienen BenjaminBrienen added A-Build-System Related to build systems or continuous integration A-Meta About the project itself D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 28, 2024
@BenjaminBrienen BenjaminBrienen mentioned this pull request Dec 28, 2024
fi

# Additional crates
crates=("bevy_color" "bevy_ecs" "bevy_input_focus" "bevy_math" "bevy_mikktspace" "bevy_ptr" "bevy_reflect")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we aren't running this check on all crates (e.g., it'd increase CI time substantially, etc.) Strictly speaking, all the crates can be used independent of bevy, so if we could check all of them we probably should.

Copy link
Contributor Author

@BenjaminBrienen BenjaminBrienen Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but members @alice-i-cecile and @mockersf decided that only certain select crates should have an msrv, which I respect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfectly fine if there's prior discussion leading to this decision, just wanted to capture that question in the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference: #16333 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a comment on the reasoning here.

Comment on lines -150 to +153
if !self
if self
.component_info
.type_id()
.is_some_and(|id| id == TypeId::of::<T>())
.is_none_or(|id| id != TypeId::of::<T>())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I saw this come up a few times but was confused why it would fail CI locally for me and then pass on GitHub. Glad to see it resolved.

fi

# Additional crates
crates=("bevy_color" "bevy_ecs" "bevy_input_focus" "bevy_math" "bevy_mikktspace" "bevy_ptr" "bevy_reflect")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bevy_input_focus shouldn't be in this list: it's not usable standalone.

@mockersf
Copy link
Member

mockersf commented Dec 29, 2024

I still think we should not mention the MSRV of subcrates. Bevy and its ecosystem in general is "latest stable rust".
The MSRV was added to the root Bevy crate to improve error messages for newcomers. I think people using the subcrates directly are not newcomers and can do without those indications. It only adds to the burden of maintaining them for the Bevy developers, as this PR and #17012 show.

If we want to handle it, I would prefer it to be discussed and made explicit first. This is #16172, but it has received low interest so I doesn't seem to be a priority.

Once we have decided on the policy, encoding it in CI will be the next step. The way it's done in this PR is very bad for maintainability, it should be a matrix job.

@BenjaminBrienen
Copy link
Contributor Author

BenjaminBrienen commented Dec 29, 2024

I agree with it being a matrix job. I implemented it this way being a bit new to github actions, but I expected there to be much cleaner ways of doing it, and that sounds right to me.

I completely understand your argument about not specifying them at all, but it just comes down to whether we view specifying rust-version to be valuable. I like it because it seems like a nice little correctness detail and it seems easy enough to maintain as long as we have the right CI. If that's all out of scope for bevy, no hard feelings! I have fun playing around with this stuff even if it ends up getting turned down.

github-merge-queue bot pushed a commit that referenced this pull request Dec 29, 2024
# Objective

The rust-versions are out of date.
Fixes #17008

## Solution

Update the values

Cherry-picked from #17006 in case it is controversial

## Testing

Validated locally and in #17006

---------

Co-authored-by: Alice Cecile <[email protected]>
@mockersf
Copy link
Member

mockersf commented Dec 29, 2024

I like it because it seems like a nice little correctness detail

It's not, it's just an helper that will display a better error message. It doesn't allow/forbid anything that isn't already.

It usually replaces a message like "feature XXX is unstable" by "rust version Y is required". This is very nice for newcomers, but once you're used to rust and you know that Bevy has a guarantee to work on stable, you know you need to update your local rust when you see that message

I think it's valuable on the root crate, less so on the others. It's debatable on the independent crates.

So we have to balance "better error message for an advance case" with "CI time / contributor load"

@alice-i-cecile alice-i-cecile added the X-Controversial There is active debate or serious implications around merging this PR label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Build-System Related to build systems or continuous integration A-Meta About the project itself D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

msrv CI is insufficient rust-versions are incorrect
4 participants