Skip to content
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

Fail Action if before-build or after-build Return a Non-Zero Exit Code #214

Conversation

olly
Copy link
Contributor

@olly olly commented Aug 18, 2020

In a similar fashion to the other commands, after running the before-build or after-build steps we should fail the action if they return with a non-zero exit code.


In our setup we use simplecov, of which versions after 0.17, produce a coverage report whose format is incompatible with cc-test-reporter. This produces failures in the after-build command, for example:

2020-08-18T10:02:02.6528716Z [command]/home/runner/work/cms/cms/cc-reporter after-build --exit-code 0
2020-08-18T10:02:02.7785615Z Error: json: cannot unmarshal object into Go struct field input.coverage of type []formatters.NullInt
2020-08-18T10:02:02.7792113Z Usage:
2020-08-18T10:02:02.7792927Z   cc-test-reporter after-build [flags]
2020-08-18T10:02:02.7793147Z 
2020-08-18T10:02:02.7793360Z Flags:
2020-08-18T10:02:02.7793764Z   -s, --batch-size int               batch size for source files (default 500)
2020-08-18T10:02:02.7794312Z   -e, --coverage-endpoint string     endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
2020-08-18T10:02:02.7794860Z   -t, --coverage-input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, simplecov, xccov]
2020-08-18T10:02:02.7795281Z       --exit-code int                exit code of the test run
2020-08-18T10:02:02.7796525Z   -r, --id string                    reporter identifier (default "***")
2020-08-18T10:02:02.7797282Z       --insecure                     send coverage insecurely (without HTTPS)
2020-08-18T10:02:02.7797996Z   -p, --prefix string                the root directory where the coverage analysis was performed (default "/home/runner/work/cms/cms")
2020-08-18T10:02:02.7798276Z 
2020-08-18T10:02:02.7798482Z Global Flags:
2020-08-18T10:02:02.7798946Z   -d, --debug   run in debug mode

In our specific case, as we use dependabot to update dependencies, we'd like this to fail the action to prevent the dependency from being updated. More generally I think it makes sense for this to fail the action in order to alert the user to fix the issue, although this could potentially be a breaking change for some user's setups.

I suspect this would fix #181

@olly olly force-pushed the fail-action-if-before-after-build-return-non-zero branch from 3c9724f to 90168e7 Compare August 18, 2020 11:01
@paambaati
Copy link
Owner

@olly Thanks a lot for this PR, I'll be rebasing this against latest master and adding tests in #231 if that's okay with you.

@paambaati paambaati closed this Sep 22, 2020
@paambaati paambaati self-assigned this Sep 22, 2020
@paambaati paambaati added the enhancement New feature or request label Sep 22, 2020
@olly
Copy link
Contributor Author

olly commented Sep 28, 2020

@paambaati of course that's OK with me. Thanks for merging. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format misconfiguration did not raise error in action (silenced).
2 participants