-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
chore(ci): integrate cargo-semver-checks #1166
Conversation
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 like to see cargo-semver-check being integrated!
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 wonder if it might also be possible to make this ensure that a breaking PR has a !, check that there are changes in the breaking changes doc, and add a breaking change label.
+1 to remove the unnecessary checkout config
👋 Hi all! @orhun is exactly right that the current action is best when used immediately before release, and that a better workflow we want to support in the future is running on each PR. We ran into some security concerns around being able to post comments and set labels safely after scanning an arbitrary PR, which e.g. might contain a malicious This is a problem that I'm confident has a solution. I'm currently in the middle of a fundraising push aimed at securing funding to solve this problem and add several other missing pieces of functionality. Wish me luck! 🤞 If I'm successful, then PRs with breaking changes will be able to be labeled e.g. Please ping me if you run into any issues and I'd be happy to help! If you find the tool helpful, I also love hearing about that too 😁 And if you are able to support its development, support on GitHub Sponsors goes a long way 🙏 |
Good idea! I think we can do that in a follow-up PR.
Hey @obi1kenobi! 👋🏼
Best of luck! Very excited to see the future of |
Personal opinion: GitHub Actions should only run after approving it as every PR can add things to the |
I agree with the sentiment! I use two things in my own repos for this:
Unfortunately for our desired |
Can it read the PR title and check whether a When it exists, and it seems breaking, then the run can be fine. When it does not exist, and it isn't breaking, then it can be fine too. Only when this misaligns the run could fail in order to correct that title. |
The cargo-semver-checks action by itself cannot do that at the moment. But I'd be happy to work with you and @orhun to put something like that together, and once it works well, I'd love to highlight it as a recommended workflow for all users of cargo-semver-checks! |
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.
Generally approving, with some docs needed.
I was under the impression that Github runs the workflows from the main branch, and not the PR itself. You can see that in action in this PR as the check-semver check isn't actually run https://github.com/ratatui-org/ratatui/actions/runs/10186995364. It's possibly I'm misunderstanding this however. |
Ready to go.
I thought that's because the PR hasn't landed in |
This comment was marked as off-topic.
This comment was marked as off-topic.
Currently, this will be annoyed at every PR after a single breaking change PR is merged into main. So we need to be extra careful not to merge breaking changes until directly before a breaking release, so this can actually be useful in its current state. |
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 recommended to @orhun that the cargo-semver-checks run be moved out of the workflow with the pull_request_target
trigger and into a separate pull_request
-triggered workflow.
The concern is this:
cargo-semver-checks
needs to compile your crates, which means thatbuild.rs
scripts in your crates and their dependencies execute.- With the
pull_request_target
trigger, theGITHUB_TOKEN
passed to workflows is your repo's (https://github.com/ratatui-org/ratatui
) and not the PR's repo (https://github.com/someones-fork/ratatui
). - An attacker that adds a malicious dependency could use a
build.rs
script to steal theratatui-org/ratatui
repo'sGITHUB_TOKEN
and abuse it at will.
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.
This looks good to me. The only other thing I might recommend is allowing this job to fail without blocking CI for now, to allow for breaking changes to be merged without immediately releasing a new major version.
Like @orhun pointed out, creating a variant of the cargo-semver-checks
GitHub Action that is more PR-friendly instead of the current release-optimized one is a near-term TODO item for me.
The last time I checked there wasn't an option for it: actions/runner#2347 (well, there is but AFAIK it is not shown as "failed" in the UI) Do you know any workarounds for it? |
Oh I just meant not marking it as a required check in a branch protection rule. I think you'd still want it to look "failed" in the UI so that you know to inspect it when it first breaks. |
Got it, we all good then! |
For a PR When the PR has a label or |
> [`cargo-semver-checks`](https://github.com/obi1kenobi/cargo-semver-checks): Lint your crate API changes for semver violations.
Maybe we can look for a way to ignore certain lints until the next release because we now made some breaking changes which means that our CI will be failing all the time... |
It is intended to be run before publishing the crate but I don't feel like that is aligned with our workflow since we are already tracking the breaking changes in a separate document. That is why I integrated it into
check-pr.yml
where it is being run for PRs.I had some experiments with
cargo-semver-checks
before and I think it is pretty useful. I have an open PR where I also improved the workflow a bit: obi1kenobi/cargo-semver-checks-action#65 - in the future we will be able to add comments to the PRs about semver violations.Let me know what you think!
Inviting @obi1kenobi to the discussion 🐻