-
Notifications
You must be signed in to change notification settings - Fork 378
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 compatibility checks to CI #3560
Conversation
44bd59a
to
b575dfd
Compare
b575dfd
to
da08640
Compare
Currently we just check with |
da08640
to
d478c21
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3560 +/- ##
==========================================
+ Coverage 88.40% 89.61% +1.21%
==========================================
Files 149 149
Lines 113874 122216 +8342
Branches 113874 122216 +8342
==========================================
+ Hits 100674 109529 +8855
+ Misses 10690 10294 -396
+ Partials 2510 2393 -117 ☔ View full report in Codecov by Sentry. |
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.
Nice! LGTM, why is this draft? Does this need to be backported to the 0.1 branch as well?
Well, for one I wanted to get a concept ACK before adding more (per-crate) features besides |
Oh, is it possible to, on PRs tagged "backport X" we cherry-pick it onto brach X and then run the semver check? That, I guess is really what we want.
Can we make 0.2 the baseline? |
IIUC, shouldn't this already be done here as it will run on any PRs towards the
Ah, IIUC, it seems it defaults to use the version prior to the one in |
Pushed a fixup with additional checks for crate features (let me know if I forgot something important). Undrafting. |
Btw, also opened a corresponding PR on the LDK Node side: lightningdevkit/ldk-node#445 |
Right, but what we've been doing so far is opening a PR to |
I don't think what you're describing is possible then as many of the backport-labeled PRs do not cleanly rebase on the feature branch, but do require manual conflict resolution. I think to get what you want (i.e., catch SemVer vioaltions ASAP) we would need to either start opening both PRs in parallel again rather than collecting all backports prior to release, or start opening the fixes first towards the backport branch, and then reopen and land them towards main once reviewed and merged. |
Right, but this is CI, if it requires manual conflict resolution we can ignore the CI failure and make sure that its semver compatible by hand and automatically in the backport PR itself :). |
Yes. But now I'm confused what the point is you're making?: AFAIU you asked above whether it's possible to automatically cherry-pick check for SemVer-incompatible changes prior to opening the actual backport PR in CI? And my TLDR is that, if we want to keep the current approach, it is not possible to do this automatically, but should still check in CI when opening the backport CI so that we can at least catch and remedy the issue then, even if it means going back to |
My thinking is ideally we should (a) when a PR is opened with the I believe (a) is possible using the hooks that were also used in @dunxen's PR. |
Alright, added a fixup dropping the ignore on Or are you saying to run the checks based on the 0.1 branch? Again, I'm not sure this is feasible in an automized way, even if we had some hooks for it? E.g., #3534 will need some additional manual conflict steps during rebasing as it uses internal APIs that have diverged on
Yup, we're doing this already.
Yup, that's accomplished by |
99fd11c
to
3ddc01b
Compare
It won't always work, no, but in most cases it'll work. If it fails due to a rebase conflict, we can just ignore the CI job and validate it when we do backports, but its good to at least try. |
@@ -0,0 +1,22 @@ | |||
name: SemVer checks | |||
on: | |||
push: |
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.
Can we filter it to just when the backport X
tag is applied?
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 assume you don't mean here but on: pull_request
below? At least not generally, otherwise the PRs towards (eg. #3567) the release branches would also need that label, which doesn't make sense in our "needs to be backported" semantics.
We could potentially see whether it's possible to only apply it on PRs towards main that have the label but I don't really see the argument for the complication as running it on every PR shouldn't be that costly to begin with. But, if we really want to do it, I'd prefer to first land this PR and assert everything is robustly working as intended before introducing further complications, see below.
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 assume you don't mean here but on: pull_request below?
I meant by running via something like this:
on:
pull_request_target:
types: [opened, labeled]
...
if: startsWith('backport', github.event.label.name)
otherwise the PRs towards (eg. #3567) the release branches would also need that label, which doesn't make sense in our "needs to be backported" semantics.
We can check for either condition, we can write code in if
statements on the jobs :)
We could potentially see whether it's possible to only apply it on PRs towards main that have the label but I don't really see the argument for the complication as running it on every PR shouldn't be that costly to begin with.
Just annoying cause it'll always be failing, but if we filter on the label then it should only fail when its actually something worth investigating.
But, if we really want to do it, I'd prefer to first land this PR and assert everything is robustly working as intended before introducing further complications, see below.
Sure, that's fine.
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.
Just annoying cause it'll always be failing, but if we filter on the label then it should only fail when its actually something worth investigating.
Why would it always be failing? It doesn't fail in either case, if the changes aren't breaking compared to the baseline. On main (where we bumped to 0.2.0+git
) it picks 0.1 as the baseline, and in the feature branch the latest patch release.
Hmm. I'm not sure I see the utility of adding another flaky CI check tbh. In any case, if we want to go there I'd prefer to do it in a follow-up to first assert that the current version is robust and working as intended. |
Sure that's fine, if you prefer, feel free to drop the fixup commit and we can land this. |
I think there is a misconception that this job will always fail on PRs towards main. As mentioned above, it doesn't due to picking the right baseline in the right context. E.g., when run on
and when run on
|
99fd11c
to
e811c66
Compare
Turns out I had forgotten to actually push the mentioned fixup commit. 🤦♂️ Now did so. As for the other fixup: as mentioned above, I'd prefer to simply squash rather than drop it, as the CI check should just work fine on |
49d7390
to
9fbf006
Compare
9fbf006
to
9a0978b
Compare
See https://github.com/lightningdevkit/rust-lightning/actions/runs/13112540715/job/36579407324 for an example run of the changes here. |
Ah, okay, hadn't realized it auto-skips on main. Happy to land this as-is if we look into the on-label workflow in the future. |
We recently introduced release branches that need to remain backwards compatible. However, even small changes to item visibility during backporting fixes might introduce SemVer violations (see https://doc.rust-lang.org/cargo/reference/semver.html#change-categories for a list of changs that would be considered major/minor). To make sure we don't accidentally introduce such changes in the backports, we here add a new `semver-checks` CI job that utilizes `cargo-semver-checks` (https://github.com/obi1kenobi/cargo-semver-checks), and have it run on any push or pull requests towards anything else but `main`/`master` (i.e., all feature branches to come).
9a0978b
to
655d580
Compare
It doesn't skip, but as we bumped to 0.2+git, it picks 0.1 as the baseline and detects that there has been a minor version bump.
Sounds good, now squashed the fixups without further changes: > git diff-tree -U2 9a0978bef 655d580ab
> |
Right, that's what I meant by "skip" :) |
We recently introduced release branches that need to remain backwards compatible. However, even small changes to item visibility during backporting fixes might introduce SemVer violations (see https://doc.rust-lang.org/cargo/reference/semver.html#change-categories for a list of changs that would be considered major/minor).
To make sure we don't accidentally introduce such changes in the backports, we here add a new
semver-checks
CI job that utilizescargo-semver-checks
(https://github.com/obi1kenobi/cargo-semver-checks), and have it run on any push or pull requests towards anything else but
main
/master
(i.e., all feature branches to come).Example output from a local run: