-
Notifications
You must be signed in to change notification settings - Fork 37
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
ci: stop using jq, calculate which crates use cargo deb #104
Conversation
6ac4bb2
to
5480d81
Compare
|
||
|
||
def run_with_stdout(command, print_cmd=True): | ||
assert isinstance(command, str) |
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.
That's kinda a useless check. very broad.
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.
It seems beneficial for error detection. What is the recommended way to do this, if I'd like a nicer error message / more safety than duck typing?
scripts/rust_ci_helper.py
Outdated
assert exit_code == 0 | ||
|
||
|
||
def run_with_stdout(command, print_cmd=True): |
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.
as above, i would personally just keep 1 run
command that gets all stdout/err and print stuff. if you want to be "lean" you can only print stuff in case of error.
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.
The reason why run_with_stdout and run both exist is that the latter captures stdout and wouldn't print it until execution is finished. Whereas the former just captures the error code, and therefore stdout is streamed in realtime. I could create a way to unify these two such that stdout is always printed in realtime, while still letting me capture the output as a python string, but that is more work than I think is worth.
Additionally, sometimes we really don't want to print the stdout. If I run the script on my machine and print the output of the metadata command for example, the results are so big that it lags/crashes the terminal multiplexer. We really do just want to pipe it to python and post-process it silently sometimes.
I've pushed a change that always prints the command being run though, and removes the print_cmd
flag.
5480d81
to
6d7888c
Compare
ed5099c
to
98a4962
Compare
Side note: writing this script really made me regret not just using rust, for these reasons:
I will not be making the mistake of python helper scripts again, and will port this in the future to just be a cargo xtask. I might have felt differently if this repo didn't already require cargo and if everyone was using python extensively already and the package managers and venvs and stuff was already set up. Then I'm not sure it would make sense to use rust. But since its primarily a rust codebase, I think sticking to rust where possible makes sense. |
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.
In #101 and #103, I agreed to port the code from jq to pure python. This pr implements that change and also merges the two helper python scripts into one file.
I also fixed a regression where not all cargo debs were being produced, and not all binaries were getting copied into the artifacts dir.