bacon
bacon copied to clipboard
Run multiple jobs after each other
Hi,
Thanks for such a great project!
I would love to always run the tests no matter if clippy or check finds any errors. I believe that in https://github.com/Canop/bacon/issues/42 they talk about something similar (always seeing the output of the test job).
Motivation: For me it is not uncommon to be working on something but still have some clippy/check issues (usually unused functions, especially when writing tests). It would be nice if I could instruct bacon to always run the tests even though I get some warnings from the other checks.
What I tried: I tried chaining the jobs together using the on_success = "job:clippy"
syntax on my test
definition but then when I make a change the tests are not re-run as bacon is now on the clippy job. As I might have a warning in clippy I cant add a on_success = "back"
as it is not seen as a success. I did try setting allow_warnings = true
and then back on success but it did not seem to work.
Being able to run both clippy/check and tests and show the output of both (or just the tests pass! header) always would be a nice feature.
Here is an example of what I have tried.
[jobs.clippy]
command = [
"cargo", "clippy",
"--all-targets",
"--color", "always",
]
need_stdout = false
allow_warnings = true
on_success = "back"
[jobs.test]
command = [
"cargo", "test", "--color", "always",
"--", "--color", "always", # see https://github.com/Canop/bacon/issues/124
]
need_stdout = true
on_success = "job:clippy"
I came here looking for the exact same idea. One additional thing i'd like to add is the ability to make a target sticky. Ie lets say i want to run three jobs:
- tests
- check
- clippy
If i cascade those three, it might be a fair bit of computation. Lets then say clippy finds an issue, so we go to fix it - it would be nice if the failing step (3 in this case) could be marked as sticky. Such that when we make a change on the FS it re-runs the previously failing step and only goes back to the full rotation after that issue is resolved.
Without this "sticky" feature, it would mean subsequent steps become more and more expensive to iterate on if an issue is found with them, as previous successful steps always have to run. Perhaps there are better ideas to this problem, but i imagine it would be an issue with multiple-jobs if we cannot make latter jobs sticky in some fashion. Ideally without intervention, optionally.
Hmm, this stickiness concept is not something I would want. It seems that there are many workflows that people are looking to achieve :)
I have settled on running 2 instances of bacon for now, one that runs clippy and one that runs tests and this covers most things for me. Ideally I would not have to run two instances but still be able to always run clippy and tests (and see the output of both) but this will do for me.
Out of curiosity, how did you plan on handling the lag/delay that each additional step introduces? Ie are you not concerned about needing to run the Nth step repeatedly to rerun tests/etc?
Not really no, my concern is that if I don't automatically re-run tests on each save I will miss a change that breaks them and then spend more of my time finding the error rather than spending the computers resources to make sure I don't mess up.
The thing I tried in my initial message was just an attempt at getting it to work :)
From the screenshots I actually expected things to be TUI tabs at the top that allowed jobs to run in tandem.
What would be great is to have jobs run in parallel and then as the project updates they get re-run and the tabs have badges that show that an error or warning or whatever was found.
I'm doing kernel development so there are multiple ways to compile the same project, defined as aliases in .cargo/config.toml
, and I typically have a shell script that runs them all one after another. Having Bacon run them all in parallel and showing which failed and which succeeded would be a HUGE time saver.