-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add json output flags to our CI tool #13187
base: main
Are you sure you want to change the base?
Conversation
|
a31623c
to
b243706
Compare
b243706
to
348f18a
Compare
Update. We don't loose color. We use a env variable to force cargo to always output color. |
348f18a
to
1f4a102
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.
This works, but it gives me the feeling that the current structure we are using is flawed for this kind of logic.
I'm going to approve this with a few nits on comments, but I look forward to further refactors. (Also yay better error handling!)
Oh and also make sure to mark the PR as ready for review, since you cannot merge a draft. :) |
1f4a102
to
6a12558
Compare
6a12558
to
71c886b
Compare
71c886b
to
0193ed0
Compare
This is part 1 of what I'm planing to be a 3 part project to improve how our CI reports errors.
Objective
Add a way for our CI tool to output messages in a structured form usable by other tools.
Solution
Most everything we currently use in our tools can be configured to output [
json]
(https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages). So we just need to process it a bit and output effectively that.The only thing that can't do json are our compile fail tests and formatting. Formatting can't do it because the
check
flag forrustfmt
doesn't support json output. The compile fail tests can't do it because they use a custom test harness. We'd maybe be able to switch them to the standard cargo harness. We would likely loose the ability to show stderr diffs which is less than ideal but they don't work right now so it isn't much of a blocker.The result is that everything that supports json output gets a
emit_json
flag and I've refactored how we invoke our commands so we can parse the json output they now output.Testing
The code was linted through our CI tool using the clippy subcommand using it with and without the
emit_json
flag,cc @BD103