Skip to content
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

ci: rewrite bump check and respect semver #12395

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

weihanglo
Copy link
Member

@weihanglo weihanglo commented Jul 24, 2023

What does this PR try to resolve?

This ports ci/validate-version-bump.sh and #12200 to the new xtask bump-check. It also adds the ability to set the correct baseline revision when checking version bump. That is, it fixes #12347.

In addition, this integrates the community tool cargo-semver-checks. SemVer violation can now be detected earlier.

How should we test and review this PR?

This PR extracts the registry query part from xtask-unpublished and removes other pars. I don't feel like we need it in the short term.

For how it works, please the check doc comment in each function.

One concern is that this check is still a required job for bors. I believe @obi1kenobi is quite responsive and willing to help if there is something wrong. So, waiting for an upstream fix won't be a problem for cargo. Also as a good citizen in the community, we can always contribute back.
(Take it easy @obi1kenobi, don't be stressed out 🙂)

@rustbot
Copy link
Collaborator

rustbot commented Jul 24, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 24, 2023
ci/validate-version-bump.sh Outdated Show resolved Hide resolved
Copy link
Member

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Two suggestions to make it even better:

  • Consider using the cargo-semver-checks GitHub Action, which automatically sets up proper rustdoc caching and other nice things like that.
  • If not, then consider at least caching the target/semver-checks/cache/ directory across runs, to enable reuse of rustdoc JSON when the baseline version hasn't changed. This would probably reduce semver-checking time by about half.

@weihanglo
Copy link
Member Author

I understood the baseline rustdoc wrong. It should be fixed on latest beta branch for nightly cargo, and latest stable branch for beta cargo. Make it as a draft temporarily.

@weihanglo weihanglo marked this pull request as draft July 24, 2023 14:49
@weihanglo weihanglo changed the title ci: use cargo-semver-checks to detect semver violations ci: rewrite bump check and respect semver Jul 26, 2023
@weihanglo
Copy link
Member Author

Thanks @obi1kenobi! Some questions:

  • The GitHub Action doesn't seem able to set --baseline-rev, or am I missing something?
  • Regarding manual caching, is using baseline rev as cache key sufficient and safe?

@weihanglo weihanglo marked this pull request as ready for review July 26, 2023 10:00
@weihanglo

This comment was marked as outdated.

@bors

This comment was marked as outdated.

bors added a commit that referenced this pull request Jul 26, 2023
ci: rewrite bump check and respect semver

### What does this PR try to resolve?

This ports `ci/validate-version-bump.sh` and #12200 to the new xtask `bump-check`. It also adds the ability to set the correct baseline revision when checking version bump. That is, it fixes #12347.

In addition, this integrates the community tool `cargo-semver-checks`. SemVer violation can now be detected earlier.

### How should we test and review this PR?

This PR extracts the registry query part from `xtask-unpublished` and removes other pars. I don't feel like we need it in the short term.

For how it works, please the check doc comment in each function.

One concern is that this check is still a required job for bors. I believe `@obi1kenobi` is quite responsive and willing to help if there is something wrong. So, waiting for an upstream fix won't be a problem for cargo. Also as a good citizen in the community, we can always contribute back.
(Take it easy `@obi1kenobi,` don't be stressed out 🙂)
<!-- homu-ignore:end -->
@weihanglo weihanglo marked this pull request as draft July 26, 2023 10:05
@weihanglo
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Jul 26, 2023

⌛ Trying commit 0beb3d8 with merge aa5f096...

bors added a commit that referenced this pull request Jul 26, 2023
ci: rewrite bump check and respect semver

### What does this PR try to resolve?

This ports `ci/validate-version-bump.sh` and #12200 to the new xtask `bump-check`. It also adds the ability to set the correct baseline revision when checking version bump. That is, it fixes #12347.

In addition, this integrates the community tool `cargo-semver-checks`. SemVer violation can now be detected earlier.

### How should we test and review this PR?

This PR extracts the registry query part from `xtask-unpublished` and removes other pars. I don't feel like we need it in the short term.

For how it works, please the check doc comment in each function.

One concern is that this check is still a required job for bors. I believe `@obi1kenobi` is quite responsive and willing to help if there is something wrong. So, waiting for an upstream fix won't be a problem for cargo. Also as a good citizen in the community, we can always contribute back.
(Take it easy `@obi1kenobi,` don't be stressed out 🙂)
<!-- homu-ignore:end -->
let base_tree = base_commit.as_object().peel_to_tree()?;
let head_tree = head.as_object().peel_to_tree()?;
let diff = repo
.diff_tree_to_tree(Some(&base_tree), Some(&head_tree), Default::default())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure which one is better

  • Diff members between base...head
  • Diff members between referenced_commit..head

base here refers to the commit this PR want to merge into. referenced_commit is what fn referenced_commit returns.

The former one focuses on the current PR and is more time/resource efficient, while the latter one can catches something like #12401, though in the future case like #12401 shouldn't appear after this PR gets merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is only used for the finding of whats changed and not for comparing the versions, I think using the PR base is sufficient

As you mentioned, by using the beta branch for comparing versions, #12401 shouldn't be a problem

@bors
Copy link
Contributor

bors commented Jul 26, 2023

💥 Test timed out

@obi1kenobi
Copy link
Member

Thanks @obi1kenobi! Some questions:

  • The GitHub Action doesn't seem able to set --baseline-rev, or am I missing something?
  • Regarding manual caching, is using baseline rev as cache key sufficient and safe?

Out of curiosity, what's the motivation for using a git revision as the baseline in CI? Asking because the usual CI workflow is to check against the previous published version, and I'd love to figure out if there's an alternative workflow we're not doing a great job of supporting today.

cargo-semver-checks only generates cached rustdocs for version-based baselines at the moment, so using --baseline-rev currently means no caching will happen. This is also why the GitHub Action doesn't currently expose that flag.

@weihanglo
Copy link
Member Author

I see. Thanks for the info! The release of Cargo is included in Rust's 6-weeks train model. Every crate gets into beta is considered as “released”, though they won't actually be released until hitting stable.

The model I propose here is roughly like

  • PR for master branch should check against beta branch in this repo (i.e, the latest rust-1.*.0 branch).
  • A beta backport PR should check against stable branch in this repo. Note that it's not the version on crates.io, since there might also be a stable-backport needed to take care of).
  • A stable backport PR should check against the version on crates.io.

I don't feel like it is a common case. It should be a low priority task as well, as cargo-semver-checks doesn't seem to be the bottleneck of Cargo CI pipeline. I am fine with no caches at this moment :)

@weihanglo
Copy link
Member Author

Thanks for the review. Most of the review comments are addressed. cargo semver-checks check-release --workspace seems broken at this moment. Filed an issue to them already obi1kenobi/cargo-semver-checks#511.

@weihanglo weihanglo marked this pull request as ready for review August 1, 2023 18:19
Copy link
Contributor

@epage epage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to r= me

@weihanglo
Copy link
Member Author

@bors r=epage

Thanks a lot for the review and your prior pull request!

@bors
Copy link
Contributor

bors commented Aug 1, 2023

📌 Commit 8d31d62 has been approved by epage

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 1, 2023
@bors
Copy link
Contributor

bors commented Aug 1, 2023

⌛ Testing commit 8d31d62 with merge 6145d0c...

@bors
Copy link
Contributor

bors commented Aug 1, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 6145d0c to master...

@bors bors merged commit 6145d0c into rust-lang:master Aug 1, 2023
20 checks passed
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Aug 2, 2023
Update cargo

8 commits in c91a693e7977e33a1064b63a5daf5fb689f01651..6dc1deaddf62c7748c9097c7ea88e9ec77ff1a1a
2023-07-31 00:26:46 +0000 to 2023-08-02 00:23:54 +0000
- `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test (rust-lang/cargo#12429)
- ci: rewrite bump check and respect semver (rust-lang/cargo#12395)
- fix(update): Tweak CLI behavior (rust-lang/cargo#12428)
- chore(deps): update compatible (rust-lang/cargo#12426)
- Display crate version on timings graph (rust-lang/cargo#12420)
- chore(deps): update alpine docker tag to v3.18 (rust-lang/cargo#12427)
- Use thiserror for credential provider errors (rust-lang/cargo#12424)
- Clarify in `--help` that `cargo test --all-targets` excludes doctests (rust-lang/cargo#12422)

r? `@ghost`
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Aug 2, 2023
Update cargo

8 commits in c91a693e7977e33a1064b63a5daf5fb689f01651..6dc1deaddf62c7748c9097c7ea88e9ec77ff1a1a
2023-07-31 00:26:46 +0000 to 2023-08-02 00:23:54 +0000
- `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test (rust-lang/cargo#12429)
- ci: rewrite bump check and respect semver (rust-lang/cargo#12395)
- fix(update): Tweak CLI behavior (rust-lang/cargo#12428)
- chore(deps): update compatible (rust-lang/cargo#12426)
- Display crate version on timings graph (rust-lang/cargo#12420)
- chore(deps): update alpine docker tag to v3.18 (rust-lang/cargo#12427)
- Use thiserror for credential provider errors (rust-lang/cargo#12424)
- Clarify in `--help` that `cargo test --all-targets` excludes doctests (rust-lang/cargo#12422)

r? ``@ghost``
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2023
Update cargo

10 commits in c91a693e7977e33a1064b63a5daf5fb689f01651..020651c52257052d28f6fd83fbecf5cfa1ed516c
2023-07-31 00:26:46 +0000 to 2023-08-02 16:00:37 +0000
- Update rustix to 0.38.6 (rust-lang/cargo#12436)
- replace `master` branch by default branch in documentation (rust-lang/cargo#12435)
- `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test (rust-lang/cargo#12429)
- ci: rewrite bump check and respect semver (rust-lang/cargo#12395)
- fix(update): Tweak CLI behavior (rust-lang/cargo#12428)
- chore(deps): update compatible (rust-lang/cargo#12426)
- Display crate version on timings graph (rust-lang/cargo#12420)
- chore(deps): update alpine docker tag to v3.18 (rust-lang/cargo#12427)
- Use thiserror for credential provider errors (rust-lang/cargo#12424)
- Clarify in `--help` that `cargo test --all-targets` excludes doctests (rust-lang/cargo#12422)

r? `@ghost`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 3, 2023
Update cargo

10 commits in c91a693e7977e33a1064b63a5daf5fb689f01651..020651c52257052d28f6fd83fbecf5cfa1ed516c
2023-07-31 00:26:46 +0000 to 2023-08-02 16:00:37 +0000
- Update rustix to 0.38.6 (rust-lang/cargo#12436)
- replace `master` branch by default branch in documentation (rust-lang/cargo#12435)
- `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test (rust-lang/cargo#12429)
- ci: rewrite bump check and respect semver (rust-lang/cargo#12395)
- fix(update): Tweak CLI behavior (rust-lang/cargo#12428)
- chore(deps): update compatible (rust-lang/cargo#12426)
- Display crate version on timings graph (rust-lang/cargo#12420)
- chore(deps): update alpine docker tag to v3.18 (rust-lang/cargo#12427)
- Use thiserror for credential provider errors (rust-lang/cargo#12424)
- Clarify in `--help` that `cargo test --all-targets` excludes doctests (rust-lang/cargo#12422)

r? `@ghost`
@weihanglo weihanglo deleted the cargo-semver-checks branch August 3, 2023 13:15
@ehuss ehuss added this to the 1.73.0 milestone Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

version-bump check doesn't know a subcrate hasn't bumped on nightly if we've bumped it on beta
6 participants