lukka / run-cmake

GitHub Action to build C++ applications with CMake (CMakePresets.json), Ninja and vcpkg on GitHub.
MIT License
171 stars 19 forks source link

Add option `allow-failure` #132

Closed LecrisUT closed 6 months ago

LecrisUT commented 6 months ago

Since overwriting a job's output is still impossible ^1, it would be nice to add a allow-failure similar to fail_ci_if_error on codecov and other such actions. Ideally it would have two variants, allow-failure and allow-test-failure in order to overwrite the overall/any failure of cmake, or specifically of ctest, but unfortunately the latter is incompatible with workflow presets (but things might change ^2).

I will try to make a PR to add this feature, but similar to #130, I could use some help setting up the local environment

lukka commented 6 months ago

@LecrisUT if I understood correctly you'd like to add a feature that makes the run-cmake action to not fail when cmake fails (i.e. when it returns an error different than 0).

I'd suggest to implement such logic in the tooling itself (e.g. cmake or ctest) or use GH features like output variables (e.g. the exit code of cmake/ctest could be set in an output variable by run-cmake) along with continue-on-error: true, and put the logic in a subsequent step in the workflow itself to decide whether to fail/not-fail the workflow.

Note that the fail-if-ic-error is useful to avoid failing the workflow when "Codecov runs into errors during upload.", which is a way to fail the workflow when the cause is external, which makes sense but also it is just a workaround rather than a fix of the root of the problem.

If you are willing to create a PR, you are welcome to proceed forward. I can certainly help with the review of the PR.

LecrisUT commented 6 months ago

I have experimented a bit, and it's worth pointing out that there are job.continue-on-error and steps[*].continue-on-error. The latter is the equivalent of this allow-failure. Not sure where it would be good to document, I have it documented in my cmake-template.