-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add semver checking to CI #5437
Conversation
69a17f5
to
f76a9d6
Compare
This reverts commit f76a9d6.
Installing cargo-semver-checks manually took >5 minutes
d5d27bc
to
e6a09c0
Compare
The premade github action (obi1kenobi/cargo-semver-checks-action@v1) doesn't seem to work for our case. It is too opinionated and does some fancy version parsing that isn't compatible with normal merge requests; it seems to be meant for release checking only. It wouldn't speed up the build time anyway, as it also installs |
You could use taiki-e/install-action which can use |
The |
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.
Looks good to me.
Hey all! Maintainer of
We're this close to releasing a v2 of the action, using prebuilt binaries by default and caching the baseline rustdoc JSON so it doesn't have to be rebuilt each time. That's also where we plan to add closer workflow integrations with GitHub PRs, for example the "per-PR checking and semver-labeling" described here: https://hachyderm.io/@predrag/109830018805421037 Of course, you are welcome to use
I'm not familiar with the preferred tokio workflow, so I just wanted to mention: making it a required step means it will enforce that the current Some repos prefer to merge changes first and decide the correct version number to release later — that approach is incompatible with making semver-checking a required PR check. I don't know if tokio does this or not, so I wanted to bring it up just in case. If there are any things that |
Thanks a lot for reaching out! Once you release a new version of the GitHub actions, it would be nice if you could let us know so we can try it out. For now, I'm fine with things not being cached and being recomputed on every run. Regarding the Tokio workflow, we generally manage releases in the following way:
Is that consistent with what |
That makes sense and is also the workflow we use for I'd recommend:
Planned future work is adding the ability to label PRs I'll definitely let you know once the v2 GitHub Action is published. I also tend to announce new releases on Mastodon if that's of interest: |
We don't actually use the publish script anymore ... maybe we should start doing that. You talk about non-patch-compatible changes. Does cargo-semver-checks distinguish between patch and minor releases? |
If you'd like, it might be operationally easier to use a GitHub workflow to handle publishing. It's possible to make it either manually-triggered or automatic upon merging a change to the I'd be happy to help you set up either of them, if you'd like.
Right now, the only implemented semver-minor lints are around the addition of We are not planning on implementing any other semver-minor lints until we have a mechanism where maintainers can control lint levels like for |
@Darksonn @obi1kenobi I removed it from the mandatory set. (PR pending) Our workflow (for now) would then be:
Is that an acceptable solution for now? It would in indeed be desirable to have a release github workflow, maybe automatic and tag-based. I use one in |
In general, I don't want CI checks that fail on correct PRs. I guess we can just modify the I don't see much reason in giving GitHub publish permissions for the crate. There is intentionally a permission difference between "who can merge PRs into master" and "who can publish to crates.io", so something like auto-publishing when the version number changes on master would not be a solution. |
Just a small clarification: only major breaking API changes (plus Some crates only run Another approach would be to only run the check in the CI of PRs that include changes to A third approach would be run the job on all CI runs, always have it report success, but if it finds anything have it post its output as a comment. This is a bit more work, and if you do this then you should almost certainly configure the check to compare against the If it were my call, I'd probably go with one of the first two. But it's your repo and your call, and I'm happy to help with whichever approach you choose to take. |
@Darksonn I think you misunderstand. The publish CI will be blocked by the environment. You can enter a whitelist of names who are allowed to approve publish requests. It has nothing to do with who can publish to master, and creates that permission gap that you are talking about. I guess github deployment environments were created for exactly that usecase :) |
About the behaviour of the semver checks: I'm also fine with either. If we don't reach an agreement, we can also remove it again all together. So far it was just experimental :) I don't think modifying it with If it's just a patch level API change, it would succeed even without a version change (if I understand correctly). And changing the minor version would make checking patch vs minor changes pointless. I suggest the following (a modification of @obi1kenobi's second suggestion)
Does that make sense, @obi1kenobi and @Darksonn? EDIT: I just realized that this would be a lot easier if we only had a single |
@obi1kenobi I think if you could add an option to semver-checks that allows skipping the check of crates whose |
I'm not sure, it might be okay: for each
Interesting idea, I opened obi1kenobi/cargo-semver-checks#356 for it and will bring it up with the team. |
It sounds like the current behavior of |
Agree. I would still vote for using said flag in case you happen to add it, @obi1kenobi. Until then, let's keep it as is. |
We are definitely in "add all of the things" mode and shipping all of the things as fast as humanly possible 😅 But honestly, I'd rather take out those lints altogether than lose tokio as a user, if it ever came to that. |
Here's an idea: Add a command-line flag to say "assume that the next release is a minor release". Then we can just pass that in CI rather than messing around with the We don't need the patch-release checks, and if we ever want to make a major release of anything again, we can turn off the semver check for that crate temporarily. |
@Darksonn The don't-check-identical-version flag I proposed would work for everything without any manual intervention, and would check patch vs minor vs major all at once. That would be the simply-works solution for our usecase. And as the tool already has the knowledge about published vs current version (as seen in the output) it should be a trivial change. Maybe I'll create a PR at their repository. |
Interesting idea, thanks. I think the other maintainers and I have discussed it in the past but I don't remember what we came out of it, I've opened an issue and will bring it up.
Sorry, I might have misunderstood the proposed feature: when a new patch is being released in a release PR, won't that flag still cause it to be checked, and have |
I don't really care about the patch-level checks, even on release PRs for patch releases. We only make patch releases for serious bugfixes, and we make them even if they are breaking changes. (See #5372 for an example.) They are also under a lot more scrutiny than pretty much any other type of PR. |
@obi1kenobi Maybe I misunderstand then. My understanding was:
So if that understanding is right, then adding a dont-check-identical-version setting would:
And isn't that exactly the behaviour we would like to have? I kind of don't understand the rest of this conversation about overriding the assumed version type change and all, why are we talking about this? Maybe I misunderstand something, though. Edit: I do understand if we need that flag to disable patch-level checks in general because we might have to make breaking changes in them. Although I would argue we should still enable them, a better way to deal with that would be to first yank the broken version, and then have the semver checker check against the last non-yanked version. |
I think the only difference I see is what happens if the previous version is In that case, the version has changed, so the "don't-check-identical-version" flag has no effect, and But the "assume version is minor" flag never runs the I obviously have no opinion one way or the other here, happy to help with whatever workflow you decide is best for the project. |
This is indeed what would happen in that scenario -- yanked versions are skipped when trying to find an appropriate version to use as baseline for semver-checking. |
Not checking anything in ordinary PRs isn't what I would want. I would want the tool to detect breaking changes in the PR that introduces them — not in the release PR that may not be filed until weeks later. |
@Darksonn OK got it. So always assume the next release will be a minor change, and then error right away in PRs that break this premise. I agree, then (@obi1kenobi) we do in fact need a flag in the tool that changes the assumed version increment to "minor". |
Awesome, thank you both! @Finomnis if you're still open to starting a PR for this, I'd be happy to help — but no pressure. If not, I'll try to get to it ASAP. Do you have strong feelings on the flag name? |
I don't have strong feelings, but here are some more ideas: |
Oh, I like Appreciate the suggestions. I'll bring all of these to the issue I opened (obi1kenobi/cargo-semver-checks#359) and we'll probably bikeshed names a bit more there. Feel free to jump in there as well, if you'd like! |
Closing the loop to save people a few clicks, |
@Finomnis Do you want to submit a PR to make the update in our CI? |
Two pieces of good news relevant to this PR:
Between the faster check time and the baseline rustdoc caching, I think this will be a substantial performance improvement. I believe this repo's current setup will use the new |
I'd be happy to upgrade to the new github action if it provides a speedup! Please submit a PR. |
Will provide a substantial performance improvement: - cargo-semver-checks v0.20 is orders of magnitude faster at checking large crates — 2354x faster on `aws-sdk-ec2`; - the GitHub Action caches baseline rustdoc JSON files which is worth another ~2x speedup. As discussed here: tokio-rs#5437 (comment)
Another piece of good news: as of v0.33.0 released today, I believe tokio is still using the The new manifest-based config is a much finer-grained instrument than We'll try to keep that section of the docs updated as we add new lints, while also continuing to add copy-pasteable configurations that gain popularity across the ecosystem. The goal is for new projects to be able to look at a menu of options commonly used in Rust projects, pick the config that makes sense for them, copy-paste a handful of lines into their |
Thanks for the update. Yeah, we still use |
No description provided.