-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat(config): allow configuration from package/workspace metadata #1082
base: main
Are you sure you want to change the base?
Conversation
Hey @MarcoIeni, can you take a quick glance on this and let me know if you like the implementation? 🐻 |
Sure. It's a busy period. I'll do it as soon as I can :) |
I guess the only thing left is to write some integration tests \o/ |
pub fn config(&self, cargo_metadata: &Metadata) -> anyhow::Result<Config> { | ||
super::parse_config( | ||
self.config.as_deref(), | ||
self.optional_project_manifest(), |
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.
project_manifest is already inside self.config
. You don't need this parameter.
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.
self.config
is a PathBuf
. Not sure if I understood.
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.
oops sorry. Than you can find the project manifest in cargo_metadata.workspace_root.join("Cargo.toml")
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.
Not sure if we can do this. What happens if the user provided a custom path via --project-manifest
?
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.
Sorry, I missed this comment.
It's already taken into account here
Integration tests would be great 🥳 |
I don't know why cargo-assist is failing. Please ignore it 😅 EDIT: fixed it. GitHub actions can be annoying sometimes. |
Any idea how to add integration tests for this? Do you have some examples? |
release-plz integration tests are here. Complex ideaThe first test that comes to mind is specifying a different changelog_config in the Cargo.toml and testing that the changelog is generated according to the custom changelog. You can use this test as a starting point. Easier alternative
|
I tried to add integration tests in the last commit but I'm not sure if I'm on the right path. Please check it out and let me know! |
])?; | ||
if let Some(project_manifest) = project_manifest | ||
.or(Some(Path::new(CARGO_TOML))) | ||
.filter(|v| v.exists()) |
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 the project manifest exists, you ignore completely the file_contents
, returning the default configuration on line 100, right? 🤔
Imagine somebody that doesn't specify the config in the Cargo.toml metadata. Their release-plz.toml
file is ignored. I tested this by running your branch on release-plz itself.
// check both workspace and package metadata | ||
for metadata in [ | ||
Some(metadata.clone().workspace_metadata), | ||
metadata.packages.first().map(|v| v.metadata.clone()), |
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.
why do you only consider the first package?
Also, metadata.packages
also contains your dependencies. We should only consider workspace members.
You can find workspace members with this function.
closes #1022
This PR makes it possible to configure
release-plz
fromCargo.toml
as follows:Or:
TODOs