-
Notifications
You must be signed in to change notification settings - Fork 440
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
chore(ci): CI grouping and refactoring #1024
chore(ci): CI grouping and refactoring #1024
Conversation
4f5fa68
to
cc11c8a
Compare
6c58676
to
7922559
Compare
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.
LGTM!
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.
Thanks a lot!
I propose to change println!
with debug!
or info!
macros, which can be enabled through filters.
Here an example of how to do that in main
// Enable filter to log the information contained in the lib.
let filter_layer = EnvFilter::try_from_default_env()
.or_else(|_| {
// We can add this through clap
if opts.verbose {
EnvFilter::try_new("debug")
} else {
EnvFilter::try_new("info")
}
})
.unwrap();
// Run tracer.
tracing_subscriber::fmt()
.without_time()
.with_env_filter(filter_layer)
.with_writer(std::io::stderr)
.init();
and in Cargo.toml
tracing = "^0.1"
tracing-subscriber = { version = "^0.3", features = ["env-filter"] }
xtask/src/main.rs
Outdated
@@ -2,6 +2,7 @@ use clap::{Parser, Subcommand}; | |||
|
|||
mod publish; | |||
mod runchecks; | |||
pub(crate) mod utils; |
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.
Can we write mod utils
and import things as use crate::crate_name::function
?
xtask/src/utils.rs
Outdated
} | ||
|
||
/// Start log group | ||
pub(crate) fn start_log_group(title: String) { |
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.
Instead of String
we can use Cow
in this way we can write:
start_log_group("Something")
and start_log_group(format!("something"))
. I guess we just need to write a generic that implements Into<Cow>
xtask/src/utils.rs
Outdated
pub name: String, | ||
pub path: String, |
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.
We can use pub(crate)
or remove the visibility attribute if they are used in the same file
91b85b8
to
16cd081
Compare
This new logging seems a bit complicated, I was proposing to replace |
@Luni-4 if we want a logger, then I'd say let's do it right. This make sure it outputs correctly also to the Github Action logs, meaning we'll be able to see highlighted warnings and errors easier. It's also just about the same amount of boilerplate for the changes you were asking for logger, tracer and using Cow. IMO - I think this is fine.. but I guess its up to you all to decide. |
16cd081
to
63d705d
Compare
I'm not against this new logger, just saying that is more complete, perhaps this is the right term, of what I have thought, but I'm fine with it |
63d705d
to
a3f744e
Compare
@louisfd @nathanielsimard this one is ready to go! |
if std::env::var("CI").is_ok() { | ||
log!(log::Level::Info, "::group::{}", title) | ||
} else { | ||
log!(log::Level::Info, "{}", title) | ||
} |
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 use a different rendering depending of the CI? can ::group::{}
works everywhere? Same question for all other occurences.
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.
well, in Github Actions, ::group:: creates a grouped log that can be minimized / maximized. In our normal shells it doesn't really do anything except actually print out ::group::Title
-- I thought this might be neater. But if we don't mind printing out ::group:: in our normal developer shells, then we don't need different rendering.
Checklist
run-checks all
script has been executed.Changes
Improvements to CI Output:
CI_RUN
for standardCI
envExamples Output
STD Output