Run next step even though previous fails #26982
-
Hey guys, I looked in the forum before and the documentation, but all ways I tried seems not to work with our workflow. So I’m sorry if I missed something and this is a duplication. We have two packages in our python project which we want to test individually. Currently a job fails when the first test suite fails, but I’m trying to run the second one if the first one fails, but it should not run if some of the previous fails. This is a excerpt of the workflow file.
Thank you very much for you help. I’m happy to provide more information if needed. Marcel |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Just make
exit with non-zero code, like: https://stackoverflow.com/questions/24972098/unit-test-script-returns-exit-code-0-even-if-tests-fail you can verify this result with:
|
Beta Was this translation helpful? Give feedback.
-
Hey RammusXu, thanks for your reply. I’m not entirely sure what you meant, but I would like to change my python code just to satisfy the CI runner. The first test suite exists with 1.
|
Beta Was this translation helpful? Give feedback.
-
Hey RammusXu thanks for your reply. I’m not entirely sure what you meant, but I would prefer not to do this in python. And I think the first test suite exists with a non-zero.
PS: I post this again, because the previous reply is not showing. So I hope this will not show up twice. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply, but I’m not entirely sure this is wise, because I don’t want to handle this in python. In addition to that I think the first test suite exists with a non-zero code already:
PS: I have trouble send my replies, I hope they will not show multiple times. |
Beta Was this translation helpful? Give feedback.
-
Hi @segelzwerg , You could use next code in the if conditional in “Test Deep RL” step:
When you use expressions in an if conditional, you may omit the expression syntax (${{ }}) because GitHub automatically evaluates the if conditional as an expression. And possible values of step outcome are success, failure, cancelled, or skipped. failure() is a function which returns true when any previous step of a job fails. So just use ‘failure’ instead of ‘failure()’ could work for you. |
Beta Was this translation helpful? Give feedback.
-
@yanjingzhu yes that did the trick. Thanks a lot, I didn’t use ’ previously. Thank you very much |
Beta Was this translation helpful? Give feedback.
Hi @segelzwerg ,
You could use next code in the if conditional in “Test Deep RL” step:
When you use expressions in an if conditional, you may omit the expression syntax (${{ }}) because GitHub automatically evaluates the if conditional as an expression.
And possible values of step outcome are success, failure, cancelled, or skipped. failure() is a function which returns true when any previous step of a job fails. So just use ‘failure’ instead of ‘failure()’ could work for you.