-
Notifications
You must be signed in to change notification settings - Fork 629
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
re: chore: ready workspace for publishing #5130
Conversation
nearcore v0.5.0 [runtime] v3.1.0
Sticks out like a sore thumb. I'll try to merge the crate into primitives to remove one thing we need to think about here. |
I've reconsidered that. The list above misses near-vm-logic is also past 1.0, so solving the problem just for So, I suggest to do the following, to keep the versioning conssitent: publish all crates, including It's very weird to have |
What value is brought in by this process? My gut instinct is that it's pure overhead. To take a step back, do we need "The versions of published crates on crates.io should always match their versions on GitHub." if we are also striving for "All crates in the workspace should share the same version."? A simpler solution is to avoid any meaningful versions in Cargo.tomls at all, and instead just fill them in at the point of publishing. I think that's what rustc and rust-analyzer are doing. An alternative, used by Cargo, is to release the crates only after the binary release is cut (so, every six weeks), and have Between the two, I lean towards the first option -- publish arbitrary commit every week, fill-in versions on publish. |
Love this idea. Thank you so much for your contributions, I wasn't sure if we could safely down-version those runtime crates already published past I'll version the
On the tooling side, I'll introduce a So, on every push to master, Hermes (CI) would apply that version across the entire workspace, and if there's a version change, all non-private crates in the workspace gets published to crates.io.
Since we're dropping individual crate versions from the repo, Hermes (CI) can employ tagging instead. Any commit on master that changes the version field would be tagged. Something like This would ensure we have consistent versioning across the workspace without needing Chronos (CI) to automate bumping versions across the workspace, nor do we need the system creating PRs with those changes. As, it would be as easy as bumping the
With the process describes in this comment, we won't need that anymore. |
Yeah, really like the updated proposal! Just one small thing, I wouldn't do "yank the >=1.0.0 versions from crates.io" right away. For that, I'd wait until the new version of the SDK is released, so that contract developers don't have yanked crates in the lockfiles. 1 to tags. Implementation wise, you want to first
So, tagging isn's strictly necessary, but would be nice. |
For my project, I use a stateless implementation of the idea -- new version is published if there isn't a git tag for the version currently specified in the manifest. This allows for workflows where you upgrade the version, publishing fails for some reason, you push a fix to publishing, and the publishing of the same version is retried. |
I'm not sure I completely agree with this. Unit tests can be a great way to quickly test and avoid the pattern of As for not having unit tests in solidity, there are some pseudo solutions like https://remix-ide.readthedocs.io/en/latest/unittesting.html, but I think it's important to compare against other Rust/wasm based VM in the ecosystem, and the ones I know about all support unit tests (edit: actually Elrond is one that doesn't, but more popular ones do). Maybe we can consider moving these test utils to a separate crate to that of the SDK, but it currently has no overhead for actual compilation because none are enabled for |
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.
core/primitives/res/runtime_configs
Outdated
@@ -0,0 1 @@ | |||
../../../nearcore/res/runtime_configs |
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.
Symlink might not work well on Windows 🤷♂️
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.
Hm.. Can someone with Windows test this out. Previously we were referencing outside the package and while the local build worked, cargo package
didn't bundle those artifacts. This symlink aids cargo
in knowing to copy over those files when packaging, but I'm now unsure if the build works on Windows.
-- although I think git should normalize links 🤷🏽
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.
cc @Longarithm
I'd maybe try to keep it simple and just move files themselves here.
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.
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 tried that on Windows, and indeed it did not work well. I feel this primitives/runtime screams for being extracted into a separate crate since including all these json blobs does not feel right
cfc0739
to
65c6058
Compare
Anyone really, but since it goes through our familiar PR review process, we can ensure to only justifiably bump the version.
Once this PR is merged, CI automation kicks in to auto-publish crates once it detects a change to the version number on master. So, for every PR that updates the version, when pushed to master, all non-private crates would in turn, get published with that version number.
This is variable, there's no requirement to constantly turn out new versions, so we only need to publish when we actually need to. I suppose reasonable times are when we have protocol changes, the resolution of a critical bug involving the published crates or a security flaw is addressed.
Could you elaborate? I'm not sure I understood the question. |
Thanks for clarifying, well because we have a unified version across the workspace, we can't maintain that rule on a per-crate basis. We're keeping things on |
Currently, with no codeowner for the workspace manifest, GitHub, I believe should only require approval from at least, one maintainer.
Given the process, one would only need to own the workspace's Cargo.toml, but seeing as that spec dictates the versions of a number of non-private crates owned by sets of people, notifying those owners might be in order, but not as necessary since versioning and publishing is rather trivial. |
if a bot's job is only to detect and auto-approve changes to the version, it's no different from the usual approval from a maintainer. But if we stick to the manual approval, at least we get eyes on it.
I think this defeats the purpose of publishing automation, though. |
We have this already: a custom fork of In the repo, we keep all crates on It's equivalent to what |
@pmnoxx Thanks for your inputs! I feel we are on the same page, and as @miraclx pointed out, the current implementation almost follows your proposal D (the order of version bump and PR is flitted to simplify the flow (it is easier to edit a single line in the project root Cargo.toml rather than needing to have a script / cargo-workspaces on every developer machine willing to bump the version)
I proposed this strategy of publishing crates through a regular PR process CI automation, and I believe we indeed don't need a heavy review process here, but at the same time, it allows the process to be controlled and fairly straightforward, i.e. one person proposes the version bump based on some need (via PR), and at least one other person approves it, thus there are at least two people in the loop. |
@pmnoxx I think this PR is fine as is. We don't always need to split a PR for the sake of making it easier to approve. Especially when it is about some renaming or version updates, I actually think it is easier to review it this way. |
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.
Nice work and clear explanation in doc!
Happy to announce: the automation succeeded! We have everything published, and we have it tagged as a reference point! |
@miraclx thank you so much for persevering here! |
Tracking issue: #5763 This PR implements crate compliance within the workspace. ### TLDR; This PR introduces a system for ensuring all the crates in the workspace are well-defined according to a series of defined rules. ### Backstory Since #5130 was merged, two PRs have introduced new _private_ crates missing the `publish = false` specification. Meaning, CI, armed with that update, wrongly attempted to publish those crates as though they were intentionally meant to be published. Luckily, in both cases, it failed for crate packaging related issues, so they weren't actually published. But would've if that didn't happen. (those crates have now been properly marked private in #5413 and #5670). ### Solution CI check for workspace crate compliance. Runs on every PR, won't merge into master unless all the checks pass. I've chosen to call this **Themis**, after the Greek Goddess of Justice, personification of law and order https://en.wikipedia.org/wiki/Themis. Here's a sneak peek to see what the test looks like: ([CI](https://buildkite.com/nearprotocol/nearcore/builds/9587#e715f1ac-69fe-4e0d-a0f3-6571cfbbdafb)) ([Demo](https://asciinema.org/a/TiQ8tbA0Ze40Sm1pvG8yjlVIm)) To be clear, this doesn't check \*all\* `Cargo.toml` files in the repository. Just the ones that are members of the nearcore cargo workspace.
The Plan
I closed #5100 because manually bumping versions is understandably tasking, and automating this requires special tooling or at least patching existing tooling to support our use case. Otherwise, we'd run into issues from having certain specific dep relationships. Luckily
cargo-workspaces
had already done most of the work, I just needed to patch it to better suit our workflow.Here's what we do want:
nearcore
,neard
,integration-tests
that are on0.0.0
should be excluded from version bumping.3.0.0
(e.gcrates.io:near-vm-logic
) should share a common version but be distinct from the rest of the workspace.publish = false
).My fork of
miraclx/cargo-workspaces
is now better suited for our use case.How?
nearcore/Cargo.toml
Line 51 in 9ebb9f6
nearcore/Cargo.toml
Lines 49 to 58 in 31763be
0.5.0
, the runtime group is ticked to3.1.0
)nearcore/Cargo.toml
Lines 60 to 69 in 31763be
Versioning
The current common version across the workspace as at the current master (00138f2) is
0.4.0
and the current common version across the[runtime]
crates is3.0.0
With this, we bump the versions of crates across the entire workspace to the next minor -
0.10.0
and in theand only publish however many are marked publishable:[runtime]
group to3.1.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
0.2.0
=>0.10.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
0.4.0
=>0.10.0
0.1.0-pre.1
=>0.10.0
0.1.0
=>0.10.0
0.1.0
=>0.10.0
[runtime]
near-vm-errors3.0.0
=>0.10.0
[runtime]
near-vm-logic3.0.0
=>0.10.0
Publishing Automation
I propose the introduction of a CI task that runs on every push to master, checking for version changes, and publishing any unpublished versions.
I propose two systems;The first one, let's call this Hermes (the messenger), runs on every push to master, checking for any version changes, publishing any unpublished versions.The second, let's call this Chronos (for time), runs once at the end of the week. Bumping the versions across the entire workspace by one minor tick. Which then opens a PR with all the changes to be reviewed, approved and merged. Once merged, Hermes (the first system) takes over to publish them. This way, we ensure to have consistent versioning across the entire workspace.