Skip to content

Sync and Release automation #13694

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

flip1995
Copy link
Member

Based on #13693

Adds 2 subcommands to cargo dev:

  • cargo dev sync update_nightly: Which updates the nightly versions in rust-toolchain and clippy_utils/README.md
  • cargo dev release bump_version: Bumps the version in all relevant Cargo.toml files

Those are pulled out of #12759, which I'll rebase on this.

Next step is to update the documentation, which I'll partly pull out of #12762

r? @blyxyas (as you reviewed the first PR in the chain and were assigned to the second one)

cc #13556

changelog: none

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 15, 2024
@blyxyas
Copy link
Member

blyxyas commented Nov 16, 2024

Seems that there is a CI error, but this has to be the cleanest commit history I've seen in the repo to date. Great work! 🤠

@flip1995 flip1995 force-pushed the clippy-utils-publish-automation branch 5 times, most recently from d260595 to 6163901 Compare November 17, 2024 17:49
@blyxyas
Copy link
Member

blyxyas commented Nov 17, 2024

Something I'm wondering, what happens with versions like 1.72.1, would it follow a 0.Major.Minor-Patch convention?

Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

Just a question, and this is looking pretty good!

Comment on lines +305 to +329
#[derive(Args)]
struct SyncCommand {
#[command(subcommand)]
subcommand: SyncSubcommand,
}

#[derive(Subcommand)]
enum SyncSubcommand {
#[command(name = "update_nightly")]
/// Update nightly version in rust-toolchain and `clippy_utils`
UpdateNightly,
}

#[derive(Args)]
struct ReleaseCommand {
#[command(subcommand)]
subcommand: ReleaseSubcommand,
}

#[derive(Subcommand)]
enum ReleaseSubcommand {
#[command(name = "bump_version")]
/// Bump the version in the Cargo.toml files
BumpVersion,
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for these two to be subcommands in their own structs? Is there a plan to add new commands to them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, see #12759

@flip1995
Copy link
Member Author

flip1995 commented Nov 18, 2024

Something I'm wondering, what happens with versions like 1.72.1, would it follow a 0.Major.Minor-Patch convention?

Nah, we won't bump the version of our crates with patch versions. We're also no longer doing patch releases in Clippy. So this is not a concern.

For clippy_utils a patch version can never break the build of clippy_utils, as that is pinned to a nightly, not a stable toolchain. The nightly that the stable release is based on doesn't change, if a patch release is done. So there's no action required.

There was some dependence between the different subcommands of clippy_dev. And
this dependence will increased with the introduction of the sync and release
subcommands. This moves the common functions to a `utils` module, to decouple
the other modules.
@flip1995 flip1995 force-pushed the clippy-utils-publish-automation branch from 6163901 to 4326144 Compare November 18, 2024 09:04
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

It currently has an error in the second commit (which causes a panic)

pub fn update_nightly() {
// Update rust-toolchain nightly version
let date = Utc::now().format("%Y-%m-%d").to_string();
replace_region_in_file(
Copy link
Member

Choose a reason for hiding this comment

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

You need to modify rust-toolchain, as it doesn't contain the comment.

Copy link
Member Author

@flip1995 flip1995 Nov 19, 2024

Choose a reason for hiding this comment

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

Oh good catch. That must've been lost during a rebase. Added those in the second commit. Nothing else changed in the force push.

Currently this only provides the feature to auto-update the nightly version in
the `rust-toolchain` file and the `clippy_utils/README.md` file. The actual sync
to and from the Rust repo will be added with the move to Josh.
Currently this only provides the feature to auto-update the versions in the
`Cargo.toml` files. With the move to Josh, a command to get beta and stable
release commits will be added.
@flip1995 flip1995 force-pushed the clippy-utils-publish-automation branch from 4326144 to 93d5ccd Compare November 19, 2024 16:59
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! ❤️ 🌈

@blyxyas blyxyas added this pull request to the merge queue Nov 19, 2024
Merged via the queue into rust-lang:master with commit a19d69d Nov 19, 2024
9 checks passed
@flip1995 flip1995 deleted the clippy-utils-publish-automation branch November 20, 2024 09:31
github-merge-queue bot pushed a commit that referenced this pull request Nov 29, 2024
This updates the documentation after #13694. It is not based on that PR
chain and can be merged independently, but should be merged after that
PR.

This is partly pulled from #12762, but removing the Josh parts.

This includes instructions on how to publish `clippy_utils`.

Closes #13556 (yes, this
is the final PR 🙂)

r? @blyxyas

changelog: `clippy_utils` is now published to crates.io
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants