Closed rukai closed 3 years ago
Lets also pin the version of clap we are using as its not following semver:
--- a/shotover-proxy/Cargo.toml
+++ b/shotover-proxy/Cargo.toml
@@ -16,7 +16,7 @@ futures-core = "0.3.1"
chrono = {version = "0.4.10", features = ["serde"]}
async-trait = "0.1.30"
byteorder = "1.3.2"
-clap = "3.0.0-beta.1"
+clap = "=3.0.0-beta.1"
derivative = "2.1.1"
#evmap = {version = "11.0.0-alpha.7"}
itertools = "0.9.0"
Not strictly needed once we have a cargo.lock file checked in.
But still nice to have cargo update
not break our build.
I think that the Cargo.lock should be committed by the build process on the tag/branch that is the release. During development I think it should float, except in notable conditions like @rukai noted above. The idea is that we pick up changes as we go though the development process so that we stay at the front of the wave. Once the code is "frozen" we add the Cargo.lock and do the release process on a separate branch. The mainline code development continues on the main branch.
I have a couple of questions that will open a can of worms:
Committing the Cargo.lock is the standard approach for rust binaries, I dont see much value in deviating from that. By checking in the Cargo.lock we eliminate any "works on my machine" issues caused by version mismatch between developers.
A developer can at any time submit a cargo update
PR.
If we do end up with multiple maintained branches we can run a cargo update
just before splitting off that branch.
Doing that will also give us a useful diff of the changes in the cargo.lock that occurred before the release.
Coming back around to this.
If there is no easy way to include this, two options would be:
cargo update
check happen on a weekly / daily / whatever basis where no PR is raised if nothing change, automerge if all tests pass? (e.g. write our own GH action / PR bot).cargo update --locked
might very well be the check we need and can simply add it as a task to our GH Actions folder. It wont fail on explicity locked versions (e.g. clap in this case). However for a normal dep it will throw an error if we can update to the latest minor.
This way the PR reviewer can see if deps are out of date and request they get updated as part of a PR. If we need to lock to an older version for a good reason (e.g. bug in a new one), we can pin a version in the cargo file explitly. We'll just need to keep on top of pinned versions if/when they happen
If we value keeping our dependencies up to date then we also need to ensure that we upgrading to the latest major releases (and minor releases of 0.x.x crates). This requires human intervention to handle breaking changes. Once we go open source we can stick a badge for https://deps.rs/repo/github/shotover/shotover-proxy in our readme (example page for another project https://deps.rs/repo/github/bevyengine/bevy) deps.rs will show us outdated major releases (and minor releases of 0.x.x crates) Then when someone notices an outdated dependency they can submit a PR for it. I tend to keep an eye on such things and the process usually requires manual intervention so I dont see much value in automating.
We can then bundle the cargo update into these manual dependency update PRs.
The bots that I have seen for automatically updating rust dependencies create an absurd amount of PR noise.
cargo update --locked
might very well be the check we need and can simply add it as a task to our GH Actions folder. It wont fail on explicity locked versions (e.g. clap in this case). However for a normal dep it will throw an error if we can update to the latest minor.This way the PR reviewer can see if deps are out of date and request they get updated as part of a PR. If we need to lock to an older version for a good reason (e.g. bug in a new one), we can pin a version in the cargo file explitly. We'll just need to keep on top of pinned versions if/when they happen
I'm opposed to this, dependency changes should not go in unrelated PRs:
Good points - The deps.rs badge is a good approach in that we have a clear signal when things are out of date (plus dep security warnings as well), but decouples it from unrelated PRs
shotover is an application not a library so we should check in the Cargo.lock as per https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries