ci: semver-checks for non-additive cargo features#3003
ci: semver-checks for non-additive cargo features#3003apoelstra merged 5 commits intorust-bitcoin:masterfrom storopoli:ci/semver-check-features
Conversation
Pull Request Test Coverage Report for Build 10110951027Details
💛 - Coveralls |
|
Apparently, this already caught a non-additive cargo feature in |
The rustdoc JSON format has frequent breaking changes: e.g. one last week, and very probably one more today or tomorrow. We don't always support the latest nightly's format because that would be a very heavy maintenance burden. I think my limited time and energy would benefit the community more if I dedicated it to other work instead. |
|
Sounds like |
stable, that's why I am running this on stable. I think I should also update the original semver to run on stable and use the |
|
FYI to fix that error this new check found you need to add |
Done in 1164ed9e7b23262f391d566ceee6a8df677ab8db, since we use merge commits for the PR strategy, I took the liberty of adding to this PR. |
The latest version of For the current version, that's Rust 1.74+. The upcoming release will likely raise that to 1.77+. Note that this version requirement is about which version of Rust is used to generate the rustdoc JSON. It does not impose an MSRV bound on your crates, so you can support older Rust versions if you so choose. |
|
@obi1kenobi I meant we need to sync them somehow. I suggest adding a |
Sorry, I'm confused. Could you elaborate on the problem and how the output of such a flag would be helpful? I'm not sure what needs to be synced and isn't currently. My understanding of this PR is that if current-stable Rust is used, everything should just work. |
Whenever we update one we need to update the other. The PR currently works but in a few months "latest stable" will be a different version than it is now and it may change the Json output breaking our CI. That' why we pin things. We can obviously pin both (and we should!) but we also want to update the pin periodically to not stay behind. A failed periodic update doesn't interfere with our work on merging PRs which is really helpful since we don't have to wait until a solution is found (in case it's not obvious) or a new compiler/tool version (if it's a their bug) and may avoid costly rebases of PRs. To do the periodic update automatically int the CI we need an automated way to assign compiler version to the tool version. Having an option that just prints it is easiest. An alternative would be to publish a table at a stable URL that gets updated with each release. I think the switch is a simpler approach. |
The current code in the PR installs latest stable and latest I recommend against pinning to a specific Is there a specific reason you wanted to pin it? |
|
@obi1kenobi because if you add a new lint to cargo-semver-checks, which reveals breakage in our codebase which results in a red X on CI, then all of our release branches (which do not receive regular updates, especially with API-breaking things) will permanently have a red X on them. Furthermore, every one of our current PRs will have a red X on them forcing us to drop everything to address the new cargo-semver-checks issue. (And if the issue is a bug in cargo-semver-checks, then we will wind up needing to pin it anyway while the upstream issue is resolved.) Furthermore, if we find an old issue that CI should have caught in the past, we will have no way of re-running (or even knowing) what "CI" was back then, which makes our forensics harder. If we just pin everything and then use cronjobs to update the pins, that fixes all of the above issues. New cargo-semver-checks issues will appear as a red X on the "update pin" PR and we can address it at our leisure. @Kixunil honestly I don't think we need upstream support to do this. If @obi1kenobi says it always supports "the latest stable" then our cronjob can just query "the latest stable" and use |
|
Your call on pinning, of course! 👍 Just keep in mind that "the latest stable" policy means that the latest cargo-semver-checks supports the stable that was latest at the time of its release. It does not mean that an arbitrary past version of cargo-semver-checks will always support today's latest stable (i.e. a Rust released "in the future" relative to that cargo-semver-checks version). This is probably obvious, but I wanted to err on the side of caution and mention it just in case :) |
|
@obi1kenobi what @apoelstra said plus I want to mention that problems with unpinned stuff happened already multiple times. Stability is very helpful and since we pin other things already anyway it's not that big deal.
Good point, though it assumes |
This is why latest beta is supported — that's the version that graduates to become the next stable, so it's supported "in advance" essentially. If I remember correctly, Rust releases on Thursdays. So if you have the cron job re-pin to latest stable Rust and latest cargo-semver-checks each Thursday, you should be good. I have a job like this in cargo-semver-checks, in case that's useful for inspiration: https://github.com/obi1kenobi/cargo-semver-checks/blob/main/.github/workflows/add_new_rust_to_matrix.yml |
|
Oh that's great then! So does it mean both beta and stable are supported and it can detect the correct version and use it dynamically? |
In your case, you're generating the rustdoc JSON with some version of Rust, and cargo-semver-checks will detect the format version and (if supported) adjust itself automatically, yes. The current-stable and current-beta versions at the time of the cargo-semver-checks' version release are both supported, always. If you were having cargo-semver-checks itself generate the rustdoc JSON, it would use whatever Rust version is the default as configured in rustup. It won't switch to another version since I felt that was too magical and would be the sort of thing that causes a few hours of debugging for someone sooner or later. Better to do "the obvious thing" even if it results in a (very quick and obvious-to-fix) error. |
|
Thanks @obi1kenobi that all sounds great! So @storopoli I think we should have files storing latest stable version and semver checks version, then use those in the script and attempt to update them to the latest ones weekly on Thursday (not sure about the time, maybe try Friday?) |
|
🚨 API BREAKING CHANGE DETECTED |
4 similar comments
|
🚨 API BREAKING CHANGE DETECTED |
|
🚨 API BREAKING CHANGE DETECTED |
|
🚨 API BREAKING CHANGE DETECTED |
|
🚨 API BREAKING CHANGE DETECTED |
|
Ok this is ready for another round! |
|
🚨 API BREAKING CHANGE DETECTED |
|
I'm kinda out of the loop on this but I might read it more later.
I much prefer the alerts vs the CI breakage and the diff being stuffed into git. Although I wish there was a way to silence it after the first time or something because it gets pretty noisy after every commit. |
|
FTR this specific PR shouldn't change any API so something wrong is going on. We should have some marker to say "intended break" (probably a comment) which would silence the notification on pushes but still perform the check to allow us see its output. (Is it really the break we're expecting or a different one?) |
Actually we are changing it in 7dbd44bacd42834e488093154e4e505a0ab53ce3 Do you want me to move it into a new PR?
Good idea! I'll try to hack something with |
|
🚨 API BREAKING CHANGE DETECTED |
|
LOL, I completely forgot, sorry about the noise. |
.github/workflows/semver-checks.yml
Outdated
There was a problem hiding this comment.
This entire job is not needed since we're using cat directly.
There was a problem hiding this comment.
Good catch! Thanks
There was a problem hiding this comment.
I've removed the rust_stable_version, that's why I told you "Good catch".
But this is needed for https://github.com/rust-bitcoin/rust-bitcoin/blob/3a19dece44c82f98a17d23bab5f373130bea6a30/.github/workflows/semver-checks.yml#L38-L39 and https://github.com/rust-bitcoin/rust-bitcoin/blob/3a19dece44c82f98a17d23bab5f373130bea6a30/.github/workflows/semver-checks.yml#L78-L79
There was a problem hiding this comment.
That one can use cat too.
There was a problem hiding this comment.
Done in 54251fc69b7c247765ad2210dd5a7e162c422752
Thanks for pointing that out. Much simpler.
There was a problem hiding this comment.
Could you please clean up the history to not add it in 2e0f15a47e1a62d4405d82fb717f8e80fa15a4e8 so it won't need to be removed later?
|
🚨 API BREAKING CHANGE DETECTED |
Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
|
🚨 API BREAKING CHANGE DETECTED |
1 similar comment
|
🚨 API BREAKING CHANGE DETECTED |
from the man unzip: -n stands for never overwrite existing files. If a file already exists, skip the extraction of that file without prompting.
|
🚨 API BREAKING CHANGE DETECTED |
Closes #3001.
Closes #3023.
Summary
Adds new CI Job that checks for semver breaks in
no-default-featuresagainstall-features.A fail would represent that we are inserting non-additive cargo features.
Credits to @Kixunil for the amazing idea.
This PR does:
bitcoin-io;semver-checkstosemver-checks-prsince it checks if the PR is introducing classical semver-checks;semver-checks-feature;-ntounzipinsemver-checks;rustcstable and updates in a cron job weekly on Fri; andcargo-semver-checksto0.33.0and updates in a cron job weekly on Sat.Implementation notes
We don't need nightly (and somehow it fails) but if we incorporate the ENV
RUSTC_BOOTSTRAP=1as hardcoded in the cargo-semver-checks codebase and runcargowith the stable toolchain it works.To get the
cargo-semver-checksversion we use thecrates.ioAPI along with some quite intelligiblejgmagic (NOTE:jqis available in GH'subuntu-latestimage).