3 releases (breaking)

0.3.0 Nov 22, 2023
0.2.0 Oct 17, 2023
0.1.0 Jun 13, 2023

#106 in Cargo plugins

Download history 585/week @ 2023-10-31 739/week @ 2023-11-07 902/week @ 2023-11-14 964/week @ 2023-11-21 890/week @ 2023-11-28 753/week @ 2023-12-05 692/week @ 2023-12-12 470/week @ 2023-12-19 158/week @ 2023-12-26 394/week @ 2024-01-02 531/week @ 2024-01-09 726/week @ 2024-01-16 703/week @ 2024-01-23 554/week @ 2024-01-30 613/week @ 2024-02-06 720/week @ 2024-02-13

2,742 downloads per month

Apache-2.0

58KB
1.5K SLoC

Parity Publish

WIP tool to publish and manage publishing cargo workspaces to crates.io

Previous Work and Rationale

https://github.com/paritytech/subpub https://github.com/paritytech/cargo-unleash https://github.com/paritytech/releng-scripts (partly)

This sort of tool has been attempted a few times before at parity with varying ammounts of success. Though it's been decided to start over as the existing tools were projects of people who have left the company and are thus no longer here to maintain it.

So, instead of trying to pick up and modify existing tools, I think it's a better idea to start over fast. Get a barebones tool up and running with the features we currently want right now before fleshing out to a more general and polished tool.

Though these tools act as a useful reference and should be referred to when thinking how to impllement something.

What The Tool Does (And Will Do)

The tool is split up into sub commands. The current plan is to rapidly iterate on subcomamnds that are useful now and eventually build up a full tool and workflow. Building further more complex functionality from the simpler subcommands that we've build.

Status

parity-publish status <workspace>

This command displays information about the crates in a workspace. Compares the local version to crates.io and tells us if parity owns the crate.

Claim

parity-publish claim <workspace>

This command claims all the crates in a workspace by publishing v0.0.0 stub packages under the parity crate account.

TODO: integrate into github action for automatic claiming.

Changed

parity-publish changed <workspace>

This command tells you which crates have been modified since being published to crates.io.

Plan (WIP)

parity-publish plan <workspace>

This command plans a version bump and publish, writing the plan to some sort of lock file. The rationale here is that the tool should figure out everything it needs to do ahead of time and output this in a clear way. This allows the release team to fully review a publish before running it and so we can edit the file to make tweaks as needed. As with a set of crates as complicated as this, one of changes and manual intervention sometimes need to be made.

When planning releases, each crate is it's own separate thing and is bumped as needed and adhering to semver. We may want to group some crates together to have them share version numbers but I don't know if this is useful at the moment.

The general workflow for this will be:

  • Calculate which creates have changed so need to be published
    • This code is already written inside the changed command
  • Calculate what sort of version bump to perform
    • To do this we need to get the list of commits/PRs that are new to this release
      • The current plan is to tag $crate-v$version for each crate release so we can easy calculate this
    • We then need to find out which crates each PR/commit touch and what kind of changes they make to each crate
      • The plan here is some sort of labeling in each commit/PR
    • Then bump all the versions in Crates.into
    • Then bump crates that had a dependency do a major bump. if they expose that dependency in the public API.
      • We can probably scan the source code for this
    • Then bump the dependency table section of each crate
    • Then decide publish order
    • Publish!

Apply (WIP)

parity-publish apply <workspace>

This command applies the plan. See plan for the details.

Dependencies

~75–120MB
~2.5M SLoC