-
Notifications
You must be signed in to change notification settings - Fork 300
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
feat: Define MSRV #1314
feat: Define MSRV #1314
Conversation
(@fzyzcjy) I've been working on finding an efficient and helpful manner to use the CI to check the MSRV on any Push/PR. I think we both can see the benefits of this; if the MSRV goes up drastically, perhaps that code should not be merged yet. In my opinion, a good way to do this is to check the MSRV in GHA, and if the MSRV is higher, the action should create a comment on that PR stating the changes, which can then be dealt with. This differs from a push event, however, and on a push event the MSRV would be checked, and if it has changed, be updated across repo files that reference the MSRV. (this also happens on a PR event) The issue I am running into is that the (These struggles are the reason for the large amount of commits) --If you think that this is something we should implement, I think that setting up a workflow token for this GHA would be good. If NOT, then I vote rolling the MSRV verification into Until we agree on how this should be done, and what's best for security, simplicity, etc, I am not going to mark this ready for review, though the POC has been implemented and optimized. Apologies for the quite lengthy summary my friend, and please let me know your thoughts on this |
Good job! Firstly, I guess usually our MSRV should not change (since as a library, we should use the most basic features of Rust to have maximum compability, unless we really need some new feature, or the MSRV is already quite old). Therefore, I expect changing the MSRV is an intentional (explicit) action that the implementor is aware of. For example, a PR may be "let us implement frb feature A which uses Rust language feature B, and since B needs MSRV=1.2.3, our MSRV should be bump to 1.2.3". Thus, I guess the simplest way is that, we do not check MSRV dynamically. Instead, we run the CI using multiple rust runtime versions (using GHA matrix). For example, say MSRV=1.64, we may test Rust = 1.64 + 1.71.0 (i.e. pinned stable) + 1.73.0 (i.e. pinned nightly). (I am not sure whether we should use something like "nightly" to get latest nightly, or "1.73.0" for pinned nightly, since I do not want to break the CI without any code change which can be annoying). I can totally understand your feeling if the code you have written has to be changed! So next time maybe we can discuss the rough idea before implementing the details, e.g. if we discuss whether adding MSRV check in CI, I may suggest the ideas above. So in short, maybe we can remove MSRV check in CI or precommit, but we can add it as a separate command in justfile. Then, we can determine the MSRV (possibly using the script?) and fill that version into CI and readme etc. |
No worries at all my friend! I had wanted to have an entirely functional POC to provide to you to show the features I had implemented, fully understanding that this is opensource and they may be denied, but I was unable anyway lol with that in mind, all it took was the deletion of one file :) The dynamic MSRV check may still be run by either My changes are now ready for review |
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.
Good job! Only some nits (though look like a dozen, but they are mostly quite trivial)
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.
nit: we need to add a link to it from our book index
| stable | <!-- stable msrv --> `1.64+` | | ||
| nightly | <!-- nightly msrv --> `nightly-2022-07-15+` | |
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.
nit: It seems that we are repeating ourself for 3 times:
- the one in ci (we test our code with MSRV version)
- the one in readme.md (the badge)
- the doc here
is it possible we somehow add a very quick sanity check for them, to ensure that they are always in sync? e.g. some quick python/shell/whatever script to extract MSRV from these 3 places, and check they are equal. Then we can add them to CI, so nobody will accidencially make MSRV not-in-sync
EDIT: Oh I see, they are already auto generated from shell. Then what about this:
- refactor the shell script into "determine MSRV automatically" and "given MSRV, write them into these few places". because in the future someone may want to manually write MSRV.
- in these few places, maybe we can add comments saying e.g.
<!-- MSRV IS AUTOMATICALLY WRITTEN BY xxxxxxxx.sh, PLEASE DO NOT MODIFY BY HAND, BUT USE THAT SCRIPT-->
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.
nit: it seems that stable_msrv.sh and nightly_msrv.sh has a lot of duplicates. in order to have a good maintainability, it would be great to avoid it :)
runs-on: ubuntu-latest # as of now, there is no real reason to test on multiple OSs | ||
strategy: | ||
matrix: | ||
rust_version: | ||
- nightly # latest nightly |
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.
nit: also add latest stable
"Worker", | ||
"Url", | ||
"BroadcastChannel", | ||
"DedicatedWorkerGlobalScope", |
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.
nit: it would be great if the old format could be kept, because someone else in the future may also automatically change the format via IDE automatically, then the code blame history will be a mess... but that's not a super big problem.
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.
what toml formatter does the project use?
If it is Taplo, perhaps a configuration file may be helpful (https://taplo.tamasfe.dev/configuration/file.html)
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.
You are right, there is no format yet. I am just following flutter's convention: when there is no (auto) formatter, try to not change the code due to format.
However, feel free to configure a formatter (e.g. Taplo)! Just ensure that
- it is checked in CI (along with other formatters, like Dart and Rust formatter)
- it is run automatically when
just precommit
(trivial to do if you put is as a sibling to the existing Dart format etc) - it has nice support and is popular, e.g. has VSCode and Intellij IDEA bulit-in support or plugin support
I whole-heartedly agree. To be completely honest, I think that this PR should be closed, and once I/the dev team @ https://github.com/foresterre/cargo-msrv implement and release nightly MSRV checking, another different PR should be reviewed. there are too many irrelevant commits in this PR and simply put, there is no reason. I'll probably open a draft PR to track progress, but I'll mark as ready for merge and send a ping when we're ready. UPDATE: (foresterre/cargo-msrv#101 (comment)) this is actively being worked on. |
I agree. Borrowing Flutter's PR philosophy - one PR should only do one thing, it looks good to split this PR into multiple PRs.
Sure, take your time!
That looks great :) |
Changes
Fixes (feat): clearly define MSRV #1310
Clearly define the MSRV, as well as create necessary files to communicate that to development tools (cargo, clippy, rustup)
Tests the MSRV in the CI locked version matrix testing
Adds
cargo-features = ["workspace-inheritance"]
to the head ofCargo.toml
, which allowed for a lower MSRV without changing any code.Adds the MSRV to
README.md
, and creates a page in the docs for the MSRV.(UNRELATED) Renamed mismatched
.yml
and.yaml
files in.github/workflows/
to all be.yml
Checklist
README.md
, as well as the docs