-
Notifications
You must be signed in to change notification settings - Fork 23
Sort across all workspace deps (normal, dev & build) #394
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
Conversation
@katyo This is my first foray into github actions, so if there's anything else I need to do for testing let me know. This is currently a blocker for us at Fuel Labs so I'm happy to make any changes needed to get a quick turnaround: https://github.com/FuelLabs/fuels-rs/actions/runs/1759190798 |
@katyo It seems like the only way to publish a set of crates with circular dependencies is to pass the |
@Voxelot I'm not quite familiar with cargo internals. Does cargo handles |
Based on my testing, it appears cargo applies the same cyclic detection to dev-dependencies as normal and build dependencies during a publish. I'm not sure why the decision was made to require dev-dependecies to be available during publish (maybe for rust-doc example code or license validation). I found an outstanding issue about this from a few years ago but it doesn't look like much progress has been made since it seems complicated to satisfy the requirement to publish all dev-dependencies: rust-lang/cargo#4242 Apart from disabling cyclic checking with the |
After some additional investigation, I discovered that dev-dependencies aren't treated like normal dependencies during publish validation if they use local paths instead of versions. https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies
I've updated the PR to reflect this behavior. Now dev-dependencies without a version aren't included in cyclic checking. It appears rquickjs includes local dev-deps by paths or version interchangeably (ex1 vs ex2). Since it may not be possible to only use local paths for dev-dependencies in all cases (e.g. rust-doc code examples), I've also added the |
|
||
Usually you don't needed set `publish-delay` because this action ever checks availability of published | ||
Usually you don't need to set `publish-delay` because this action never checks availability of published |
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.
Never?
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.
This action checks version availability and tries to download package of corresponding version for each dependency.
info(`Sorting packages according to dependencies`) | ||
sorted_packages = sortPackages(packages) | ||
} else { | ||
sorted_packages = Object.keys(packages) |
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 think that complete bypassing sorting isn't a best solution. It may cause problems with publishing (for ex. in case of rquickjs
). In my opinion skipping dev-dependencies
when sorting is much better.
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.
If verification is disabled theoretically the order is irrelevant since the deps are only downloaded and checked during cargo publish packaging (which is skipped when --no-verify is used).
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.
Course, but in that case no-verify
will be required to publish rquickjs
.
Actually --no-verify
arg is used here to speed-up publishing by skipping complex verification because it already executed in previous steps of CI workflow.
In my opinion we could simply skip |
We can't ignore versioned dev-deps from the publishing order without using the
Not only are cyclic dependencies an issue, but the packaging verification during a normal cargo publish will attempt to download any versioned dependencies, regardless of whether they are normal, build or dev deps. This means dev-deps with a version in a workspace need to be sorted and published in the correct order. The only way around this issue is to disable packaging verification with The reasoning for this is documented here:
rust-lang/crates.io#1789 (comment) It seems like the main usecase for publishing dev-deps was for linux distros to be able to run An alternative which might be a more reasonable default than |
This PR updates the action to support ordering across all categories of dependencies, rather than just normal dependencies like before. Now if you have crates in your workspace used for integration testing or proc-macros at build time, they will publish in the correct order before their dependents.
closes #305